Skip to content

fix(keyfile): bound key-file reads with io.LimitReader (Closes #102) - #120

Merged
sgaunet merged 1 commit into
mainfrom
fix/keyfile-size-issue-102
Aug 24, 2026
Merged

sgaunet merged 1 commit into
mainfrom
fix/keyfile-size-issue-102

Conversation

@sgaunet

@sgaunet sgaunet commented Aug 24, 2026

Copy link
Copy Markdown
Owner

No description provided.

- add internal/keyfile.Read, replacing the unbounded os.ReadFile at all
  five key-loading sites in pkg/cryptojwt and pkg/paseto
- reject an oversized file with an explicit error rather than truncating
  it silently, reusing each package's ErrInvalidKey sentinel
- bound size only: non-regular files stay readable, so passing a key via
  process substitution or /dev/stdin keeps working
- cover the bound in unit tests and three venom cases

Closes #102
@sgaunet sgaunet self-assigned this Aug 24, 2026
@sgaunet sgaunet added the bug Something isn't working label Aug 24, 2026
@sgaunet
sgaunet merged commit 5b7d438 into main Aug 24, 2026
4 checks passed
@sgaunet
sgaunet deleted the fix/keyfile-size-issue-102 branch August 24, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant