fix: apply AUTH0_INCLUDED_CONNECTIONS on export - #1442
Open
jithinzac wants to merge 2 commits into
Open
Conversation
`AUTH0_INCLUDED_CONNECTIONS` was only honoured on import. The value was read into `assets.include.connections` on both code paths, but the only consumer was `filterIncluded` in the connections handler's `processChanges`, so exports wrote every connection on the tenant. Both `dump()` implementations now filter to the included connections, mirroring the existing exclude behaviour. In the directory handler, pruning is scoped to the listed names so files belonging to connections outside the include list survive a re-dump — those connections are unmanaged, matching how excluded connections are preserved today. Fixes auth0#1441
jithinzac
marked this pull request as draft
July 29, 2026 08:31
Author
|
Looks like E2E failures are due to missing env variables |
jithinzac
marked this pull request as ready for review
July 29, 2026 08:50
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔧 Changes
AUTH0_INCLUDED_CONNECTIONSwas only honoured onimport. The value was read intoassets.include.connectionson both code paths — including insidedump()atsrc/context/directory/index.ts:124— but the only consumer wasfilterIncludedin the connections handler'sprocessChanges.filterIncludedoperates onCalculatedChanges, a structure the export path never builds, so exports wrote every connection on the tenant regardless of the include list.This contradicts the documented behaviour:
src/context/directory/handlers/connections.tsandsrc/context/yaml/handlers/connections.ts—dump()now filters to the included connections, immediately after the existing exclude filter and mirroring its shape:src/context/directory/handlers/connections.ts— pruning is scoped to the listed names when an include list is configured:Without this, the folder-pruning logic added alongside export-side exclude filtering would delete the files of every connection outside the include list. Those connections are unmanaged, so their files are preserved across re-dumps — the same guarantee excluded connections already get via the
expectedFilesseeding. Stale files for connections that are in the include list but no longer exist on the tenant are still removed.No behaviour change when
AUTH0_INCLUDED_CONNECTIONSis unset: both filters are no-ops on an empty list, andprunableFilesstaysnull, leaving the existing prune semantics intact.📚 References
Fixes #1441
The asymmetry this closes:
AUTH0_EXCLUDED_CONNECTIONS, documented as the deprecated counterpart, gained export filtering whileAUTH0_INCLUDED_CONNECTIONSdid not — and the two cannot be combined, sincesrc/context/index.ts:148throws when both are set. That left no way to express the keep-list use case the docs call out explicitly:A keep-list is the only maintainable shape for that case, because Self-Service SSO mints new connections with generated UUID names over time — expressing the same intent through an exclude list means amending it every time a connection is created.
🔬 Testing
Four new tests, placed alongside the existing exclude-dump tests:
test/context/directory/connections.test.jsshould only dump included connections— awaadconnection in the list is written; asamlpconnection outside it is not.should preserve pre-existing files for connections outside the include list on re-dump— a file written by a prior export survives when its connection is outside the list. Fails without theprunableFilesscoping.should remove stale files for included connections no longer present on the tenant— pruning still works within the include list.test/context/yaml/connections.test.jsshould only dump included connections— the returnedconnectionsarray contains just the listed connection.Full suite: 1342 passing, 1 pending, no regressions.
npm run build,npm run lint(eslint + kacl), andnpx prettier --checkall clean.Manual end-to-end verification against a real tenant holding 34 connections — 4 named in
AUTH0_INCLUDED_CONNECTIONS, the rest mostly UUID-namedsamlpconnections created by Self-Service SSO. Identical config file and output folder for both runs, withAUTH0_INCLUDED_ONLY: ["connections"]:master: 34 files written toconnections/google-oauth2.json,okta-sandbox-oidc-test.json,waad.json,windowslive.json📝 Checklist
docs/configuring-the-deploy-cli.mdalready documents this behaviour; this change makes the implementation match it, so no doc edit is needed.