Repository navigation
Fix: stop trimming trailing bytes from binary S4 identity files - #7
Merged
Merged
Conversation
S4Identity.parse trimmed ASCII whitespace from both ends of its input
before reading the header. The binary form ends with a random AES-GCM
tag, so about one file in forty ended in a byte that counts as
whitespace and came back one byte short ("block of type 2 claims 73
bytes but only 72 remain"), which is what made the client identity
specs fail intermittently in CI. Only leading whitespace is skipped
now; the SQRLDATA text form keeps its tolerant trimming. Adds
regression specs for both forms.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LquamEUPHNaNMzZW6tZz8r
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LquamEUPHNaNMzZW6tZz8r
Merged
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.
What
SQRL::S4Identity.parsetrimmed ASCII whitespace from both ends of its input before reading the header. The binarysqrldataform ends with a random AES-GCM tag, so about one file in forty ended in a byte that counts as whitespace (0x09–0x0D, 0x20) and came back one byte short:Only leading whitespace is skipped now; the
SQRLDATAtext form keeps its tolerant trimming (base64url ignores whitespace anyway).Why
This is the cause of the intermittent failures in the
sqrl-clientidentity and CLI specs seen on the CI runs for #6 (Ruby 3.3 and 3.4 jobs on one run, green on the next) and once locally: any spec that writes a freshly created or re-keyed identity file and reads it back hit it whenever the tag's last byte was whitespace.Verification
\nround-trips byte for byte, with and without leading whitespace; the text form still tolerates surrounding whitespace. The first spec fails on the old parser with the exact CI error and passes on the fix.sqrl-core240 examples andsqrl-client66 examples green; RuboCop clean.Changelog
sqrl-coreCHANGELOG gains an Unreleased entry; this warrants a 0.1.2 patch release ofsqrl-core(the other gems are unaffected but move in lockstep).Generated by Claude Code