Conversation
…CI workflows
## Motivation
This PR addresses a Blocker-severity smart contract vulnerability and associated CI/CD hazards identified during the workspace-wide security audit[cite: 60]. Previously, `Paymaster.validateAndPayForPaymasterTransaction` lacked a caller authorization check[cite: 60]. This critical flaw allowed any arbitrary address to pass a crafted `Transaction` payload and force the paymaster to forward `gasLimit * maxFeePerGas` wei to the bootloader outside of a legitimate fee flow, effectively draining the paymaster's balance[cite: 60, 61]. Additionally, the repository's GitHub Action workflows operated with excessively broad default permissions and insecurely interpolated release tags directly into shell scripts[cite: 61].
## Modifications
* **Unauthenticated Paymaster Drain Guard (`src/Paymaster.sol`)**:
* Introduced the `NotBootloader()` custom error and added a strict `msg.sender != BOOTLOADER_FORMAL_ADDRESS` guard as the first statement in `validateAndPayForPaymasterTransaction`[cite: 60, 61]. This ensures that only the official system bootloader can drive paymaster validation and trigger ETH transfers[cite: 61].
* **CI/CD Least Privilege (`.github/workflows/test.yml`, `.github/workflows/release.yml`)**:
* Added explicit `permissions: contents: read` blocks to drop the default write scopes[cite: 62, 63]. This restricts malicious dependencies or compromised build steps from pushing commits, tags, or releases, which is especially critical for workflows running on pull requests[cite: 62, 63].
* **Shell Injection Mitigation (`.github/workflows/release.yml`)**:
* Bound `${{ github.ref_name }}` to the `RELEASE_TAG` environment variable rather than interpolating it directly into the `run` script[cite: 61, 62]. This safely handles tag names containing shell metacharacters and prevents expression injection in a job that holds Soldeer publishing credentials[cite: 62].
## Checklist
- [x] Format your code according to the Contributor Guide.
- [ ] Add unit tests as outlined in the Contributor Guide.
- [x] Update documentation as needed, including docstrings or example tutorials.
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.
Motivation
This PR addresses a Blocker-severity smart contract vulnerability and associated CI/CD hazards identified during the workspace-wide security audit[cite: 60]. Previously,
Paymaster.validateAndPayForPaymasterTransactionlacked a caller authorization check[cite: 60]. This critical flaw allowed any arbitrary address to pass a craftedTransactionpayload and force the paymaster to forwardgasLimit * maxFeePerGaswei to the bootloader outside of a legitimate fee flow, effectively draining the paymaster's balance[cite: 60, 61]. Additionally, the repository's GitHub Action workflows operated with excessively broad default permissions and insecurely interpolated release tags directly into shell scripts[cite: 61].Modifications
src/Paymaster.sol):NotBootloader()custom error and added a strictmsg.sender != BOOTLOADER_FORMAL_ADDRESSguard as the first statement invalidateAndPayForPaymasterTransaction[cite: 60, 61]. This ensures that only the official system bootloader can drive paymaster validation and trigger ETH transfers[cite: 61]..github/workflows/test.yml,.github/workflows/release.yml):permissions: contents: readblocks to drop the default write scopes[cite: 62, 63]. This restricts malicious dependencies or compromised build steps from pushing commits, tags, or releases, which is especially critical for workflows running on pull requests[cite: 62, 63]..github/workflows/release.yml):${{ github.ref_name }}to theRELEASE_TAGenvironment variable rather than interpolating it directly into therunscript[cite: 61, 62]. This safely handles tag names containing shell metacharacters and prevents expression injection in a job that holds Soldeer publishing credentials[cite: 62].Checklist
PR-Codex overview
This PR focuses on updating GitHub Actions workflows for CI/CD processes and enhancing the
Paymastersmart contract with additional error handling.Detailed summary
.github/workflows/release.ymland.github/workflows/test.ymlto restrictGITHUB_TOKENpermissions to read-only.NotBootloadererror inPaymastercontract to restrict access to thevalidateAndPayForPaymasterTransactionfunction.Paymastercontract.