Repository navigation
fix: apply client exclusions in dry-run and keep excluded clients enabled on connections - #1536
Draft
harshithRai wants to merge 1 commit into
Draft
harshithRai wants to merge 1 commit into
harshithRai wants to merge 1 commit into
Conversation
…bled on connections Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1536 +/- ##
==========================================
+ Coverage 82.64% 82.66% +0.01%
==========================================
Files 193 193
Lines 9301 9314 +13
Branches 2061 2066 +5
==========================================
+ Hits 7687 7699 +12
Misses 816 816
- Partials 798 799 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
import --dry-runlisted resources thatimportnever touches, so it couldn't be used as a drift check for a tenant the config only partly manages. The dry-run for clients and client grants skipped the filtersprocessChangesapplies, and the connections handler had a related bug that affected the real import too.AUTH0_EXCLUDED_CLIENTS, the management client,AUTH0_EXCLUDE_THIRD_PARTY_CLIENTS, and (for grants) system grants. Each handler's inlineprocessChangesfilter moved into one method that both paths call, so they can't drift apart again.ClientGrantsHandlergets its owndryRunChanges, which only lists clients when an exclusion or the third-party flag needs them.connections.listno longer returnsenabled_clients, sogetEnabledClientsnever saw that an excluded client was enabled and dropped it from the computed list. The dry-run reported anUPDATE, and a real import disabled the excluded client on that connection instead of leaving it as the tenant has it. This is the same problem fix: prevent false enabled_clients diff in database dry-run #1479 fixed for databases.calcChangesanddryRunChangesnow pass the enrichedgetType()result intogetEnabledClients, so excluded clients keep their enablement on import and the dry-run no longer reports a change for them.Resource servers are not touched here. Their dry-run already honors
AUTH0_EXCLUDED_RESOURCE_SERVERSas of 9.3.0.📚 References
Fixes #1525. Related: #1479.
🔬 Testing
Unit tests
Added in
test/tools/auth0/handlers/clients.tests.js:AUTH0_EXCLUDE_THIRD_PARTY_CLIENTSis trueAdded in
test/tools/auth0/handlers/clientGrants.tests.js:AUTH0_EXCLUDE_THIRD_PARTY_CLIENTSis trueAdded in
test/tools/auth0/handlers/connections.tests.js:Manual verification
Run against a live tenant, in both directory and YAML format:
AUTH0_EXCLUDED_CLIENTSto that application's name.import --dry-runwith and without the exclusion. Without it, the removed application and grant show asDELETE *and the connections asUPDATE. With it, the dry-run reports no changes, including when the connection'senabled_clientsomits or names the excluded application.AUTH0_ALLOW_DELETE=true. Verify through the Management API that the excluded application, its grant, and its enablement on the connections are untouched.📝 Checklist