Skip to content

feat(connections): support XAA requesting app options on samlp connections - #1535

Open
harshithRai wants to merge 2 commits into
masterfrom
DXCDT-2633
Open

harshithRai wants to merge 2 commits into
masterfrom
DXCDT-2633

Conversation

@harshithRai

@harshithRai harshithRai commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🔧 Changes

Enables the Cross App Access requesting app options on samlp connections, following the Management API change that makes them available on SAML the same way they already are on oidc and okta.

token_endpoint_auth_signing_alg and token_endpoint_jwtca_aud_format were rejected by validate() for every strategy except oidc and okta, so a samlp connection carrying them could not be deployed. They are now accepted on samlp too. id_token_signed_response_algs and id_token_session_expiry_supported stay oidc and okta only. The validation error now names the strategies allowed for the offending options and reports every violated group at once. The top-level cross_app_access_requesting_app and the other options (client_id, client_secret, discovery_url, oidc_metadata, token_endpoint_auth_method) already passed through, so they needed no handler change.

The second change closes a data-loss path that this feature makes relevant. Export masks options.client_secret as ##CONNECTIONS_<STRATEGY>_SECRET##. When that placeholder is left unresolved on import it is stripped before the update, and because Auth0 replaces options as a whole on update, the stored secret was cleared with no warning. The connections handler now substitutes the stored secret when the placeholder is unresolved and a connection with the same name and strategy already has one, in both the real import and the dry run, and logs a warning naming the mapping to define. An explicit empty or null client_secret still clears it. This applies to any connection whose stored client_secret the API returns on list. The comment and warning in stripUnresolvedPlaceholders no longer claim that a dropped field keeps its stored value, since that only holds when the API merges updates.

Not a breaking change: validation is only loosened, and the secret handling only changes the previously destructive case. Some values (active: true and private_key_jwt) are gated by an EA feature enabled on the tenant, and the API returns its own error when it is not. The docs now describe the samlp options, the secret placeholder and this gating.

Shape

A samlp connection could previously carry the requesting app and client credential fields, but not the signing algorithm or audience format.

YAML, before (the two token endpoint fields below failed validation on samlp):

connections:
  - name: saml-xaa
    strategy: samlp
    cross_app_access_requesting_app:
      active: true
    options:
      # ...
      client_id: idp-client-id
      client_secret: "##CONNECTIONS_SAMLP_SECRET##"
      token_endpoint_auth_method: private_key_jwt

YAML, after:

connections:
  - name: saml-xaa
    strategy: samlp
    cross_app_access_requesting_app:
      active: true
    options:
      # ...
      client_id: idp-client-id
      client_secret: "##CONNECTIONS_SAMLP_SECRET##"
      token_endpoint_auth_method: private_key_jwt
      token_endpoint_auth_signing_alg: RS256
      token_endpoint_jwtca_aud_format: issuer

Directory (JSON), before:

{
  "name": "saml-xaa",
  "strategy": "samlp",
  "cross_app_access_requesting_app": { "active": true },
  "options": {
    "client_id": "idp-client-id",
    "client_secret": "##CONNECTIONS_SAMLP_SECRET##",
    "token_endpoint_auth_method": "private_key_jwt"
  }
}

Directory (JSON), after:

{
  "name": "saml-xaa",
  "strategy": "samlp",
  "cross_app_access_requesting_app": { "active": true },
  "options": {
    "client_id": "idp-client-id",
    "client_secret": "##CONNECTIONS_SAMLP_SECRET##",
    "token_endpoint_auth_method": "private_key_jwt",
    "token_endpoint_auth_signing_alg": "RS256",
    "token_endpoint_jwtca_aud_format": "issuer"
  }
}

🔬 Testing

Unit tests

Added or updated in test/tools/auth0/handlers/connections.tests.js:

  • Allows token_endpoint_auth_signing_alg and token_endpoint_jwtca_aud_format on samlp alongside the other requesting app options (replaces the test that asserted samlp was rejected)
  • Rejects id_token_signed_response_algs and id_token_session_expiry_supported on samlp, without flagging the token endpoint fields
  • Rejects the token endpoint options on other strategies, and the error lists oidc, okta and samlp
  • Reports unsupported options from both restricted groups in one error
  • Reuses the stored client_secret when the exported placeholder is unresolved, in both calcChanges and dryRunChanges, for samlp and for another strategy
  • Sends the stored client_secret in the update payload that processChanges hands to the update call
  • Logs a warning when the stored secret is reused
  • Does not copy a secret from a stored connection with the same name but a different strategy
  • Leaves the placeholder alone when no secret is stored
  • Does not override an explicit client_secret, an explicit empty one, or an explicit null
  • restoreMaskedClientSecret ignores connections without options and connections with no stored match

