-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix security transparency issue #80478
Conversation
Why is AsSpan security critical, and why doesn't this impact every other netstandard2.0 library we have that uses AsSpan? Why is this test running in partial trust yet no other tests seem to be? |
Unknown. It isn't an intentional aspect of the tests for this assembly that it should run under partial trust. I assumed that partial trust was simply a test environment that was occasionally used and I had no desire for these tests to generate spurious failures if they were going to be subjected to that.
Perhaps because System.Diagnostics.DiagnosticSource has a lingering APTCA attribute and other libraries don't? runtime/src/libraries/System.Diagnostics.DiagnosticSource/src/AssemblyInfo.netfx.cs Line 6 in 57bfe47
I am unaware of what scenario requires S.D.DS to maintain the APTCA attribute so I am fine to remove it. It sounds like that would align this assembly with general approach used by the rest of our libraries? |
Got it. Yeah, it appears to be the only one left. (We also seem to have one test that sets it, but no other production assemblies.)
That sounds like the right solution to me. |
None of our assemblies support partial trust usage any longer. Removing the APTCA attribute from S.D.DS so that it follows the pattern. Fixes dotnet#79749
15542fa
to
080ca72
Compare
FWIW, the APTCA attribute was introduced by dotnet/corefx#17076 . |
...libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
Show resolved
Hide resolved
Could you please also delete LGTM otherwise. |
Sure, got HexConverter.cs as well. |
It'd still be interesting to know why the tests are running in partial trust. @ViktorHofer, do you know? |
I do not think that the tests are running in partial trust. .NET Framework validates consistency of the SecurityCritical/SecurityTransparent attributes in APTCA assemblies even when the code is running in full trust. It explains why the test is failing. |
Interesting, I didn't know that. Thanks. |
Fixes #79749
[UPDATE]: The new fix is to remove the APTCA attribute and avoid running in partial trust.
[ORIGINAL fix that is no longer being applied]
This is a partial revert of #78729. That change inadvertently introduced a security transparency issue because the newly added AsSpan() call is security critical and can't be called in a security transparent scope.