Skip to content

Respond to IL2026 warnings in DataProtection originating from EncryptedXml #47695

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

Closed
eerhardt opened this issue Apr 13, 2023 · 2 comments · Fixed by #48082
Closed

Respond to IL2026 warnings in DataProtection originating from EncryptedXml #47695

eerhardt opened this issue Apr 13, 2023 · 2 comments · Fixed by #48082
Assignees
Labels
area-dataprotection Includes: DataProtection
Milestone

Comments

@eerhardt
Copy link
Member

With dotnet/runtime#84468, EncryptedXml is now marked as RequiresUnreferencedCode. This is because

The algorithm implementations referenced in the XML payload might be removed. Ensure the required algorithm implementations are preserved in your application.

From discussion in #47410 (comment), we should:

  1. Figure out the list of commonly used crypto algorithms used by DataProtection, and add [DynamicDependency] attributes for them.
  2. We also add some trimming/aot tests to ensure DataProtection works correctly when trimmed.
  3. DataProtection then suppresses the warnings coming from System.Security.Cryptography.Xml
@eerhardt eerhardt added the area-dataprotection Includes: DataProtection label Apr 13, 2023
@eerhardt eerhardt added this to the 8.0-preview5 milestone Apr 13, 2023
eerhardt added a commit that referenced this issue Apr 13, 2023
dotnet-maestro bot added a commit that referenced this issue Apr 13, 2023
[main] Update dependencies from dotnet/runtime


 - Suppress warnings in DataProtection

Tracked with #47695

 - Update docker image used to bulid RPM installers

 - add util-linux for useradd

 - also add shadow-utils

 - add awk

 - Add more dependencies. Remove scl enable

 - Add missing dependencies

 - Cleanup dependencies

 - More cleanup
@blowdart
Copy link
Contributor

@eerhardt
Copy link
Member Author

Note: when doing this work, we should remove the RequiresUnreferencedCode attribute that was added to AddAuthentication() in #47663.

[RequiresUnreferencedCode("Authentication middleware does not currently support native AOT.", Url = "https://aka.ms/aspnet/nativeaot")]
public static AuthenticationBuilder AddAuthentication(this IServiceCollection services)

@eerhardt eerhardt self-assigned this Apr 28, 2023
eerhardt added a commit to eerhardt/aspnetcore that referenced this issue May 4, 2023
eerhardt added a commit that referenced this issue May 13, 2023
* Add a DynamicDependency to ensure Aes decryption works in EncryptedXmlDecryptor
* Suppress the warnings from EncryptedXml
* Add trimming tests to ensure these scenarios work correctly.
* Remove the RequiresUnreferencedCode attribute on AddAuthentication, since this is the only thing in that method that has warnings.

Fix #47695

* Fix parallel build to not copy files to the same destination
@ghost ghost locked as resolved and limited conversation to collaborators Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-dataprotection Includes: DataProtection
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants