Uh oh!
There was an error while loading. Please reload this page.
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? |
jkotas
commented
Jan 11, 2023
noahfalk
commented
Jan 11, 2023
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? 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? |
stephentoub
commented
Jan 11, 2023
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. Fixesdotnet#79749
15542fa to
080ca72Comparejkotas
commented
Jan 12, 2023
FWIW, the APTCA attribute was introduced by dotnet/corefx#17076 . |
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
Jan 12, 2023
Could you please also delete LGTM otherwise. |
noahfalk
commented
Jan 12, 2023
Sure, got HexConverter.cs as well. |
stephentoub
commented
Jan 13, 2023
It'd still be interesting to know why the tests are running in partial trust. @ViktorHofer, do you know? |
jkotas
commented
Jan 13, 2023
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. |
stephentoub
commented
Jan 13, 2023
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.