rspec/rules/S1313/apex/rule.adoc

27 lines
665 B
Plaintext
Raw Normal View History

2020-06-30 12:47:33 +02:00
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[]