Fix(finstripe): reject zero-and-negative amount transfers with pre-DB guard#432
Open
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Open
Fix(finstripe): reject zero-and-negative amount transfers with pre-DB guard#432Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Conversation
Root cause: create_transfer lacked an amount > 0 guard, allowing amount=0.0 to persist a completed transaction record. Solution: Added `if amount <= 0` check at function entry, returning an error dict before _generate_transfer_id() or db_session() are reached. Impact: No DB writes on invalid input. Consistent error shape with existing tool responses. Zero regression risk to valid-amount paths. 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 #334
Adds
amount <= 0validation tocreate_transfer, blocking zero-amounttransactions before any DB write or transfer ID generation occurs.
Problem
create_transfer(amount=0.0, ...)succeeded, creating a completedtransaction record — polluting audit logs with financially meaningless
entries and allowing invoice/vendor ID probing at zero cost.
Root Cause
No amount validation existed in
create_transfer. The functioncalled
_generate_transfer_id()andrepo.create_transaction()unconditionally, regardless of amount value.
Solution
Insert a two-line guard at function entry:
Returns before any side-effectful call is made.
Impact
Testing