Repository navigation
Conversation
Users could post monetary loan transactions on loans outside their office hierarchy. Monetary loan and loan charge operations now check the loan's office, like clients already do. Reads and scheduled jobs are unchanged. Assisted-By: claude-opus-5-5
…ctions Users could post monetary transactions on savings accounts outside their office hierarchy. Deposits, withdrawals, adjustments, holds and savings charge operations now check the account's office. Reads and scheduled jobs are unchanged. Assisted-By: claude-opus-5-5
Users could transfer money from or into accounts outside their office hierarchy. Account transfers and refunds by transfer now check both the source and the destination account. Transfers run by scheduled jobs are unchanged. Assisted-By: claude-opus-5-5
df85f20 to
1e4d58f
Compare
Findings1. Collection-sheet savings deposits skip the check (confirmed by tracing the code)
2. Fixed and recurring deposit accounts are not covered at all
3. Undoing a loan disbursal can now fail with 403 (plausible; traced, not run)
Smaller gaps against the stated scope (non-blocking)
TestsThe integration tests give the sibling user the relevant permission (for example There is no test for the collection-sheet path, FD/RD, or undo-disbursal across branches. Those are the three findings above. |
Undoing a loan disbursal reverses every account transfer linked to the loan. Those reversals re-checked the counterparty savings account, so a user could get a 403 for a transfer from another branch that they never had to be allowed to create. Internal reversals now skip the check, since the loan that triggered them is already checked. The user-facing transfer undo now checks both accounts, matching create. The transfer tests now set up the liability transfer GL mapping themselves instead of relying on test order. Assisted-By: claude-opus-5-5
…llection sheets Fixed and recurring deposit transactions and collection sheet savings deposits did not check the account's office. They now do. The collection sheet savings loop swallowed every exception, so it now re-throws NoAuthorizationException to return a 403 like the loan part of the same sheet. Activation, maturity and interest calculation are unchanged. Assisted-By: claude-opus-5-5
|
Thanks @adamsaghy for the review, all three findings were valid. I've pushed fixes: 1. Collection sheet: 2. FD/RD: deposit, withdrawal, post interest, undo, adjust, close and premature close now check the account's office. 3. Undo disbursal: internal transfer reversals ( Tests: integration tests for all three, plus a regression test where undo-disbursal succeeds with a transfer from another branch's savings account. Not covered in this PR - account activation (savings/FD/RD), capitalized income, buy-down fee, re-age/re-amortize, interest pause, contract termination, and working-capital loans. and cross-branch transfers now need access to both offices. Happy to open a follow-up JIRA for these and work on it next. |
Description
Currently, users can post financial transactions to accounts belonging to sibling branches (e.g., a teller in one branch processing a repayment or withdrawal for a client in another branch), bypassing proper office-level isolation.
This PR enforces the office-hierarchy check across loan and savings operations, bringing them in line with existing client-level access controls.
Summary of Changes
What Remains Unchanged
Testing
403 Forbidden, while users from the correct office hierarchy succeed.Checklist