Rule Definition
Built-in remote addresses cause problems when the target is moved. Avoid hardcoded network resources (e.g., IP addresses, URLs, absolute file paths, etc.) to assure robustness and portability.
Remediation
Utilize indirect access to network resources using underlying operating system calls and relative paths. In case hard-coding is necessary, isolating hard-coded data to installation scripts or configuration files can limit its potential negative impact and render the "build settings" easier to understand.
Violation Code Sample
var url = "http://0.0.0.0:8080/"
Fixed Code Sample
//crypted storage
let keychain = KeychainSwift()
url = keychain.get('theurl')
Reference
ASCRM-RLB-18
Related Technologies
Technical Criterion
CWE-1051 - Initialization with Hard-Coded Network Resource Configuration Data
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.