Skip to content

fix: Add validation to prevent arbitrary invoice status values#193

Open
Jean-Regis-M wants to merge 4 commits intoGenAI-Security-Project:mainfrom
Jean-Regis-M:p
Open

fix: Add validation to prevent arbitrary invoice status values#193
Jean-Regis-M wants to merge 4 commits intoGenAI-Security-Project:mainfrom
Jean-Regis-M:p

Conversation

@Jean-Regis-M
Copy link

Description

Adds input validation to update_invoice_status to ensure only predefined
status values can be persisted to the database.

Issue

Fixes #138

Changes Made

  • Added VALID_INVOICE_STATUSES constant with allowed values
  • Added validation check at the beginning of update_invoice_status
  • Raises ValueError with helpful message for invalid statuses
  • Maintains existing functionality for valid statuses

Testing

  • test_inv_upd_005_arbitrary_status_accepted now passes
  • All other invoice status tests (001-004) continue to pass
  • Manual testing with valid statuses works as expected

Security Impact

Prevents prompt injection attacks that could bypass business logic by
setting arbitrary status values (e.g., "approved_bypass" to avoid detection).

Add validation for invoice status before updating.

Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
fix: Add validation to prevent arbitrary invoice status values
Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug_036_EVALUATE: Test Case INV-UPD-005 — update_invoice_status accepts arbitrary status strings

1 participant