From 164f9dd2c597b4284309b5371d51f24838de62da Mon Sep 17 00:00:00 2001 From: Veikko Eeva Date: Sun, 19 Jul 2026 13:20:33 +0300 Subject: [PATCH] Add CIMD and grant-aware token issuance - Add Client ID Metadata Document support (draft-02). - Bump dependencies and pinned GitHub Actions. --- .github/workflows/codeql-analysis.yml | 8 +- .github/workflows/main.yml | 33 +- Directory.Packages.props | 20 +- README.md | 2 +- ...producer-selection-and-openid-anchoring.md | 69 + documents/AuthorizationServerDesign.md | 39 + global.json | 2 +- src/Verifiable.Acdc/packages.lock.json | 12 +- src/Verifiable.Apdu/packages.lock.json | 12 +- .../packages.lock.json | 12 +- src/Verifiable.Cbor/packages.lock.json | 18 +- src/Verifiable.Cesr/packages.lock.json | 12 +- .../OutboundFetch/HttpCacheFreshness.cs | 313 +++ src/Verifiable.Core/packages.lock.json | 12 +- .../packages.lock.json | 12 +- src/Verifiable.DidComm/packages.lock.json | 12 +- src/Verifiable.DidWebs/packages.lock.json | 12 +- src/Verifiable.Fido2/packages.lock.json | 12 +- src/Verifiable.Foundation/packages.lock.json | 12 +- src/Verifiable.JCose/packages.lock.json | 12 +- src/Verifiable.Json/packages.lock.json | 12 +- src/Verifiable.JsonPointer/packages.lock.json | 12 +- src/Verifiable.Keri/packages.lock.json | 12 +- src/Verifiable.Microsoft/packages.lock.json | 12 +- src/Verifiable.NSec/packages.lock.json | 12 +- .../AcrAmrClaimContributor.cs | 49 +- .../AuthCode/AuthCodeClient.cs | 82 +- .../AuthCode/AuthCodeEndpoints.cs | 1029 ++++++---- .../AuthCode/AuthCodeFlowHandlers.cs | 411 +++- .../States/ServerRefreshTokenIssuedState.cs | 20 + ...thorizationServerMetadataParameterNames.cs | 16 + .../Client/AuthorizationServerMetadata.cs | 10 + src/Verifiable.OAuth/Client/ClientMetadata.cs | 25 +- .../Client/ClientRegistration.cs | 9 + .../ClientTokenEndpointAuthentication.cs | 95 + .../OutgoingFormFieldsClientAuthExtensions.cs | 7 +- .../OutgoingHeadersClientAuthExtensions.cs | 117 +- src/Verifiable.OAuth/ClientIdentifierUrl.cs | 211 ++ .../Diagnostics/OAuthEventNames.cs | 25 + .../IdJag/IdJagFlowHandlers.cs | 49 +- src/Verifiable.OAuth/IssuanceContext.cs | 26 + .../JwsAccessTokenValidationFailureReason.cs | 35 +- .../JwsAccessTokenValidator.cs | 231 ++- src/Verifiable.OAuth/JwtTypeEnforcement.cs | 33 + .../OAuthRequestParameterNames.cs | 28 + .../Oidc/UserInfoEndpoints.cs | 15 + src/Verifiable.OAuth/Oidc10IdTokenClaims.cs | 91 + .../Oidc10IdTokenValidationResult.cs | 47 + .../Oidc10IdTokenValidator.cs | 225 +++ src/Verifiable.OAuth/OidcDiscoveryDocument.cs | 9 + .../ProtectedResource/BearerTokenChallenge.cs | 501 +++++ .../BearerTokenChallengeParameters.cs | 35 + .../ProtectedResourceChallenge.cs | 31 + .../Server/AuthorizationRequestDecision.cs | 40 + .../Server/AuthorizationServerDelegates.cs | 28 +- .../Server/BearerTokenValidation.cs | 24 +- src/Verifiable.OAuth/Server/ClientRecord.cs | 68 + .../Server/ExchangeContextServerExtensions.cs | 21 + .../Server/IssuerIdentifierValidation.cs | 34 + .../Server/Metadata/MetadataEndpoints.cs | 15 + .../Server/Oidc10IdTokenProducer.cs | 34 +- .../Pipeline/AuthorizationServerHandlers.cs | 9 + .../ClientIdMetadataDocumentReader.cs | 469 +++++ ...ClientIdMetadataDocumentResolverOptions.cs | 99 + .../Pipeline/ClientIdMetadataDocuments.cs | 420 ++++ .../ClientIdMetadataMaterialization.cs | 154 ++ .../Pipeline/ClientIdMetadataResolution.cs | 90 + .../Server/Pipeline/DefaultIssuerResolver.cs | 31 +- .../PrivateKeyJwtClientAuthentication.cs | 772 ++++++++ .../Server/RedirectUriMatching.cs | 49 + .../Registration/RegistrationEndpoints.cs | 12 +- .../Server/Rfc9068AccessTokenProducer.cs | 8 +- .../Server/TokenProducerSet.cs | 7 +- .../Server/WellKnownCapabilityIdentifiers.cs | 11 + .../SignedJwtValidationOutcome.cs | 97 + src/Verifiable.OAuth/TokenProducer.cs | 22 +- .../Validation/ValidationChecks.cs | 49 +- .../Validation/ValidationClaimIds.cs | 10 + .../Validation/ValidationProfiles.cs | 13 +- src/Verifiable.OAuth/packages.lock.json | 12 +- src/Verifiable.Server/EndpointServer.cs | 16 +- .../MaterializeRegistrationDelegate.cs | 70 + src/Verifiable.Server/ServerIntegration.cs | 7 + src/Verifiable.Server/packages.lock.json | 12 +- src/Verifiable.Tpm/packages.lock.json | 12 +- src/Verifiable.Vcalm/packages.lock.json | 12 +- src/Verifiable.WebFinger/packages.lock.json | 12 +- src/Verifiable/packages.lock.json | 471 ++--- test/Verifiable.Benchmarks/packages.lock.json | 12 +- .../Acdc/AcdcAggregateDisclosureFlowTests.cs | 4 +- .../Acdc/AcdcDi2iChainFlowTests.cs | 2 +- .../Acdc/AcdcDisclosureFlowTests.cs | 6 +- .../Acdc/AcdcEdgeChainFlowTests.cs | 2 +- .../Acdc/AcdcGraduatedDisclosureFlowTests.cs | 4 +- .../Acdc/AcdcIpexExchangeFlowTests.cs | 4 +- .../Acdc/AcdcRegistryFlowTests.cs | 4 +- .../Core/HttpCacheFreshnessTests.cs | 348 ++++ .../DidCommHttpTransportRealWireFlowTests.cs | 7 +- .../DidComm/DidCommRoutingForwardTests.cs | 15 +- .../DidComm/DidCommWebSocketTransportTests.cs | 4 +- .../WebAuthnRpHttpCeremonyAlwaysUvTests.cs | 2 +- ...RpHttpCeremonyCredentialManagementTests.cs | 2 +- ...tpCeremonyRequiredUserVerificationTests.cs | 4 +- .../Fido2/WebAuthnRpHttpCeremonyResetTests.cs | 2 +- .../Fido2/WebAuthnRpHttpCeremonyTests.cs | 12 +- .../AccessTokenIdentityMinimizationTests.cs | 314 +++ .../OAuth/AccessTokenTypeValidationTests.cs | 438 ++++ .../OAuth/AgenticFlowCapstoneTests.cs | 1764 +++++++++++++++++ ...AllCapabilitiesAuthorizationServerTests.cs | 24 +- .../AuthCodeClientAuthenticationTests.cs | 388 ++++ .../OAuth/AuthCodeFlowTests.cs | 63 + .../OAuth/AuthCodeParPkceRealWireFlowTests.cs | 18 +- .../OAuth/AuthorizationServerFeatureTests.cs | 4 +- .../AuthorizationServerHttpApplication.cs | 31 +- .../OAuth/AzpMultiAudienceScenarioTests.cs | 16 +- .../OAuth/BearerTokenChallengeTests.cs | 429 ++++ .../OAuth/ClientCredentialsGrantTests.cs | 187 +- ...tIdMetadataDocumentAdversarialFlowTests.cs | 1268 ++++++++++++ ...lientIdMetadataDocumentCachingFlowTests.cs | 342 ++++ ...entIdMetadataDocumentCrossWireFlowTests.cs | 929 +++++++++ .../ClientIdMetadataDocumentReaderTests.cs | 324 +++ ...ClientIdMetadataDocumentsResolvingTests.cs | 595 ++++++ .../OAuth/ClientIdentifierUrlTests.cs | 337 ++++ .../ContributorChainRegressionTests.cs | 1 + .../Contributors/ContributorTestFixtures.cs | 6 + .../OidcStandardClaimsContributorTests.cs | 39 + .../SubjectIdentifierContributorTests.cs | 1 + .../OAuth/CredentialDiVpProofTests.cs | 31 +- .../OAuth/DiscoveryEndpointTests.cs | 149 ++ .../OAuth/DpopBoundRefreshTests.cs | 202 ++ .../OAuth/DpopEndToEndTests.cs | 8 +- .../FederatedBackChannelLogoutHttpTests.cs | 13 +- .../OAuth/GlobalLogoutCaepEmitHttpTests.cs | 2 +- .../OAuth/GlobalLogoutDualChannelHttpTests.cs | 8 +- .../OAuth/GuardedHttpClientTransportTests.cs | 30 +- .../OAuth/HostedAuthorizationServer.cs | 8 +- .../OAuth/HttpClientTransport.cs | 37 + .../OAuth/JwtBearerGrantTests.cs | 347 +++- .../OAuth/OAuthAttackMitigationTests.cs | 145 ++ .../Oid4VciPreAuthorizedCodeGrantTests.cs | 116 +- .../OAuth/Oid4VpFlowIntegrationTests.cs | 6 +- .../Oid4VpX509RequestUriPostFlowTests.cs | 4 +- ...Oidc10IdTokenNonceAudienceScenarioTests.cs | 346 ++++ .../PrivateKeyJwtClientAuthenticationTests.cs | 525 +++++ .../OAuth/RedirectUriMatchingTests.cs | 175 ++ ...shConfidentialClientAuthenticationTests.cs | 457 +++++ .../OAuth/RefreshedIdTokenAuthContextTests.cs | 254 +++ .../OAuth/RefreshedIdTokenParityTests.cs | 332 ++++ .../OAuth/ResolveIssuerDelegateTests.cs | 237 +++ .../OAuth/ResourceServerChallengeTests.cs | 334 ++++ .../OAuth/ResourceServerEndToEndTests.cs | 12 +- .../OAuth/ResourceServerHttpApplication.cs | 381 +++- test/Verifiable.Tests/OAuth/TestHostShell.cs | 388 +++- .../OAuth/TestResourceServerShell.cs | 262 ++- .../OAuth/TokenExchangeGrantTests.cs | 277 ++- .../OAuth/TransportTraceMetadataTests.cs | 244 +++ .../UnmetAuthenticationRequirementsTests.cs | 31 + .../OAuth/UserInfoEndpointTests.cs | 75 + .../Resolver/DidResolutionHttpApplication.cs | 19 +- .../Resolver/DidResolutionHttpBindingTests.cs | 72 +- .../Resolver/WebVhCrossWireFlowTests.cs | 109 +- .../SecurityEvents/SsfHttpFlowTests.cs | 4 +- ...tatusListRevocationDualChannelHttpTests.cs | 4 +- .../StatusListAggregationHttpFlowTests.cs | 2 +- .../StatusListTokenHttpFlowTests.cs | 4 +- .../TestInfrastructure/AuthCodeFlowDriver.cs | 294 +++ .../TestInfrastructure/CimdServiceHost.cs | 277 +++ .../DidCommWebSocketInbox.cs | 53 +- .../GuardedHttpClientTransport.cs | 37 + .../TestInfrastructure/JwtPayloadDecoding.cs | 32 + .../TestInfrastructure/LoopbackTls.cs | 192 ++ .../TestInfrastructure/MinimalHttpHost.cs | 104 +- .../TestInfrastructure/StaticContentHost.cs | 86 +- .../TestInfrastructure/TraceTreeAssertions.cs | 408 ++++ .../TestInfrastructure/TraceTreeCapture.cs | 122 ++ .../Vcalm/VcalmConformanceBridgeTests.cs | 12 +- .../Vcalm/VcalmConformanceHttpApplication.cs | 23 +- .../WebFinger/WebFingerCrossWireFlowTests.cs | 26 +- .../WebFinger/WebFingerHttpApplication.cs | 44 +- test/Verifiable.Tests/packages.lock.json | 103 +- 180 files changed, 21044 insertions(+), 1739 deletions(-) create mode 100644 documents/ADRs/token-producer-selection-and-openid-anchoring.md create mode 100644 src/Verifiable.Core/OutboundFetch/HttpCacheFreshness.cs create mode 100644 src/Verifiable.OAuth/Client/ClientTokenEndpointAuthentication.cs create mode 100644 src/Verifiable.OAuth/ClientIdentifierUrl.cs create mode 100644 src/Verifiable.OAuth/JwtTypeEnforcement.cs create mode 100644 src/Verifiable.OAuth/Oidc10IdTokenClaims.cs create mode 100644 src/Verifiable.OAuth/Oidc10IdTokenValidationResult.cs create mode 100644 src/Verifiable.OAuth/Oidc10IdTokenValidator.cs create mode 100644 src/Verifiable.OAuth/ProtectedResource/BearerTokenChallenge.cs create mode 100644 src/Verifiable.OAuth/ProtectedResource/BearerTokenChallengeParameters.cs create mode 100644 src/Verifiable.OAuth/Server/IssuerIdentifierValidation.cs create mode 100644 src/Verifiable.OAuth/Server/Pipeline/ClientIdMetadataDocumentReader.cs create mode 100644 src/Verifiable.OAuth/Server/Pipeline/ClientIdMetadataDocumentResolverOptions.cs create mode 100644 src/Verifiable.OAuth/Server/Pipeline/ClientIdMetadataDocuments.cs create mode 100644 src/Verifiable.OAuth/Server/Pipeline/ClientIdMetadataMaterialization.cs create mode 100644 src/Verifiable.OAuth/Server/Pipeline/ClientIdMetadataResolution.cs create mode 100644 src/Verifiable.OAuth/Server/PrivateKeyJwtClientAuthentication.cs create mode 100644 src/Verifiable.OAuth/Server/RedirectUriMatching.cs create mode 100644 src/Verifiable.OAuth/SignedJwtValidationOutcome.cs create mode 100644 src/Verifiable.Server/MaterializeRegistrationDelegate.cs create mode 100644 test/Verifiable.Tests/Core/HttpCacheFreshnessTests.cs create mode 100644 test/Verifiable.Tests/OAuth/AccessTokenIdentityMinimizationTests.cs create mode 100644 test/Verifiable.Tests/OAuth/AccessTokenTypeValidationTests.cs create mode 100644 test/Verifiable.Tests/OAuth/AgenticFlowCapstoneTests.cs create mode 100644 test/Verifiable.Tests/OAuth/AuthCodeClientAuthenticationTests.cs create mode 100644 test/Verifiable.Tests/OAuth/BearerTokenChallengeTests.cs create mode 100644 test/Verifiable.Tests/OAuth/ClientIdMetadataDocumentAdversarialFlowTests.cs create mode 100644 test/Verifiable.Tests/OAuth/ClientIdMetadataDocumentCachingFlowTests.cs create mode 100644 test/Verifiable.Tests/OAuth/ClientIdMetadataDocumentCrossWireFlowTests.cs create mode 100644 test/Verifiable.Tests/OAuth/ClientIdMetadataDocumentReaderTests.cs create mode 100644 test/Verifiable.Tests/OAuth/ClientIdMetadataDocumentsResolvingTests.cs create mode 100644 test/Verifiable.Tests/OAuth/ClientIdentifierUrlTests.cs create mode 100644 test/Verifiable.Tests/OAuth/DpopBoundRefreshTests.cs create mode 100644 test/Verifiable.Tests/OAuth/Oidc10IdTokenNonceAudienceScenarioTests.cs create mode 100644 test/Verifiable.Tests/OAuth/PrivateKeyJwtClientAuthenticationTests.cs create mode 100644 test/Verifiable.Tests/OAuth/RedirectUriMatchingTests.cs create mode 100644 test/Verifiable.Tests/OAuth/RefreshConfidentialClientAuthenticationTests.cs create mode 100644 test/Verifiable.Tests/OAuth/RefreshedIdTokenAuthContextTests.cs create mode 100644 test/Verifiable.Tests/OAuth/RefreshedIdTokenParityTests.cs create mode 100644 test/Verifiable.Tests/OAuth/ResourceServerChallengeTests.cs create mode 100644 test/Verifiable.Tests/OAuth/TransportTraceMetadataTests.cs create mode 100644 test/Verifiable.Tests/TestInfrastructure/AuthCodeFlowDriver.cs create mode 100644 test/Verifiable.Tests/TestInfrastructure/CimdServiceHost.cs create mode 100644 test/Verifiable.Tests/TestInfrastructure/JwtPayloadDecoding.cs create mode 100644 test/Verifiable.Tests/TestInfrastructure/LoopbackTls.cs create mode 100644 test/Verifiable.Tests/TestInfrastructure/TraceTreeAssertions.cs create mode 100644 test/Verifiable.Tests/TestInfrastructure/TraceTreeCapture.cs diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 78be04e6..9870513b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,21 +35,21 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a + uses: github/codeql-action/init@7188fc363630916deb702c7fdcf4e481b751f97a with: languages: 'csharp' build-mode: none queries: security-and-quality - - uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 + - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 with: global-json-file: global.json - name: Autobuild if: ${{ github.actor != 'dependabot[bot]' }} - uses: github/codeql-action/autobuild@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a + uses: github/codeql-action/autobuild@7188fc363630916deb702c7fdcf4e481b751f97a - name: CodeQL Analysis if: ${{ github.actor != 'dependabot[bot]' }} - uses: github/codeql-action/analyze@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a + uses: github/codeql-action/analyze@7188fc363630916deb702c7fdcf4e481b751f97a timeout-minutes: 100 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3926da1b..289a1a15 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -85,6 +85,14 @@ env: s.symcb.com:80 ocsp.digicert.com:80 + # BouncyCastle's NuGet package signature chains to Sectigo/Comodo/UserTrust; + # its CRL/OCSP endpoints must be reachable to verify the signature's revocation. + crl.sectigo.com:443 + ocsp.sectigo.com:443 + crl.comodoca.com:443 + ocsp.comodoca.com:443 + crl.usertrust.com:443 + # Dotnet tools download CRL list from here. www.microsoft.com:80 @@ -112,12 +120,21 @@ jobs: steps: - name: Harden Runner if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' }} - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 with: disable-sudo: true egress-policy: block allowed-endpoints: ${{ env.COMMON_ALLOWED_ENDPOINTS }} + # Windows has no sudo to disable; otherwise the same block-mode allowlist so the + # workflow governs egress on the Windows host (package-signature revocation included). + - name: Harden Runner + if: ${{ matrix.os == 'windows-latest' }} + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 + with: + egress-policy: block + allowed-endpoints: ${{ env.COMMON_ALLOWED_ENDPOINTS }} + - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: @@ -125,7 +142,7 @@ jobs: fetch-tags: true - name: Set up .NET SDK - uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 with: cache: true cache-dependency-path: '**/packages.lock.json' @@ -382,7 +399,7 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' }} # Note: disable-sudo is intentionally omitted here because apt-get is # needed below to install native AOT prerequisites (clang, zlib1g-dev). - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 with: egress-policy: block allowed-endpoints: ${{ env.COMMON_ALLOWED_ENDPOINTS }} @@ -394,7 +411,7 @@ jobs: fetch-tags: true - name: Set up .NET SDK - uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 with: cache: true cache-dependency-path: '**/packages.lock.json' @@ -523,7 +540,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 with: disable-sudo: true egress-policy: block @@ -536,7 +553,7 @@ jobs: fetch-tags: true - name: Set up .NET SDK - uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 with: cache: true cache-dependency-path: '**/packages.lock.json' @@ -672,7 +689,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 with: disable-sudo: true egress-policy: block @@ -727,7 +744,7 @@ jobs: environment: Release steps: - name: Harden Runner - uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 + uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 with: disable-sudo: true egress-policy: block diff --git a/Directory.Packages.props b/Directory.Packages.props index da790335..2e578c43 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -16,17 +16,17 @@ - + - + - + - + @@ -37,9 +37,11 @@ --> - - - + + + + + - + - +