Skip to content

fix(wallet): reject keystore names that escape the keystore directory - #16237

Merged
mablr merged 1 commit into
foundry-rs:masterfrom
SashaMIT:fix/keystore-account-name-single-segment
Aug 19, 2026
Merged

fix(wallet): reject keystore names that escape the keystore directory#16237
mablr merged 1 commit into
foundry-rs:masterfrom
SashaMIT:fix/keystore-account-name-single-segment

Conversation

@SashaMIT

Copy link
Copy Markdown
Contributor

cast wallet import, new, remove, decrypt-keystore, and change-password join ACCOUNT_NAME onto the keystore directory. Names such as ../name and nested/alias therefore write, delete, or decrypt a file outside that directory. The directory itself is already a separate flag (--keystore-dir / cast wallet new <DIR>).

This rejects names that are not a single path segment, next to the existing reserved .touchid suffix check. Ordinary names such as dev and testAccount still work.

This PR was written with AI assistance (Cursor agent). I reviewed the defect, the guard, and the tests.

cast wallet import/new/remove/decrypt/change-password joined ACCOUNT_NAME
onto the keystore directory, so ../name wrote or touched files outside it.
The directory is already a separate flag. Reject names that are not a
single path segment.
@github-actions

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

@mablr
mablr merged commit 66cb818 into foundry-rs:master Aug 19, 2026
42 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Aug 19, 2026
@SashaMIT

Copy link
Copy Markdown
Contributor Author

Thanks for the review and the merge.

SashaMIT added a commit to SashaMIT/oss-contributions that referenced this pull request Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants