🐛 Fixed settings import overwriting protected core settings - #30694
Conversation
no ref Core settings (session secrets, private keys and similar) are meant to be dropped on import, but the filter trusted the group field from the import file, so relabelling a core key as `site` let an import overwrite it. The group now comes from the schema's default settings, which covers every core key; the API key-group mapper is missing several of them. Exports also no longer include the core group. Those settings are never imported, so exporting them only put instance secrets into files that get shared with support and migration tools. Thanks to @zachariahchow-gvt for the report. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 4m 40s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 3m 45s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 4m 16s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 3m 41s | View ↗ |
nx run ghost:test:e2e |
✅ Succeeded | 2m 57s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 27s | View ↗ |
nx run-many -t test:unit -p ghost |
✅ Succeeded | 33s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | 1s | View ↗ |
Additional runs (4) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-09-10 18:58:35 UTC
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: QUIET Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (14)
🧰 Additional context used📓 Path-based instructions (4)Review whether tests prove changed behaviour, meaningful error/edge paths, and externally observable contracts without coupling to implementation details.⚙️ CodeRabbit configuration file Files:
New source files must be TypeScript: flag new JS files as a required change unless exempt (DB migrations, apps/ember-admin/, tool/config files, scripts/, docker/, generated code).⚙️ CodeRabbit configuration file Files:
Prioritise concrete correctness, security, data-integrity, compatibility, and regression risks.⚙️ CodeRabbit configuration file Files:
New files are TypeScript: Fail if the PR adds a new .js/.jsx/.cjs/.mjs source file, unless it is: a DB migration (ghost/core/core/server/data/migrations/), under apps/ember-admin/, a tool/config file, under scripts/ or docker/, or generated...📄 CodeRabbit inference engine (Custom checks) Files:
WalkthroughThe exporter now excludes all settings in the Suggested reviewers: Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Core secrets are protected from import overwrites and excluded from exports, with coverage for relabelled settings. The change is ready to merge. 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
Full details: Type-Safe BoundariesExplanation The PR adds unvalidated boundary-data consumption. In Resolution Validate the database rows and imported setting records at their boundaries before the new logic uses them. Add Zod schemas for the relevant setting-row shapes, call
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #30694 +/- ##
==========================================
+ Coverage 67.66% 67.71% +0.05%
==========================================
Files 1675 1675
Lines 60502 60506 +4
Branches 10461 10463 +2
==========================================
+ Hits 40936 40972 +36
+ Misses 17249 17218 -31
+ Partials 2317 2316 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

no ref
Why
The settings importer is meant to drop every
coresetting (session secrets, private keys,db_hashand similar), but the filter checked thegroupfield supplied in the import file. Only files that omitgroupget it derived from the key, so a file that relabels a core key assitecould overwrite it.Exports were also including the whole
coregroup. Those settings are never imported, so exporting them only put instance secrets (admin_session_secret,members_private_key,ghost_private_key, etc.) into files that get emailed to support and handed to migration tools.What
default-settings.jsonand only falls back to the file'sgroupfor unknown keys (whichSettings.editcan't write anyway). I didn't usesettings-key-group-mapperbecause it has no entry for 7 of the 18 core keys, includingmachine_payments_secret,members_stripe_webhook_secretandsite_uuid.coregroup is always excluded. The four blocklist entries that were core keys are removed as redundant. The blocklist count test now counts only non-core keys.DB backups use the same exporter, so they no longer contain core settings either. Nothing lost: restoring a backup goes through the importer, which already drops them.
Thanks to @zachariahchow-gvt for the report.
🤖 Generated with Claude Code