Repository navigation
refactor(db): move the SigV4 core to src/lib/db/auth/aws - #2304
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The SigV4 core (signatureV4, amzDateOf, canonicalQueryOf, EMPTY_PAYLOAD_SHA256) and compareEncodedPairs move from the S3 provider to src/lib/db/auth/aws/sigv4.ts, with the key pair typed as AwsSigningKeys. S3 keeps s3Signer, its signing policy, in s3/sigv4.ts over the shared core. Every S3 signature is unchanged: the AWS suite vectors and the s3Signer contract tests pass as before. The auth seam guard adds the SigV4 markers to AUTH6, and the S3 seam guard now refuses node:crypto in every file of the S3 directory.
…3 crypto guard List aws/ on the auth/ line of ARCHITECTURE.md and the SigV4 core among the shared mechanisms in DB_AUTH.md. Say in the S3 fixtures README that the shared SigV4 test reads sigv4-suite.json and why the file stays under s3/. The S3 seam guard now also refuses the bare crypto specifier and require() loads. The shared core's own test covers compareEncodedPairs, so aws/sigv4.ts is fully covered without the S3 tests. Reword the signatureV4 docblock, which still said the export was for the suite vectors.
cevheri
force-pushed
the
refactor/db-auth-aws-sigv4
branch
from
November 15, 2026 04:09
20690e1 to
014a969
Compare
|
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.



Moves the SigV4 core out of the S3 provider into
src/lib/db/auth/aws/sigv4.ts, so the next AWS provider signs with the same tested code instead of a copy.S3 keeps its signing policy (
s3Signer) in its own directory, now over the shared core; every S3 signature is byte for byte what it was.What changes
src/lib/db/auth/aws/sigv4.tsis new:signatureV4,amzDateOf,canonicalQueryOf,EMPTY_PAYLOAD_SHA256andcompareEncodedPairs, moved unchanged froms3/sigv4.tsands3/encoding.ts.The key pair is typed
AwsSigningKeys, structurally the same asS3Credentials.Its docblock states protocol facts only; what Garage and Silo require stays in S3's file.
src/lib/db/providers/objectstore/s3/sigv4.tsholds onlys3Signerand keeps its name, so the client-wire bundle test and row 3.19 ofdocs/SECURITY.mdstill point at it.s3/encoding.tsimportscompareEncodedPairsfrom the core.tests/unit/db/auth/aws/sigv4.test.ts.Each vector's canonical query is now built with the shared
rfc3986QueryandcompareEncodedPairs, not S3'ss3Query.The fixture stays at
tests/fixtures/s3/sigv4-suite.json, which the pinned.gitleaksignoreentry names.tests/unit/db/s3/sigv4.test.tskeeps thes3Signercontract cases.AWS4-HMAC-SHA256andaws4_requestas mechanism markers (AUTH6), with a planted proof, and listsaws/sigv4.tsamong the layer's files; AUTH1 already admitsnode:cryptoin that file alone.node:cryptoandcrypto, imported or loaded withrequire(), in every file of the S3 directory.tests/live/import the core from its new path.docs/DB_AUTH.mdgains an AWS section and the SigV4 markers in its guard list;docs/providers/s3.md(section 2.4 and thesigv4.tsrow of the module table) and the S3 line ofdocs/ARCHITECTURE.mdsay the core is the shared one.The
auth/line ofdocs/ARCHITECTURE.mdlistsaws/, the shared-mechanism list indocs/DB_AUTH.mdnames the SigV4 core, andtests/fixtures/s3/README.mdnames the shared test as the suite's reader.User-visible change
None.
No error sentence, request or header changes.
Test plan
The shared test was run red against the missing module first, and the S3 seam guard red against the old
s3/sigv4.ts.