Skip to content

feat:Harden archive and restore ownership checks for bills#441

Open
Abolax123 wants to merge 5 commits intoRemitwise-Org:mainfrom
Abolax123:feature/bills-archive-restore-auth-hardening
Open

feat:Harden archive and restore ownership checks for bills#441
Abolax123 wants to merge 5 commits intoRemitwise-Org:mainfrom
Abolax123:feature/bills-archive-restore-auth-hardening

Conversation

@Abolax123
Copy link
Copy Markdown

Closes #272

Summary

Strengthens authorization and storage consistency for bill archive, restore, cleanup, and archived bill reads to prevent cross-owner data access or manipulation.

Changes

  • get_archived_bills: requires authenticated owner (owner.require_auth()).
  • get_archived_bill: now (caller, bill_id) -> Result<ArchivedBill, Error>; caller must be the archived row’s owner (breaking API for direct callers).
  • archive_paid_bills / restore_bill / bulk_cleanup_bills: enforce owner affinity and map key vs embedded id checks; restore refuses active ID collisions.
  • New contract error: InconsistentBillData (15).
  • README: archive/restore security model, assumptions, and cargo test -p bill_payments.
  • Tests: dedicated Issue Harden archive and restore ownership checks for bills #272 module in bill_payments/src/test.rs; stress/integration updates; proptest ledger setup fixes.

How to test

cargo test -p bill_payments

- Require owner auth for get_archived_bills; get_archived_bill(caller, id) returns Result
- Enforce id/key consistency; add InconsistentBillData error; restore checks active collisions
- bulk_cleanup validates archived id vs map key; archive_paid_bills skips non-owners with key check
- Tests in src/test.rs (Issue Remitwise-Org#272), stress/integration fixes, README security + API docs
- Proptest: ledger time setup for valid create_bill; multi-user archive stress uses per-owner archive

Made-with: Cursor
@Baskarayelu
Copy link
Copy Markdown
Contributor

@Abolax123 Please resolve the conflicts

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.

Harden archive and restore ownership checks for bills

3 participants