fix: Cross-tenant adapter overwrite in generated adapter installation - #302
fix: Cross-tenant adapter overwrite in generated adapter installation#302Donjon-Cerberus wants to merge 1 commit into
Conversation
|
Thank you so much for the pull request! Nice find. Please see my feedback below:
gofmt -d internal/adaptergen/generator.go reports it. Pre-existing struct-tag misalignments are not introduced here, but this line is. Fix before merge.
|
|
@Donjon-Cerberus Let me know if you want me to take over this work and land it. If you haven't responded in the next few days, I'll close this out and create a new PR. |
|
Please do. |
Closes #301
Summary
Automated security fix for Cross-tenant adapter overwrite in generated adapter installation (Critical).
CWE: CWE-CWE-284
OWASP: A01:2021-Broken Access Control
Fix Confidence: high
What Changed
Fixes cross-tenant adapter overwrite in cloud (per-user) mode.
pkg/adapters/adapters.go: AddedReplaceForUser(serviceID, userID, adapter)that stores a hot-loaded adapter only in the per-user map, never in the shared registry.internal/adaptergen/generator.go:install()now routes toReplaceForUserwheneverg.userID != "", so a cloud user's generated adapter cannot take over the shared registry that every tenant resolves through. It also rejects any service ID that collides with an existing built-in (shared) adapter, preventing a user from shadowing e.g.google.gmailorgithubfor their own account or abusing the shared codepath.Update()now usesGetForUserso the existence check still works after per-user adapters are kept out of the shared registry.Remove()already used per-user removal; combined with the install-side change, the removal scope now matches the installation scope.Caveats
Verification Checklist
Created by Cerberus Merlin