Repository navigation
fix: withdrawal pending-state guards, cancel entrypoint, security headers, and single shutdown path (#1680, #1681, #1676, #1675) - #1705
Merged
Conversation
…ders, and single shutdown path (Junirezz#1680, Junirezz#1681, Junirezz#1676, Junirezz#1675)
|
@DokaIzk 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! 🚀 |
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.
contracts/vault — Issue #1680: reject a second large withdrawal while one is pending
withdrawnow checks for an existingPendingWithdrawal(user)before creating anew timelocked request, so a second large withdrawal is rejected
(
WithdrawalCooldownActive) instead of silently overwriting the pending entryand restarting its 24-hour timelock. No event is emitted for a replacement,
because no replacement can occur.
contracts/vault — Issue #1681: add
cancel_withdrawal(user)Adds a user-owned
cancel_withdrawalentrypoint that requires the caller's auth(
user.require_auth()), removes the pending entry, and emits apndwcnevent.Also adds a read-only
pending_withdrawal(user)query. Documented in thewithdrawal lifecycle doc and error-code catalog.
backend — Issue #1676: set security headers with helmet
Applies
helmet()before routes so every response (including Swagger UI)receives
X-Content-Type-Options,X-Frame-Options, andContent-Security-Policy. HSTS is production-only. Integration test assertsthe headers on
/healthand that the CSP still lets/docsload.backend — Issue #1675: single graceful shutdown path
The
GracefulShutdownHandlerconstructed inindex.tsis now the singleshutdown path. Outbox, HTTP server, and DB are registered with
onShutdownindocumented order (server drains in-flight requests first, then outbox, then DB).
The duplicate ad hoc
process.on('SIGTERM'/'SIGINT')handlers and theredundant outbox start are removed. Test sends
SIGTERMand verifies shutdownorder.
Note: minimal surgical repairs were also made to pre-existing breakage that
kept the contract from compiling (a mangled
set_strategycooldown block, aduplicated
total_assetsoracle block, and duplicate imports/dead code inpermissions.rs) so the new code could be compiled and tested.Closes #1680
Closes #1681
Closes #1676
Closes #1675