diff --git a/.github/ISSUE_TEMPLATE/bug_report_nodejs.yml b/.github/ISSUE_TEMPLATE/bug_report_nodejs.yml new file mode 100644 index 0000000..aa26727 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report_nodejs.yml @@ -0,0 +1,59 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +name: Bug - Node.js +description: File a bug report for the NodeJS version of the AntiSSRF library. +title: "[Bug][Nodejs]: " +labels: ["bug", "nodejs"] +assignees: + - leah-restad +type: bug +body: + - type: textarea + attributes: + label: Bug Behavior + description: A concise description of what you're experiencing. + validations: + required: false + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: false + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. In this environment... + 1. With this config... + 1. Run '...' + 1. See error... + validations: + required: false + - type: textarea + attributes: + label: Environment + description: | + examples: + - **OS**: Ubuntu 20.04 + - **Node**: 13.14.0 + - **npm**: 7.6.3 + value: | + - OS: + - Node: + - npm: + render: markdown + validations: + required: false + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + \ No newline at end of file diff --git a/.github/workflows/test-csharp.yml b/.github/workflows/test-dotnet.yml similarity index 78% rename from .github/workflows/test-csharp.yml rename to .github/workflows/test-dotnet.yml index 01fe5f8..c4a711f 100644 --- a/.github/workflows/test-csharp.yml +++ b/.github/workflows/test-dotnet.yml @@ -8,8 +8,8 @@ on: branches: - main paths: - - "csharp/**" - - ".github/workflows/test-csharp.yml" + - "dotnet/**" + - ".github/workflows/test-dotnet.yml" workflow_dispatch: jobs: @@ -32,10 +32,10 @@ jobs: dotnet-version: 8.0.x - name: Restore solution - run: dotnet restore csharp/Microsoft.Security.AntiSSRF.sln + run: dotnet restore dotnet/Microsoft.Security.AntiSSRF.sln - name: Run UnitTests (${{ matrix.framework }}) - run: dotnet test csharp/UnitTests/Microsoft.Security.AntiSSRF.UnitTests.csproj --configuration Release --framework ${{ matrix.framework }} --no-restore + run: dotnet test dotnet/UnitTests/Microsoft.Security.AntiSSRF.UnitTests.csproj --configuration Release --framework ${{ matrix.framework }} --no-restore - name: Run FunctionalTests (${{ matrix.framework }}) - run: dotnet test csharp/FunctionalTests/Microsoft.Security.AntiSSRF.FunctionalTests.csproj --configuration Release --framework ${{ matrix.framework }} --no-restore + run: dotnet test dotnet/FunctionalTests/Microsoft.Security.AntiSSRF.FunctionalTests.csproj --configuration Release --framework ${{ matrix.framework }} --no-restore diff --git a/.github/workflows/update-domains.yml b/.github/workflows/update-domains.yml index cb6395a..3a3af06 100644 --- a/.github/workflows/update-domains.yml +++ b/.github/workflows/update-domains.yml @@ -8,13 +8,13 @@ on: paths: - 'config/Domains.json' - 'nodejs/src/Helpers/Domains.ts' - - 'csharp/src/Helpers/Domains.cs' + - 'dotnet/src/Helpers/Domains.cs' push: branches: [main] paths: - 'config/Domains.json' - 'nodejs/src/Helpers/Domains.ts' - - 'csharp/src/Helpers/Domains.cs' + - 'dotnet/src/Helpers/Domains.cs' workflow_dispatch: # Allow manual triggering jobs: @@ -37,18 +37,18 @@ jobs: run: ./scripts/build-domains-nodejs.sh - name: Build C# version - run: ./scripts/build-domains-cs.sh + run: ./scripts/build-domains-dotnet.sh - name: Verify generated files are up-to-date run: | - if ! git diff --exit-code nodejs/src/Helpers/Domains.ts csharp/src/Helpers/Domains.cs; then + if ! git diff --exit-code nodejs/src/Helpers/Domains.ts dotnet/src/Helpers/Domains.cs; then echo "❌ Generated domain files are out of sync!" echo "The following files need to be regenerated:" - git diff --name-only nodejs/src/Helpers/Domains.ts csharp/src/Helpers/Domains.cs + git diff --name-only nodejs/src/Helpers/Domains.ts dotnet/src/Helpers/Domains.cs echo "" echo "Please run the following commands locally and commit the results:" echo " ./scripts/build-domains-nodejs.sh" - echo " ./scripts/build-domains-cs.sh" + echo " ./scripts/build-domains-dotnet.sh" exit 1 else echo "✅ All generated files are up-to-date" diff --git a/.github/workflows/update-ip-ranges.yml b/.github/workflows/update-ip-ranges.yml index 2448b1f..e7197f0 100644 --- a/.github/workflows/update-ip-ranges.yml +++ b/.github/workflows/update-ip-ranges.yml @@ -10,7 +10,7 @@ on: paths: - 'config/IPAddressRanges.json' - 'nodejs/src/IPAddressRanges.ts' - - 'csharp/src/IPAddressRanges.cs' + - 'dotnet/src/IPAddressRanges.cs' workflow_dispatch: # Allow manual triggering jobs: @@ -33,18 +33,18 @@ jobs: run: ./scripts/build-ip-ranges-nodejs.sh - name: Build C# version - run: ./scripts/build-ip-ranges-cs.sh + run: ./scripts/build-ip-ranges-dotnet.sh - name: Verify generated files are up-to-date run: | - if ! git diff --exit-code nodejs/src/IPAddressRanges.ts csharp/src/IPAddressRanges.cs; then + if ! git diff --exit-code nodejs/src/IPAddressRanges.ts dotnet/src/IPAddressRanges.cs; then echo "❌ Generated IP address range files are out of sync!" echo "The following files need to be regenerated:" - git diff --name-only nodejs/src/IPAddressRanges.ts csharp/src/IPAddressRanges.cs + git diff --name-only nodejs/src/IPAddressRanges.ts dotnet/src/IPAddressRanges.cs echo "" echo "Please run the following commands locally and commit the results:" echo " ./scripts/build-ip-ranges-nodejs.sh" - echo " ./scripts/build-ip-ranges-cs.sh" + echo " ./scripts/build-ip-ranges-dotnet.sh" exit 1 else echo "✅ All generated files are up-to-date" diff --git a/csharp/Directory.Packages.props b/dotnet/Directory.Packages.props similarity index 100% rename from csharp/Directory.Packages.props rename to dotnet/Directory.Packages.props diff --git a/csharp/FunctionalTests/AntiSSRFHandlerTests.cs b/dotnet/FunctionalTests/AntiSSRFHandlerTests.cs similarity index 100% rename from csharp/FunctionalTests/AntiSSRFHandlerTests.cs rename to dotnet/FunctionalTests/AntiSSRFHandlerTests.cs diff --git a/csharp/FunctionalTests/AntiSSRFPolicy.AddXFFHeaderTests.cs b/dotnet/FunctionalTests/AntiSSRFPolicy.AddXFFHeaderTests.cs similarity index 100% rename from csharp/FunctionalTests/AntiSSRFPolicy.AddXFFHeaderTests.cs rename to dotnet/FunctionalTests/AntiSSRFPolicy.AddXFFHeaderTests.cs diff --git a/csharp/FunctionalTests/AntiSSRFPolicy.AddressTests.cs b/dotnet/FunctionalTests/AntiSSRFPolicy.AddressTests.cs similarity index 100% rename from csharp/FunctionalTests/AntiSSRFPolicy.AddressTests.cs rename to dotnet/FunctionalTests/AntiSSRFPolicy.AddressTests.cs diff --git a/AntiSSRFPolicy.HeaderTests.cs b/dotnet/FunctionalTests/AntiSSRFPolicy.HeaderTests.cs old mode 100644 new mode 100755 similarity index 100% rename from AntiSSRFPolicy.HeaderTests.cs rename to dotnet/FunctionalTests/AntiSSRFPolicy.HeaderTests.cs diff --git a/csharp/FunctionalTests/AntiSSRFPolicy.SchemeTests.cs b/dotnet/FunctionalTests/AntiSSRFPolicy.SchemeTests.cs similarity index 100% rename from csharp/FunctionalTests/AntiSSRFPolicy.SchemeTests.cs rename to dotnet/FunctionalTests/AntiSSRFPolicy.SchemeTests.cs diff --git a/csharp/FunctionalTests/InAzureKeyVaultDomainTests.cs b/dotnet/FunctionalTests/InAzureKeyVaultDomainTests.cs similarity index 100% rename from csharp/FunctionalTests/InAzureKeyVaultDomainTests.cs rename to dotnet/FunctionalTests/InAzureKeyVaultDomainTests.cs diff --git a/csharp/FunctionalTests/InAzureStorageDomainTests.cs b/dotnet/FunctionalTests/InAzureStorageDomainTests.cs similarity index 100% rename from csharp/FunctionalTests/InAzureStorageDomainTests.cs rename to dotnet/FunctionalTests/InAzureStorageDomainTests.cs diff --git a/csharp/FunctionalTests/InDomainTests.cs b/dotnet/FunctionalTests/InDomainTests.cs similarity index 100% rename from csharp/FunctionalTests/InDomainTests.cs rename to dotnet/FunctionalTests/InDomainTests.cs diff --git a/csharp/FunctionalTests/Microsoft.Security.AntiSSRF.FunctionalTests.csproj b/dotnet/FunctionalTests/Microsoft.Security.AntiSSRF.FunctionalTests.csproj similarity index 100% rename from csharp/FunctionalTests/Microsoft.Security.AntiSSRF.FunctionalTests.csproj rename to dotnet/FunctionalTests/Microsoft.Security.AntiSSRF.FunctionalTests.csproj diff --git a/csharp/Microsoft.Security.AntiSSRF.sln b/dotnet/Microsoft.Security.AntiSSRF.sln similarity index 98% rename from csharp/Microsoft.Security.AntiSSRF.sln rename to dotnet/Microsoft.Security.AntiSSRF.sln index a1994a1..741a291 100644 --- a/csharp/Microsoft.Security.AntiSSRF.sln +++ b/dotnet/Microsoft.Security.AntiSSRF.sln @@ -1,62 +1,62 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Security.AntiSSRF", "src\Microsoft.Security.AntiSSRF.csproj", "{1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Security.AntiSSRF.UnitTests", "UnitTests\Microsoft.Security.AntiSSRF.UnitTests.csproj", "{0099754E-B40C-4459-860B-B5092231974E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Security.AntiSSRF.FunctionalTests", "FunctionalTests\Microsoft.Security.AntiSSRF.FunctionalTests.csproj", "{1091AE9C-086A-4CE0-A54D-52A762C8E296}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x64.ActiveCfg = Debug|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x64.Build.0 = Debug|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x86.ActiveCfg = Debug|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x86.Build.0 = Debug|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|Any CPU.Build.0 = Release|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x64.ActiveCfg = Release|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x64.Build.0 = Release|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x86.ActiveCfg = Release|Any CPU - {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x86.Build.0 = Release|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Debug|x64.ActiveCfg = Debug|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Debug|x64.Build.0 = Debug|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Debug|x86.ActiveCfg = Debug|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Debug|x86.Build.0 = Debug|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Release|Any CPU.Build.0 = Release|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Release|x64.ActiveCfg = Release|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Release|x64.Build.0 = Release|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Release|x86.ActiveCfg = Release|Any CPU - {0099754E-B40C-4459-860B-B5092231974E}.Release|x86.Build.0 = Release|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x64.ActiveCfg = Debug|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x64.Build.0 = Debug|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x86.ActiveCfg = Debug|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x86.Build.0 = Debug|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|Any CPU.Build.0 = Release|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x64.ActiveCfg = Release|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x64.Build.0 = Release|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x86.ActiveCfg = Release|Any CPU - {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Security.AntiSSRF", "src\Microsoft.Security.AntiSSRF.csproj", "{1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Security.AntiSSRF.UnitTests", "UnitTests\Microsoft.Security.AntiSSRF.UnitTests.csproj", "{0099754E-B40C-4459-860B-B5092231974E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Security.AntiSSRF.FunctionalTests", "FunctionalTests\Microsoft.Security.AntiSSRF.FunctionalTests.csproj", "{1091AE9C-086A-4CE0-A54D-52A762C8E296}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x64.ActiveCfg = Debug|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x64.Build.0 = Debug|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x86.ActiveCfg = Debug|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Debug|x86.Build.0 = Debug|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|Any CPU.Build.0 = Release|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x64.ActiveCfg = Release|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x64.Build.0 = Release|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x86.ActiveCfg = Release|Any CPU + {1E54F5AE-BEE8-4E3F-B0D0-ECC5172A911B}.Release|x86.Build.0 = Release|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Debug|x64.ActiveCfg = Debug|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Debug|x64.Build.0 = Debug|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Debug|x86.ActiveCfg = Debug|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Debug|x86.Build.0 = Debug|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Release|Any CPU.Build.0 = Release|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Release|x64.ActiveCfg = Release|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Release|x64.Build.0 = Release|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Release|x86.ActiveCfg = Release|Any CPU + {0099754E-B40C-4459-860B-B5092231974E}.Release|x86.Build.0 = Release|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x64.ActiveCfg = Debug|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x64.Build.0 = Debug|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x86.ActiveCfg = Debug|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Debug|x86.Build.0 = Debug|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|Any CPU.Build.0 = Release|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x64.ActiveCfg = Release|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x64.Build.0 = Release|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x86.ActiveCfg = Release|Any CPU + {1091AE9C-086A-4CE0-A54D-52A762C8E296}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/UnitTests/CIDRBlockTests.cs b/dotnet/UnitTests/CIDRBlockTests.cs similarity index 100% rename from csharp/UnitTests/CIDRBlockTests.cs rename to dotnet/UnitTests/CIDRBlockTests.cs diff --git a/csharp/UnitTests/Microsoft.Security.AntiSSRF.UnitTests.csproj b/dotnet/UnitTests/Microsoft.Security.AntiSSRF.UnitTests.csproj similarity index 100% rename from csharp/UnitTests/Microsoft.Security.AntiSSRF.UnitTests.csproj rename to dotnet/UnitTests/Microsoft.Security.AntiSSRF.UnitTests.csproj diff --git a/csharp/src/AntiSSRFException.cs b/dotnet/src/AntiSSRFException.cs similarity index 100% rename from csharp/src/AntiSSRFException.cs rename to dotnet/src/AntiSSRFException.cs diff --git a/csharp/src/AntiSSRFHandler.cs b/dotnet/src/AntiSSRFHandler.cs similarity index 100% rename from csharp/src/AntiSSRFHandler.cs rename to dotnet/src/AntiSSRFHandler.cs diff --git a/csharp/src/AntiSSRFPolicy.cs b/dotnet/src/AntiSSRFPolicy.cs similarity index 100% rename from csharp/src/AntiSSRFPolicy.cs rename to dotnet/src/AntiSSRFPolicy.cs diff --git a/csharp/src/Helpers/CIDRBlock.cs b/dotnet/src/Helpers/CIDRBlock.cs similarity index 100% rename from csharp/src/Helpers/CIDRBlock.cs rename to dotnet/src/Helpers/CIDRBlock.cs diff --git a/csharp/src/Helpers/Domains.cs b/dotnet/src/Helpers/Domains.cs similarity index 96% rename from csharp/src/Helpers/Domains.cs rename to dotnet/src/Helpers/Domains.cs index e08aa59..d805f1f 100644 --- a/csharp/src/Helpers/Domains.cs +++ b/dotnet/src/Helpers/Domains.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. // This file is auto-generated from config/Domains.json -// Do not edit this file directly. Run build-domains-cs.sh to regenerate. +// Do not edit this file directly. namespace Microsoft.Security.AntiSSRF { diff --git a/csharp/src/Helpers/InnerHandler.NetCore.cs b/dotnet/src/Helpers/InnerHandler.NetCore.cs similarity index 100% rename from csharp/src/Helpers/InnerHandler.NetCore.cs rename to dotnet/src/Helpers/InnerHandler.NetCore.cs diff --git a/csharp/src/Helpers/InnerHandler.NetStandard.cs b/dotnet/src/Helpers/InnerHandler.NetStandard.cs similarity index 100% rename from csharp/src/Helpers/InnerHandler.NetStandard.cs rename to dotnet/src/Helpers/InnerHandler.NetStandard.cs diff --git a/csharp/src/Helpers/RedirectHandler.cs b/dotnet/src/Helpers/RedirectHandler.cs similarity index 100% rename from csharp/src/Helpers/RedirectHandler.cs rename to dotnet/src/Helpers/RedirectHandler.cs diff --git a/csharp/src/IPAddressRanges.cs b/dotnet/src/IPAddressRanges.cs similarity index 100% rename from csharp/src/IPAddressRanges.cs rename to dotnet/src/IPAddressRanges.cs diff --git a/csharp/src/Microsoft.Security.AntiSSRF.csproj b/dotnet/src/Microsoft.Security.AntiSSRF.csproj similarity index 89% rename from csharp/src/Microsoft.Security.AntiSSRF.csproj rename to dotnet/src/Microsoft.Security.AntiSSRF.csproj index f4e360f..1717297 100644 --- a/csharp/src/Microsoft.Security.AntiSSRF.csproj +++ b/dotnet/src/Microsoft.Security.AntiSSRF.csproj @@ -1,84 +1,76 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <!-- ASSEMBLY IDENTITY --> - <PropertyGroup> - <RootNamespace>Microsoft.Security.AntiSSRF</RootNamespace> - <AssemblyName>$(RootNamespace)</AssemblyName> - </PropertyGroup> - - <!-- PACKAGE METADATA --> - <PropertyGroup> - <PackageId>Microsoft.Security.AntiSSRF</PackageId> - <Authors>Microsoft</Authors> - <Copyright>© Microsoft Corporation. All rights reserved.</Copyright> - <Description>Microsoft AntiSSRF is a security library that helps .NET developers protect their applications from Server-Side Request Forgery (SSRF) attacks. The library provides configurable policies to validate and filter outbound HTTP requests, preventing attackers from exploiting server-side functionality to access internal resources or perform unauthorized network requests. Features include IP address validation, URL filtering, and custom policy configuration.</Description> - <PackageTags>security ssrf anti-ssrf antissrf http request protection vulnerability filtering validation web-security</PackageTags> - </PropertyGroup> - - <!-- PACKAGE LICENSING --> - <PropertyGroup> - <PackageLicenseExpression>MIT</PackageLicenseExpression> - <RequireLicenseAcceptance>true</RequireLicenseAcceptance> - </PropertyGroup> - - <!-- PACKAGE RESOURCES --> - <PropertyGroup> - <PackageProjectUrl>https://github.com/Microsoft/AntiSSRF</PackageProjectUrl> - <RepositoryUrl>https://github.com/Microsoft/AntiSSRF</RepositoryUrl> - <RepositoryType>git</RepositoryType> - <PackageIcon>microsoft.png</PackageIcon> - <PackageReadmeFile>README.md</PackageReadmeFile> - </PropertyGroup> - - <!-- LANGUAGE DETAILS --> - <PropertyGroup> - <TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks> - <LangVersion>Latest</LangVersion> - <Nullable>enable</Nullable> - </PropertyGroup> - - <!-- ASSEMBLY ATTRIBUTES --> - <ItemGroup> - <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo"> - <_Parameter1>Microsoft.Security.AntiSSRF.UnitTests</_Parameter1> - </AssemblyAttribute> - </ItemGroup> - - <!-- VERSION --> - <PropertyGroup> - <Major Condition="'$(Major)'==''">1</Major> - <Minor Condition="'$(Minor)'==''">0</Minor> - <Patch Condition="'$(Patch)'==''">0</Patch> - <VersionPrefix>$(Major).$(Minor).$(Patch)</VersionPrefix> - <!-- If VersionSuffix is blank => PackageVersion is just VersionPrefix --> - <PackageVersion Condition="'$(VersionSuffix)'=='' or '$(VersionSuffix)'==' '">$(VersionPrefix)</PackageVersion> - <PackageVersion Condition="'$(VersionSuffix)'!='' and '$(VersionSuffix)'!=' '">$(VersionPrefix)-$(VersionSuffix)</PackageVersion> - <!-- Assembly identity (stable) --> - <AssemblyVersion>$(Major).$(Minor).0.0</AssemblyVersion> - <!-- Windows file version (precise) --> - <FileVersion>$(Major).$(Minor).$(Patch).0</FileVersion> - <!-- What 'dotnet \-\-info', logs, and many tools show --> - <InformationalVersion>$(PackageVersion)</InformationalVersion> - </PropertyGroup> - - <!-- STRONG-NAME SIGNING --> - <PropertyGroup Condition="$(CDP_BUILD_TYPE)==Official"> - <SignAssembly>true</SignAssembly> - <DelaySign>true</DelaySign> - <KeyFile>..\.config\35MSSharedLib1024.snk</KeyFile> - <AssemblyOriginatorKeyFile>..\.config\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile> - </PropertyGroup> - - <!-- FRAMEWORK SUPPORT --> - <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> - <PackageReference Include="System.Memory" /> - <PackageReference Include="System.Threading.Tasks.Extensions" /> - </ItemGroup> - - <!-- PACKAGE ASSETS --> - <ItemGroup> - <None Include="microsoft.png" Pack="true" PackagePath="" /> - <None Include="README.md" Pack="true" PackagePath="\" /> - </ItemGroup> - +<Project Sdk="Microsoft.NET.Sdk"> + + <!-- ASSEMBLY IDENTITY --> + <PropertyGroup> + <RootNamespace>Microsoft.Security.AntiSSRF</RootNamespace> + <AssemblyName>$(RootNamespace)</AssemblyName> + </PropertyGroup> + + <!-- PACKAGE METADATA --> + <PropertyGroup> + <PackageId>Microsoft.Security.AntiSSRF</PackageId> + <Authors>Microsoft</Authors> + <Copyright>© Microsoft Corporation. All rights reserved.</Copyright> + <Description>Microsoft AntiSSRF is a security library that helps .NET developers protect their applications from Server-Side Request Forgery (SSRF) attacks. The library provides configurable policies to validate and filter outbound HTTP requests, preventing attackers from exploiting server-side functionality to access internal resources or perform unauthorized network requests. Features include IP address validation, URL filtering, and custom policy configuration.</Description> + <PackageTags>security ssrf anti-ssrf antissrf http request protection vulnerability filtering validation web-security</PackageTags> + </PropertyGroup> + + <!-- PACKAGE LICENSING --> + <PropertyGroup> + <PackageLicenseExpression>MIT</PackageLicenseExpression> + <RequireLicenseAcceptance>true</RequireLicenseAcceptance> + </PropertyGroup> + + <!-- PACKAGE RESOURCES --> + <PropertyGroup> + <PackageProjectUrl>https://github.com/Microsoft/AntiSSRF</PackageProjectUrl> + <RepositoryUrl>https://github.com/Microsoft/AntiSSRF</RepositoryUrl> + <RepositoryType>git</RepositoryType> + <PackageIcon>microsoft.png</PackageIcon> + <PackageReadmeFile>README.md</PackageReadmeFile> + </PropertyGroup> + + <!-- LANGUAGE DETAILS --> + <PropertyGroup> + <TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks> + <LangVersion>Latest</LangVersion> + <Nullable>enable</Nullable> + </PropertyGroup> + + <!-- ASSEMBLY ATTRIBUTES --> + <ItemGroup> + <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo"> + <_Parameter1>Microsoft.Security.AntiSSRF.UnitTests</_Parameter1> + </AssemblyAttribute> + </ItemGroup> + + <!-- VERSION --> + <PropertyGroup> + <Major Condition="'$(Major)'==''">1</Major> + <Minor Condition="'$(Minor)'==''">0</Minor> + <Patch Condition="'$(Patch)'==''">0</Patch> + <VersionPrefix>$(Major).$(Minor).$(Patch)</VersionPrefix> + <!-- If VersionSuffix is blank => PackageVersion is just VersionPrefix --> + <PackageVersion Condition="'$(VersionSuffix)'=='' or '$(VersionSuffix)'==' '">$(VersionPrefix)</PackageVersion> + <PackageVersion Condition="'$(VersionSuffix)'!='' and '$(VersionSuffix)'!=' '">$(VersionPrefix)-$(VersionSuffix)</PackageVersion> + <!-- Assembly identity (stable) --> + <AssemblyVersion>$(Major).$(Minor).0.0</AssemblyVersion> + <!-- Windows file version (precise) --> + <FileVersion>$(Major).$(Minor).$(Patch).0</FileVersion> + <!-- What 'dotnet \-\-info', logs, and many tools show --> + <InformationalVersion>$(PackageVersion)</InformationalVersion> + </PropertyGroup> + + <!-- FRAMEWORK SUPPORT --> + <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> + <PackageReference Include="System.Memory" /> + <PackageReference Include="System.Threading.Tasks.Extensions" /> + </ItemGroup> + + <!-- PACKAGE ASSETS --> + <ItemGroup> + <None Include="microsoft.png" Pack="true" PackagePath="" /> + <None Include="README.md" Pack="true" PackagePath="\" /> + </ItemGroup> + </Project> \ No newline at end of file diff --git a/csharp/src/README.md b/dotnet/src/README.md similarity index 100% rename from csharp/src/README.md rename to dotnet/src/README.md diff --git a/csharp/src/UriValidator.cs b/dotnet/src/UriValidator.cs similarity index 100% rename from csharp/src/UriValidator.cs rename to dotnet/src/UriValidator.cs diff --git a/csharp/src/microsoft.png b/dotnet/src/microsoft.png similarity index 100% rename from csharp/src/microsoft.png rename to dotnet/src/microsoft.png diff --git a/nodejs/src/Helpers/Domains.ts b/nodejs/src/Helpers/Domains.ts index 18d1830..afe8523 100644 --- a/nodejs/src/Helpers/Domains.ts +++ b/nodejs/src/Helpers/Domains.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. // This file is auto-generated from config/Domains.json -// Do not edit this file directly. Run build-domains-nodejs.sh to regenerate. +// Do not edit this file directly. /** * Well-known Azure service domains for internal use. diff --git a/scripts/build-domains-cs.sh b/scripts/build-domains-dotnet.sh similarity index 94% rename from scripts/build-domains-cs.sh rename to scripts/build-domains-dotnet.sh index c9cf052..7e5d911 100755 --- a/scripts/build-domains-cs.sh +++ b/scripts/build-domains-dotnet.sh @@ -9,7 +9,7 @@ set -e # Path to the domains configuration file DOMAINS_JSON="config/Domains.json" -OUTPUT_FILE="csharp/src/Helpers/Domains.cs" +OUTPUT_FILE="dotnet/src/Helpers/Domains.cs" # Ensure the output directory exists mkdir -p "$(dirname "$OUTPUT_FILE")" @@ -36,7 +36,7 @@ cat > "$OUTPUT_FILE" << 'EOF' // Licensed under the MIT License. // This file is auto-generated from config/Domains.json -// Do not edit this file directly. Run build-domains-cs.sh to regenerate. +// Do not edit this file directly. namespace Microsoft.Security.AntiSSRF { diff --git a/scripts/build-domains-nodejs.sh b/scripts/build-domains-nodejs.sh index 1f6bab3..5411463 100755 --- a/scripts/build-domains-nodejs.sh +++ b/scripts/build-domains-nodejs.sh @@ -36,7 +36,7 @@ cat > "$OUTPUT_FILE" << 'EOF' // Licensed under the MIT License. // This file is auto-generated from config/Domains.json -// Do not edit this file directly. Run build-domains-nodejs.sh to regenerate. +// Do not edit this file directly. /** * Well-known Azure service domains for internal use. diff --git a/scripts/build-ip-ranges-cs.sh b/scripts/build-ip-ranges-dotnet.sh similarity index 97% rename from scripts/build-ip-ranges-cs.sh rename to scripts/build-ip-ranges-dotnet.sh index 77a8364..87b948c 100755 --- a/scripts/build-ip-ranges-cs.sh +++ b/scripts/build-ip-ranges-dotnet.sh @@ -11,7 +11,7 @@ set -e # Get the directory where this script is located SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" JSON_FILE="$SCRIPT_DIR/../config/IPAddressRanges.json" -CS_FILE="$SCRIPT_DIR/../csharp/src/IPAddressRanges.cs" +CS_FILE="$SCRIPT_DIR/../dotnet/src/IPAddressRanges.cs" # Check if jq is available if ! command -v jq &> /dev/null; then