fix(vault-migration): enforce org ownership before updating namespace config#5936
Conversation
… namespace config
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile SummaryThis PR closes a cross-org authorization gap in Confidence Score: 5/5Safe to merge — the authorization fix is correct and the single P2 finding is a minor hardening suggestion that does not block merge. All findings are P2. The core security fix (ownership check before update) is properly implemented using the existing DAL's findById which returns the orgId field. No logic errors, no data loss risk, no breaking changes. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix(vault-migration): enforce org owners..." | Re-trigger Greptile |
backend/src/services/external-migration/external-migration-service.ts
Outdated
Show resolved
Hide resolved
…vice.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Fixes #5941
Context
This fixes a cross-org authorization gap in Vault namespace config updates.
Before this change,
updateVaultExternalMigrationupdated configs by rawidand did not verify that the target config belonged to the actor's organization. If an org admin knew another org's config UUID, they could attempt to mutate it. Missing IDs could also flow into invalid response states.Now, the update flow first loads the config by
id, returns404when not found, and returns403ifconfig.orgId !== actor.orgIdbefore performing the update.Related issue: High - Cross-org update authorization gap on Vault namespace configs.
Screenshots
N/A (no UI changes).
Steps to verify the change
orgAand note itsid.orgB, callPUT /api/v3/external-migration/vault/configs/:idusing theorgAconfigid.403with message:Config does not belong to this organization.id.404with message:Vault migration config not found.orgA), call the same endpoint with a valid payload.200and the config is updated.Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).