rspec/rules/S1313/kotlin/rule.adoc
hendrik-buchwald-sonarsource e6ad11b97e
Modify rule S1313: SONARKT-209, SONARKT-225 Add exceptions (#1179)
Ip ranges used for documentation purposes
Local IPv4-mapped IPv6 addresses
2022-11-01 10:55:46 +01:00

50 lines
1.4 KiB
Plaintext

include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
----
val ip = "192.168.12.42"
val socket = ServerSocket(ip, 6667)
----
== Compliant Solution
[source,kotlin]
----
val ip = System.getenv("myapplication.ip")
val socket = ServerSocket(ip, 6667)
----
== Exceptions
No issue is reported for the following cases because they are not considered sensitive:
* Loopback addresses 127.0.0.0/8 in CIDR notation (from 127.0.0.0 to 127.255.255.255)
* Broadcast address 255.255.255.255
* Non-routable address 0.0.0.0
* Strings of the form ``++2.5.<number>.<number>++`` as they http://www.oid-info.com/introduction.htm[often match Object Identifiers] (OID)
* Addresses in the ranges 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, reserved for documentation purposes by https://datatracker.ietf.org/doc/html/rfc5737[RFC 5737]
* Addresses in the range 2001:db8::/32, reserved for documentation purposes by https://datatracker.ietf.org/doc/html/rfc3849[RFC 3849]
* Addresses from ::ffff:0:127.0.0.1 to ::ffff:0:127.255.255.255 and from ::ffff:127.0.0.1 to ::ffff:127.255.255.255, which are local IPv4-mapped IPv6 addresses
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[]