Repository navigation
fix(defaults): enforce configured grace period in default entrypoints - #2995
Hamzasaheed wants to merge 6 commits into
Conversation
|
@Hamzasaheed Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
5df45bc to
40aa681
Compare
Strips the payload this branch picked up (deleted backend/api.js, truncated quicklendx-frontend/postcss.config.mjs, unhooked backend/package.json). No functional change to the branch's own work.
|
Hi @Hamzasaheed — heads-up before we can merge this. Our malware scan found that an earlier commit on this branch carries a PolinRider malware payload (obfuscated code hidden after a long run of spaces in Please:
Once the branch history is clean and the PolinRider guard passes, we'll merge it. Thanks! |
a2a819a to
b93aaa3
Compare
b93aaa3 to
7743d47
Compare
7743d47 to
5b68953
Compare
|
Hi @Hamzasaheed — thanks for removing the payload. The final diff is now clean, but this branch's commit history still contains the PolinRider malware (the earlier commit with obfuscated code hidden in config files and a How to fix (without opening the old branch in VS Code / Cursor): git fetch upstream main
git checkout -B <your-branch> upstream/main # start fresh from clean main
git checkout <your-last-commit> -- <only your own source/test files>
git commit -m "<your change>"
git push --force origin <your-branch>Please do not bring back As soon as the branch history is clean and the PolinRider guard passes, we will merge it. Thank you! |
|
@Baskarayelu — this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed 9e8d4b9). |
9e8d4b9 to
5b68953
Compare
|
Automated note from my-bounty, posted on behalf of @Hamzasaheed. An automated conflict-fix run pushed commit This does not change the malware hold. The payload is still in the earlier commit history, so the history rewrite described in the earlier review still applies. |
|
@Baskarayelu — this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed c9b9c40). |
1b48b3d to
5175074
Compare
5175074 to
bd87b39
Compare
bd87b39 to
5f4e1e7
Compare
5f4e1e7 to
4eda7cc
Compare
4eda7cc to
6757ec5
Compare
6757ec5 to
8de787b
Compare
8de787b to
221c52c
Compare
221c52c to
ff4d742
Compare
ff4d742 to
479c305
Compare
|
Warning Possible malicious code: please review before merging. An automated security scan flagged files in this pull request that appear to contain malicious code. Code like this can run automatically when a project is opened in an editor or its dependencies are installed, so it could compromise the machine of anyone who checks out this branch. Automated scans can be wrong, so this may be a false positive. Maintainers: please review the flagged files carefully before merging, on GitHub in your browser rather than by checking out the branch. The malicious part is often hidden far off to the right of an ordinary-looking line, so scroll sideways through each file. @Hamzasaheed: this pull request adds or changes these files, possibly without your knowledge. Malware like this spreads by adding itself to repositories on machines it has infected, so your machine might be compromised. Please undo these changes in this pull request, and don't open or run other projects on that machine until you've checked it. Flagged files at commit
Only merge once you're confident these files are safe. ℹ️ Posted automatically by Drips Wave. Questions? Contact support@drips.network. |
Overview
This PR closes the early-default attack surface in
defaults.rsby removing the caller-suppliedgrace_periodoverride from the permissionless default functions and wiring the module's default handling into the contract entrypoints.mark_invoice_defaultedandscan_funded_invoice_expirationsnow always resolve the protocol's configured grace period, so no caller can shorten the grace window (including passingSome(0)) to default a funded invoice one second after its due date.Related Issue
Changes
🛡️ Defaults module (
quicklendx-contracts/src/defaults.rs)mark_invoice_defaulted(env, invoice_id)— dropped thegrace_period: Option<u64>parameter; always callsresolve_grace_period(env, None)so the configured value (defaultDEFAULT_GRACE_PERIOD) is used.scan_funded_invoice_expirations(env, limit)— dropped thegrace_period: u64parameter; resolves the configured grace internally instead of accepting a caller value.check_and_handle_expirationcallers updated to pass the resolved configured grace rather than a caller-provided one.handle_defaultand the overdue-scan cursor/batch-limit helpers updated to match the new signatures.🔌 Contract entrypoints (
quicklendx-contracts/src/lib.rs)require_not_paused, with the token-moving default path (insurance claims) wrapped inreentrancy::with_payment_guard:mark_invoice_defaulted(invoice_id)check_overdue_invoices(limit: Option<u32>) -> OverdueScanResultcheck_invoice_expiration(invoice_id) -> boolget_overdue_scan_cursor()get_business_default_history(business)🧪 Tests
src/test_default.rs— updated calls to the new signatures; addeddefault_respects_configured_grace,caller_cannot_shorten_grace,scan_uses_config_grace, anddouble_default_rejected.src/test_default_grace_boundary.rs— updated to the new signatures and boundary assertions atT + G/T + G + 1.src/test_overdue_expiration.rs— updated scan calls to the new signature.src/lib.rs— enabled#[cfg(test)] mod test_default;,mod test_default_grace_boundary;, andmod test_overdue_expiration;.🗑️ Removed test cases
Some(0)to force an early default) were deleted, since that behavior is now intentionally unreachable through the public API.Verification Results
default_respects_configured_grace: atT + 604_800returnsOperationNotAllowed; atT + 604_801succeeds and status isDefaultedcaller_cannot_shorten_grace: atT + 1, no public entrypoint defaults the invoice; status staysFundedscan_uses_config_grace: 3 funded invoices atT + 604_801all defaulted viacheck_overdue_invoices(Some(10)),next_cursor == 0double_default_rejected: secondmark_invoice_defaultedreturns the module's duplicate-default errortest_default,test_default_grace_boundary,test_overdue_expiration) passCloses #2932