rspec/rules/S106/csharp/rule.adoc
Pierre-Loup 770348d041
Avoid OWASP Top 10 security-standard mismatch between metadata and description links (RULEAPI-798) (#3537)
* Add check for security standard mismatch

* Fix security standard mismatches

* Fix Resources/Standards links for secrets rules

* Fix check

* Fix links and update security standard mapping

* Fix maintanability issue

* Apply review suggestions

* Apply suggestions from code review

Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>

* Fix typo

Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>

---------

Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>
2024-01-17 17:20:28 +01:00

78 lines
1.5 KiB
Plaintext

:language_std_outputs: Console
== Why is this an issue?
include::../description.adoc[]
=== Exceptions
The rule doesn't raise an issue for:
* Console Applications
* Calls in methods decorated with `[Conditional ("DEBUG")]`
* Calls included in DEBUG preprocessor branches (``++#if DEBUG++``)
=== Code examples
The following noncompliant code:
[source,csharp,diff-id=1,diff-type=noncompliant]
----
public class MyClass
{
private void DoSomething()
{
// ...
Console.WriteLine("My Message"); // Noncompliant
// ...
}
}
----
Could be replaced by:
[source,csharp,diff-id=1,diff-type=compliant]
----
public class MyClass
{
private readonly ILogger _logger;
// ...
private void DoSomething()
{
// ...
_logger.LogInformation("My Message");
// ...
}
}
----
== Resources
* OWASP - https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/[Top 10 2021 Category A9 - Security Logging and Monitoring Failures]
* OWASP - https://www.owasp.org/www-project-top-ten/2017/A3_2017-Sensitive_Data_Exposure[Top 10 2017 Category A3 - Sensitive Data Exposure]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
=== on 30 Aug 2018, 15:48:10 Nicolas Harraudeau wrote:
Previously RSPEC-2556
See Gendarme DisableDebuggingCodeRule
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]