27 lines
665 B
Plaintext
27 lines
665 B
Plaintext
include::../description.adoc[]
|
||
|
||
include::../ask-yourself.adoc[]
|
||
|
||
include::../recommended.adoc[]
|
||
|
||
== Sensitive Code Example
|
||
|
||
----
|
||
String ip = '192.168.12.42'; // Sensitive
|
||
String clientIp = ApexPages.currentPage().getHeaders().get(‘True-Client-IP’);
|
||
Boolean isKnown = ip.equals(clientIp);
|
||
----
|
||
|
||
== Compliant Solution
|
||
|
||
----
|
||
StaticResource sr= [SELECT ip_address FROM StaticResource WHERE Name = 'configuration' LIMIT 1]; // Compliant
|
||
String ip_address = sr.body.toString();
|
||
String clientIp = ApexPages.currentPage().getHeaders().get(‘True-Client-IP’);
|
||
Boolean isKnown = ip_address.equals(clientIp);
|
||
----
|
||
|
||
include::../exceptions.adoc[]
|
||
|
||
include::../see.adoc[]
|