Skip to content

Improve main file security - #2

Open
altyni86 wants to merge 2 commits into
mainfrom
cursor/improve-main-file-security-gpt-5.1-codex-high-ab13
Open

Improve main file security#2
altyni86 wants to merge 2 commits into
mainfrom
cursor/improve-main-file-security-gpt-5.1-codex-high-ab13

Conversation

@altyni86

@altyni86 altyni86 commented Dec 6, 2025

Copy link
Copy Markdown
Owner

Harden BatchInvoker contract with explicit signature validation and a balance-invariant guard.

This improves security by rejecting replay attempts with invalid signatures and preventing forced ETH transfers from bricking the contract. The contract now ensures its balance returns to the pre-execution state, accounting for msg.value, covering both leftover value and attempts to siphon forced deposits. The test suite has been expanded to cover these new safeguards, and foundry.lock is now tracked for deterministic dependency resolution.


Open in Cursor Open in Web


Note

Add explicit signature validation and a stricter balance-invariant in BatchInvoker, with new tests for invalid signatures and forced ETH transfers.

  • Contract (src/BatchInvoker.sol):
    • Add InvalidSignature error and revert when auth(...) returns address(0).
    • Enforce balance-invariant by tracking startingBalance = address(this).balance - msg.value and reverting ExtraValue if final balance differs; update related docs.
  • Tests (test/BatchInvoker.t.sol):
    • Add ForceSend helper and test to ensure forced ETH does not break executions and balance remains unchanged.
    • Add invalid-signature test; keep value-mismatch tests (too little/too much) validating ExtraValue behavior.

Written by Cursor Bugbot for commit 1fafce0. This will update automatically on new commits. Configure here.

@cursor

cursor Bot commented Dec 6, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@altyni86
altyni86 marked this pull request as ready for review December 6, 2025 23:26
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.

2 participants