Repository navigation
Test the header MAC byte by byte, and Bech32's two padding rules - #145
Merged
Merged
Conversation
The 2026-11-30 review removed 25 checks one at a time, and three removals left every test green: comparing only 31 of the MAC's 32 bytes, accepting padding bits that are not zero in a Bech32 key, and accepting a whole group of padding. Each now fails a test. The Bech32 tests respell a key with an encoder of their own, since the library's cannot write a non-canonical string; that encoder is held to BIP-173's published vectors and to the library's output first.
The macOS job failed in "Install rage" with tar's "Unrecognized archive format": the download had failed, and curl without --fail passes the error page on to tar. The same URL served the archive a minute later. The six downloads now fail on an HTTP error and retry three times.
The Windows job failed in "Install rage" as the macOS job had: GitHub's release download answered "618 jwt:expired" from its cache. curl's --retry alone does not retry a status like that, and Invoke-WebRequest did not retry at all. Every download now retries five times on any error. The curl ones write to a file that tar then reads, so a retry cannot follow half an archive down a pipe.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
==========================================
+ Coverage 97.48% 97.60% +0.11%
==========================================
Files 75 75
Lines 5001 5001
Branches 688 688
==========================================
+ Hits 4875 4881 +6
+ Misses 76 73 -3
+ Partials 50 47 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Tests, and a fix to CI's downloads. The 2026-11-30 review removed 25 security checks one at a time; three removals left both suites green. Each now fails a test.
Age/Format/Header.cs:91HeaderMacTests.AFileWithOneByteOfItsMacChanged_FailsAuthentication(31)Age/Crypto/Bech32.cs:207Bech32Tests.PaddingBitsThatAreNotZero_AreRejected(3 cases)Age/Crypto/Bech32.cs:204Bech32Tests.AWholeGroupOfPadding_IsRejectedChecked
dotnet testanddotnet test -c Release -p:ForcePortableAead=true -p:TreatWarningsAsErrors=true: 1,176 vectors and 1,636 unit tests pass.CI downloads
Two runs of this PR failed in "Install rage", on macOS and then on Windows: GitHub's release download answered
618 jwt:expired. In.github/workflows/test.ymlevery age and rage download now retries five times on any error. Thecurlones write to a file thattarthen reads, instead of piping into it.