Skip to content

fix: harden governance, JWK genesis, and proposer stake bound#79

Merged
ByteYue merged 2 commits intomainfrom
dummy-test-branch
Apr 21, 2026
Merged

fix: harden governance, JWK genesis, and proposer stake bound#79
ByteYue merged 2 commits intomainfrom
dummy-test-branch

Conversation

@Stumble
Copy link
Copy Markdown
Contributor

@Stumble Stumble commented Apr 18, 2026

Summary

  • Governance (src/governance/Governance.sol): reject proposal batches that target the Governance contract itself. Without this guard, a passing proposal could invoke transferOwnership / addExecutor / removeExecutor when Governance is its own owner, escalating to full control.
  • JWKManager (src/oracle/jwk/JWKManager.sol): validate genesis issuer + RSA_JWK fields (non-empty issuer, kid, kty, alg, e, n) so malformed genesis data cannot silently poison downstream signature verification.
  • GovernanceConfig (src/runtime/GovernanceConfig.sol): tighten requiredProposerStake bound from type(uint256).max to type(uint128).max. Pool voting power is clamped to uint128 in Governance.getRemainingVotingPower, so any value above uint128.max is unreachable and would freeze governance.
  • Errors: add ProposalTargetsGovernance(uint256 index) and InvalidJWK(bytes issuer).
  • Tests: update GovernanceConfig fuzz assumptions to respect the new uint128 cap on requiredProposerStake.

Test plan

  • forge build — succeeds
  • forge test — 935 tests pass, 0 failures
  • Reviewer confirms defense-in-depth guards don't conflict with intended governance flows
  • Reviewer confirms JWK genesis tooling does not produce entries with empty kid/kty/alg/e/n

🤖 Generated with Claude Code

Stumble and others added 2 commits April 18, 2026 05:39
…ake bound

- Governance: reject proposal batches that target the Governance contract
  itself, preventing a passing proposal from escalating via transferOwnership
  / addExecutor / removeExecutor when Governance owns itself.
- JWKManager: validate genesis issuer and RSA_JWK entries (non-empty issuer,
  kid, kty, alg, e, n) so malformed genesis data cannot silently poison
  downstream signature verification.
- GovernanceConfig: tighten requiredProposerStake bound from
  type(uint256).max to type(uint128).max, matching the uint128 clamp in
  Governance.getRemainingVotingPower. Any value above uint128.max is
  unreachable and would freeze governance.
- Errors: add ProposalTargetsGovernance and InvalidJWK.
- Tests: update GovernanceConfig fuzz bounds to respect the new uint128 cap.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🛡️ Security Audit Results

Security Audit Summary

Generated on: Sat Apr 18 17:01:43 UTC 2026
Commit: 25a1348
Branch: 79/merge

Tools Executed

  • ✅ Slither: 1 reports
  • ✅ Mythril: 1 reports
  • ✅ 4naly3er: 1 reports
  • ✅ Aderyn: 0 reports

Next Steps

  1. Review all generated reports in the audit/ directory
  2. Prioritize High and Medium severity issues
  3. Address findings before deployment
  4. Consider additional manual security review

📁 Full reports available in GitHub Actions Artifacts

@Stumble Stumble requested a review from ByteYue April 20, 2026 18:21
@ByteYue ByteYue merged commit 0e16d61 into main Apr 21, 2026
8 checks passed
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