Skip to content

fix: preserve keyword placeholder strings for all email provider credentials - #1470

Open
ankita10119 wants to merge 2 commits into
masterfrom
DXCDT-2263
Open

fix: preserve keyword placeholder strings for all email provider credentials#1470
ankita10119 wants to merge 2 commits into
masterfrom
DXCDT-2263

Conversation

@ankita10119

Copy link
Copy Markdown
Contributor

🔧 Changes

When AUTH0_PRESERVE_KEYWORDS is enabled and a local config file uses a keyword placeholder string for credentials (e.g. "@@SMTP_CREDENTIALS@@"), emailProviderDefaults now preserves it as-is instead of attempting to apply masking logic.

Previously, for smtp, the in operator was used directly on the placeholder string, causing a hard TypeError crash during export. For all other providers (ses, mailgun, mandrill, sendgrid, sparkpost, azure_cs, ms365), the string was silently spread into the credentials object as character-indexed keys (e.g. {"0": "@", "1": "@", ...}), which caused Auth0 API to reject the payload with a 400 on subsequent deploy.

The fix adds a typeof credentials !== 'string' guard to each provider block in emailProviderDefaults. This is purely additive — all existing behavior for object and undefined credentials is unchanged.

📚 References

Fixes #1467

🔬 Testing

Unit tests added for all affected providers (smtp, ses, mailgun, azure_cs, ms365) covering the keyword placeholder string case.

Manual end-to-end testing performed:

  • Confirmed the TypeError crash during export with AUTH0_PRESERVE_KEYWORDS=true and credentials: "@@SMTP_CREDENTIALS@@" in local config
  • Confirmed export succeeds after the fix and the placeholder is preserved in the output file
  • Confirmed Auth0 API returns 400 Additional properties not allowed when garbage character-indexed keys are deployed (validating the severity of the other providers' issue)

📝 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 August 21, 2026 19:47
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.52%. Comparing base (a00a055) to head (d7f2f5d).

Files with missing lines Patch % Lines
src/context/defaults.ts 64.70% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1470      +/-   ##
==========================================
+ Coverage   80.51%   80.52%   +0.01%     
==========================================
  Files         163      163              
  Lines        7745     7750       +5     
  Branches     1721     1726       +5     
==========================================
+ Hits         6236     6241       +5     
  Misses        808      808              
  Partials      701      701              

☔ 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.

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

Labels

None yet

Projects

None yet

2 participants