
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
76 lines
1.9 KiB
Plaintext
76 lines
1.9 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Transparency attributes, ``++SecurityCriticalAttribute++`` and ``++SecuritySafeCriticalAttribute++`` are used to identify code that performs security-critical operations. The second one indicates that it is safe to call this code from transparent, while the first one does not. Since the transparency attributes of code elements with larger scope take precedence over transparency attributes of code elements that are contained in the first element a class, for instance, with a ``++SecurityCriticalAttribute++`` can not contain a method with a ``++SecuritySafeCriticalAttribute++``.
|
|
|
|
|
|
This rule raises an issue when a member is marked with a ``++System.Security++`` security attribute that has a different transparency than the security attribute of a container of the member.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,csharp]
|
|
----
|
|
using System;
|
|
using System.Security;
|
|
|
|
namespace MyLibrary
|
|
{
|
|
|
|
[SecurityCritical]
|
|
public class Foo
|
|
{
|
|
[SecuritySafeCritical] // Noncompliant
|
|
public void Bar()
|
|
{
|
|
}
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,csharp]
|
|
----
|
|
using System;
|
|
using System.Security;
|
|
|
|
namespace MyLibrary
|
|
{
|
|
|
|
[SecurityCritical]
|
|
public class Foo
|
|
{
|
|
public void Bar()
|
|
{
|
|
}
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
== Resources
|
|
|
|
* https://owasp.org/Top10/A05_2021-Security_Misconfiguration/[OWASP Top 10 2021 Category A5] - Security Misconfiguration
|
|
* https://owasp.org/www-project-top-ten/2017/A6_2017-Security_Misconfiguration[OWASP Top 10 2017 Category A6] - Security Misconfiguration
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Change or remove this attribute to be consistent with its container
|
|
|
|
|
|
=== Highlighting
|
|
|
|
primary: Attribute declaration of member
|
|
|
|
secondary: Attribute declaration of container
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|