Skip to content

fix: resolve 400 error when switching between flexible and legacy password policy on database connections#1361

Draft
ankita10119 wants to merge 1 commit intomasterfrom
DXCDT-1591
Draft

fix: resolve 400 error when switching between flexible and legacy password policy on database connections#1361
ankita10119 wants to merge 1 commit intomasterfrom
DXCDT-1591

Conversation

@ankita10119
Copy link
Copy Markdown
Contributor

🔧 Changes

When switching a database connection's password policy between flexible (password_options) and legacy (passwordPolicy, password_complexity_options, password_history, password_no_personal_info, password_dictionary), the deploy would fail with a 400 error from the Management API.

The databases handler fetches the existing connection state before updating and shallow-merges it with the desired payload. This caused both policy groups to appear in the PATCH body simultaneously, which Auth0 rejects. The fix strips the conflicting group from the existing connection state before the merge, following the same pattern already used for the attributes vs requires_username/validation conflict in the same method.

Both transitions are fixed:

  • Legacy → Flexible: deploying password_options when connection has passwordPolicy set
  • Flexible → Legacy: deploying passwordPolicy when connection has password_options set

📚 References

N/A

🔬 Testing

  • Covered unit test cases
  • Tested with real tenant data

📝 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)

@ankita10119 ankita10119 requested a review from a team as a code owner April 13, 2026 08:16
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.03%. Comparing base (8fe0e28) to head (d397f47).

Files with missing lines Patch % Lines
src/tools/auth0/handlers/databases.ts 40.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1361      +/-   ##
==========================================
- Coverage   80.10%   80.03%   -0.07%     
==========================================
  Files         152      152              
  Lines        6212     6222      +10     
  Branches     1290     1293       +3     
==========================================
+ Hits         4976     4980       +4     
- Misses        702      707       +5     
- Partials      534      535       +1     

☔ View full report in Codecov by Sentry.
📢 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.

@ankita10119 ankita10119 marked this pull request as draft April 13, 2026 11:40
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.

2 participants