Home

IP addresses should not be Hardcoded

Description

    The PowerBuilder code rule "IP addresses should not be Hardcoded" states that IP addresses should not be stored directly in the code, but should instead be stored in a configuration file. This allows the IP address to be changed without having to modify the code. This helps to ensure that the code is easier to maintain and allows for easier updates in the future.

Key Benefits

  • Security: IP addresses that are hardcoded can create security vulnerabilities, as they can be easily discovered and exploited by malicious actors.
  • Maintainability: Hardcoded IP addresses can make it difficult to maintain a system, as the IP address might need to be changed in the future.
  • Scalability: Hardcoded IP addresses can limit the scalability of a system, as it may be difficult or impossible to add additional components to the system.

 

Non-compliant Code Example

String ls_ip
String ls_ipv6

ls_ip = "127.0.0.1" //Non compliant code(Ip hard coded)
ls_ipv6 = "2001:cdba:0:0:0:0:3257:9652" //Non compliant code(Ip hard coded)

ls_ip = "3.3.3.3" //Non compliant code(Ip hard coded)
ls_ip = testIP("2.2.2.2") //Non compliant code(Ip hard coded)
Return testGlobalIP("1.1.1.1") //Non compliant code(Ip hard coded)
Visual Expert 2024
 VEPBRULE3