Fix: AUTH0_EXCLUDED_ options not respected during export#1342
Merged
ankita10119 merged 3 commits intomasterfrom Apr 1, 2026
Merged
Fix: AUTH0_EXCLUDED_ options not respected during export#1342ankita10119 merged 3 commits intomasterfrom
ankita10119 merged 3 commits intomasterfrom
Conversation
… and clientGrants
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1342 +/- ##
==========================================
- Coverage 80.23% 80.02% -0.22%
==========================================
Files 152 152
Lines 6102 6163 +61
Branches 1247 1276 +29
==========================================
+ Hits 4896 4932 +36
- Misses 692 699 +7
- Partials 514 532 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ns, and resourceServers
kushalshit27
approved these changes
Apr 1, 2026
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
Before this fix,
AUTH0_EXCLUDED_*options were silently ignored during export - excluded resources still appeared in the output.Root Cause
The export pipeline calls
getType()(fetch) →dump()(write). TheAUTH0_EXCLUDED_CLIENTSfiltering only existed insideprocessChanges(), which is called during deploy and is never called during export. As a result,context.assets.exclude.clientswas populated from config but never read anywhere in the export path - all clients and their grants were written to the output regardless of the exclusion config.Fix
Added exclusion filtering inside the dump() function of all four export context handlers:
src/context/yaml/handlers/clients.tssrc/context/yaml/handlers/clientGrants.tssrc/context/directory/handlers/clients.tssrc/context/directory/handlers/clientGrants.tsFor clients, filtering is a direct name match:
For clientGrants, an extra resolution step is needed because grants store a UUID (client_id), not a name. Excluded client names are resolved to IDs using the already-loaded clients list:
Extended Fix (same root cause, all excluded handlers)
After further research, the same export-side bug exists for
AUTH0_EXCLUDED_RULES,AUTH0_EXCLUDED_DATABASES,AUTH0_EXCLUDED_CONNECTIONSandAUTH0_EXCLUDED_RESOURCE_SERVERS. This is confirmed bydocs/excluding-from-management.mdwhich explicitly states exclusion works bi-directionally (both export and import).📚 References
Closes #1339
Backward compatibility
No breaking changes for the deploy path. On the export path, if you had
AUTH0_EXCLUDED_*set and were relying on export writing everything anyway, the output will now correctly omit excluded resources - matching the documented bi-directional behavior.🔬 Testing
Added unit tests across all four dump handlers verifying that:
Also verified manually against a real Auth0 tenant for both --format yaml and --format directory.
📝 Checklist