Manual verification

Against a live tenant with the EA feature for Cross App Access on SAML enabled, scoped to connections:

  1. Add a samlp connection with cross_app_access_requesting_app.active: true, client_id, client_secret, a discovery_url, private_key_jwt, RS256 and issuer, in both YAML and directory format. The dry run previews a single create.
  2. Import it and read the connection back through the Management API. Every field is present and oidc_metadata is populated from the discovery URL.
  3. Export, and confirm client_secret is written as ##CONNECTIONS_SAMLP_SECRET##. Import that export without a keyword mapping and confirm the stored secret is unchanged and a warning is logged. With a mapping, confirm the new value is applied. Setting client_secret to "" clears it.
  4. Set active: false and confirm the role turns off. Omit cross_app_access_requesting_app and confirm it stays unchanged.
  5. On a tenant without the feature, confirm active: true and private_key_jwt return 400 operation_not_supported, and that client_id, client_secret, client_secret_post, the signing algorithm and the audience format are accepted.
  6. Create a connection with a client_secret for each of oidc, okta, waad, facebook, linkedin and github, export, and import the export with no keyword mapping. The stored secrets are unchanged, a warning is logged for each, and the dry run reports no changes.
  7. With the feature removed from a tenant that already has a connection with active: true, confirm the export no longer includes cross_app_access_requesting_app, and that importing a config that still sends active: true returns the same 400.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

…tions

Allow token_endpoint_auth_signing_alg and token_endpoint_jwtca_aud_format
on samlp connections so the Cross App Access requesting app options
(client_id, client_secret, discovery_url, oidc_metadata, token_endpoint_*)
can be deployed. id_token_* options stay oidc/okta only.

Also keep the stored options.client_secret when the exported
##CONNECTIONS_<STRATEGY>_SECRET## placeholder is left unresolved. Auth0
replaces options as a whole on update, so the placeholder was stripped
and the stored secret was cleared on re-import.

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.67%. Comparing base (5770977) to head (7462382).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1535      +/-   ##
==========================================
+ Coverage   82.64%   82.67%   +0.02%     
==========================================
  Files         193      193              
  Lines        9301     9315      +14     
  Branches     2061     2065       +4     
==========================================
+ Hits         7687     7701      +14     
  Misses        816      816              
  Partials      798      798              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Only reuse a stored options.client_secret when the stored connection has
the same name and strategy, and log a warning naming the keyword mapping
to define when the stored secret is reused. Export isUnresolvedPlaceholder
from utils instead of the raw regex, and correct the comment and warning in
stripUnresolvedPlaceholders, which claimed a dropped field keeps its stored
value even when the API replaces the parent object.

Add tests for the strategy match, the warning, a non-samlp strategy, an
explicit null client_secret, and the payload handed to the update call.
Document the samlp options, the shared secret placeholder, and the
behavior when the feature is later disabled on a tenant.

Co-Authored-By: Claude <noreply@anthropic.com>
@harshithRai
harshithRai marked this pull request as ready for review November 13, 2026 08:35
@harshithRai
harshithRai requested a review from a team as a code owner November 13, 2026 08:35

@ankita10119 ankita10119 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few non-blocking follow-ups:

  1. Other placeholders in options can still be wiped. For example, if options.signingCert: "##SAML_CERT##" on a samlp connection is left unresolved, it's still removed from the update and the stored cert is wiped, because options is replaced as a whole. Keeping this PR to client_secret is fine. Could we open a follow-up to restore any removed options.* field from the stored connection?
  2. Minor:
    • With AUTH0_DRY_RUN_APPLY, the "Reusing…" warning is logged twice per connection, once for the preview and once for the apply.
    • The withOptions + restore block is now duplicated in calcChanges and dryRunChanges. A small shared helper would tidy that up.
  3. Test gap: a test that combines EXCLUDED_PROPS: { connections: ['options.client_secret'] } with the placeholder would be good. I checked it locally and the stored secret is sent as expected, but it isn't covered in the suite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants