Skip to content

fix: safe-core robustness (multisend recursion, EIP-1271 preimage) + utils cleanup#2512

Merged
Uxio0 merged 2 commits into
mainfrom
uxio/pla-1544-safe-eth-py-robustness-fixes
Jun 5, 2026
Merged

fix: safe-core robustness (multisend recursion, EIP-1271 preimage) + utils cleanup#2512
Uxio0 merged 2 commits into
mainfrom
uxio/pla-1544-safe-eth-py-robustness-fixes

Conversation

@Uxio0
Copy link
Copy Markdown
Member

@Uxio0 Uxio0 commented Jun 1, 2026

Summary

Safe-core robustness fixes plus a small eth/utils.py cleanup pass, from the safe-eth-py review.

Changes

Safe-core

  • safe/multi_send.pyMultiSend.from_bytes now decodes iteratively instead of recursively. The old [tx] + cls.from_bytes(rest) blew the stack (RecursionError) and was O(n²) on large, attacker-controllable multisend payloads. Output is byte-for-byte identical.

utils cleanup

  • remove_swarm_metadata — strips CBOR metadata generically via its trailing 2-byte length, so it handles IPFS / bzzr1 / solc blobs (Solidity ≥0.5.10), not only legacy bzzr0.
  • bytes_to_float — raises ValueError instead of assert (asserts are stripped under python -O).
  • fast_to_checksum_address / fast_bytes_to_checksum_address — interpolate the the offending value into the previously-uninterpolated %s error message

Closes PLA-1568

@Uxio0 Uxio0 requested a review from a team as a code owner June 1, 2026 10:23
safe-core:
- MultiSend.from_bytes: decode iteratively instead of recursively.
  The previous `[tx] + cls.from_bytes(rest)` recursion hit RecursionError
  and was O(n^2) on large (attacker-controllable) multisend payloads.
  Behaviour is byte-for-byte identical.

utils:
- remove_swarm_metadata: strip CBOR metadata generically via its trailing
  2-byte length (handles IPFS/bzzr1/solc, not only legacy bzzr0).
- bytes_to_float: raise ValueError instead of assert (assert is stripped
  under python -O).
- fast_to_checksum_address / fast_bytes_to_checksum_address: interpolate
  the offending value into the previously-uninterpolated %s error message.
@Uxio0 Uxio0 force-pushed the uxio/pla-1544-safe-eth-py-robustness-fixes branch from e48c4d0 to 09e9e37 Compare June 1, 2026 10:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e48c4d0d69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread safe_eth/safe/safe_signature.py Outdated
@Uxio0 Uxio0 merged commit e17aeb9 into main Jun 5, 2026
15 of 18 checks passed
@Uxio0 Uxio0 deleted the uxio/pla-1544-safe-eth-py-robustness-fixes branch June 5, 2026 13:16
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants