Repository navigation
Close three security gaps and fix the libSQL paginate test - #61
Merged
Merged
Conversation
Apple sign-in accepted the token's own nonce claim as the nonce, so anyone holding a token could pass the check. Only sha256(rawNonce) is accepted now. onebase upgrade checked a binary against SHA256SUMS from the same release, which says nothing about who built it. It now verifies the release's signed build attestation with sigstore: the signature, the certificate chain, the transparency log entry, and that the release workflow at the release's tag built that exact file. --no-verify skips it; releases before 0.3.0 were never signed and install on their checksum alone. With ONEBASE_SECRET_KEY set, backups encrypted the snapshot but uploaded files as they were. Files are encrypted the same way now, and copies uploaded before the key was set are replaced. The libSQL paginate test inserted 8,194 documents in one mutation, which runs past libsql-server's 5 second transaction limit on a slow machine. It seeds in several mutations now, and that timeout gets a message that says what happened and what to do. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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 changed
Apple sign-in nonce. The check accepted either
sha256(rawNonce)or the token's nonce claim itself. The second made it prove nothing: anyone holding a token can read the claim out of it and send that. Only the hash is accepted now, which is whatdocs/auth.mdalready tells apps to do.onebase upgradeverifies who built the binary.SHA256SUMSsits in the same release as the binary, so it only catches a damaged download. The upgrade now fetches the release's build attestation from GitHub and verifies it withsigstore: the signature, the certificate chain, the transparency log entry, and that the certificate was issued to.github/workflows/release.ymlat the release's tag, for that exact file.--no-verifyskips the check, for machines that can't reach Sigstore or GitHub's API.Uploaded files in backups are encrypted. With
ONEBASE_SECRET_KEYset, only the snapshot was encrypted. Files are now stored asfiles/<id>.encin the same format, and copies uploaded before the key was set are replaced on the next backup. Restore needs the key, and writes a file under a temporary name until it has decrypted whole.libSQL paginate test. "clients can't ask paginate() for unbounded pages" inserted 8,194 documents in one mutation. libsql-server ends a transaction after 5 seconds, and over the network each insert is a round trip (6.7 s locally). The test seeds in chunks of 1,024 now. The driver also turns the raw
TRANSACTION_TIMEOUTinto a message that explains the limit.For the reviewer
sigstore(the package npm uses), bundled into the binary. 53 transitive packages, about 1 MB added to the binary. Chosen over a hand-written verifier because Sigstore rotates its keys, and pinned keys would eventually breakonebase upgrade.Testing
bun teston SQLite: 579 pass, 3 skipped, 0 fail.tests/engine.test.tson libSQL (libsql-server in Docker): 34 pass. Not run on Postgres or MySQL locally.🤖 Generated with Claude Code