This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forbid XML external entity resolution in crypto APIs
- Loading branch information
1 parent
a6ab07a
commit 644880b
Showing
6 changed files
with
157 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<Project> | ||
<Import Project="..\Directory.Build.props" /> | ||
<PropertyGroup> | ||
<AssemblyVersion>4.0.3.0</AssemblyVersion> | ||
<AssemblyVersion>4.0.3.1</AssemblyVersion> | ||
<PackageVersion>4.7.1</PackageVersion> | ||
<StrongNameKeyId>Open</StrongNameKeyId> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...ystem.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlSecureResolver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Xml; | ||
|
||
namespace System.Security.Cryptography.Xml | ||
{ | ||
// This type masks out System.Xml.XmlSecureResolver by being in the local namespace. | ||
internal sealed class XmlSecureResolver : XmlResolver | ||
{ | ||
internal XmlSecureResolver(XmlResolver resolver, string securityUrl) | ||
{ | ||
} | ||
|
||
// Simulate .NET Framework's CAS behavior by throwing SecurityException. | ||
// Unlike .NET Framework's implementation, the securityUrl ctor parameter has no effect. | ||
public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn) => | ||
throw new SecurityException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters