Using hardcode ip addresses in code (UsingHardcodeNetworkAddress)¶
Type | Scope | Severity | Activated by default |
Minutes to fix |
Tags |
---|---|---|---|---|---|
Vulnerability |
BSL OS |
Critical |
Yes |
15 |
standard |
Parameters¶
Name | Type | Description | Default value |
---|---|---|---|
searchWordsExclusion |
String |
Keywords to exclude from search |
Верси|Version|ЗапуститьПриложение|RunApp|Пространств|Namespace|Драйвер|Driver |
searchPopularVersionExclusion |
String |
Pattern to exclude popular versions from search |
^(1|2|3|8\.3|11)\. |
Description¶
It's forbidden to store in code:
- Network addresses (ip6, ip4)
There are several ways to properly store such information:
- Store in Constants.
- Store in Information registers.
- Store in separate module, where this diagnostic is disabled (not recommended).
- Store in Catalog, Exchange plan node and etc.
Examples¶
Incorrect:
NetworkAddress = "192.168.0.1";
Correct:
NetworkAddress = MyModuleReUse.ServerNetworkAddress();
Snippets¶
Diagnostic ignorance in code¶
// BSLLS:UsingHardcodeNetworkAddress-off
// BSLLS:UsingHardcodeNetworkAddress-on
Parameter for config¶
"UsingHardcodeNetworkAddress": {
"searchWordsExclusion": "Верси|Version|ЗапуститьПриложение|RunApp|Пространств|Namespace|Драйвер|Driver",
"searchPopularVersionExclusion": "^(1|2|3|8\\.3|11)\\."
}