rspec/rules/S1313/apex/rule.adoc

42 lines
923 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]