Fix(finstripe): resolve missing cross-vendor ownership guard in create_transfer#446
Open
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Open
Fix(finstripe): resolve missing cross-vendor ownership guard in create_transfer#446Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Conversation
…sfer Root cause: create_transfer accepted caller-supplied vendor_id with no session ownership validation, allowing a vendor portal session to transfer funds to any vendor. Solution: Add early-return guard before DB write: if session is a vendor portal session and current_vendor_id does not match the requested vendor_id, return error dict. Impact: Admin and non-vendor sessions unaffected. Guard is additive with zero DB side effects on rejection. Behavior is deterministic and stateless. Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #322
Vendor portal sessions could initiate transfers to any vendor account by supplying an arbitrary
vendor_id. This patch adds an ownership guard before any DB write increate_transfer, blocking cross-vendor payment fraud within the same namespace.Problem
In
finbot/mcp/servers/finstripe/server.py, thecreate_transfertool accepts a caller-suppliedvendor_idwith no session ownership validation. A vendor portal session scoped tovendor_acan call:and the transfer commits successfully enabling an attacker to drain funds to any vendor account in the same namespace.
Root Cause
session_contextis available in the closure but never consulted. The call below executes unconditionally:Solution
Add a 5-line early-return guard immediately before
_generate_transfer_id(). The guard fires only when all three conditions hold:portal_type == "vendor"scopes the restriction to vendor sessions only; admin/other sessions pass through unchangedcurrent_vendor_id is not Noneskips the guard when no ownership can be assertedcurrent_vendor_id != vendor_idblocks cross-vendor targeting; same-vendor transfers proceed normally{"error": str}is consistent with the existing pattern in this fileImpact
Testing
test_mcp_vendor_003must pass: vendor session targeting a foreignvendor_idreceives error responsetest_mcp_vendor_005must continue to pass: admin session transfer is unaffected