Repository navigation
Cap the shared Postgres pool and accept retired proof keys - #62
Merged
Merged
Conversation
The API and worker were keeping idle postgres.js connections open on the 1 GiB RDS instance. Each app now passes its own pool default, DB_POOL_MAX overrides it, and idle connections close. Proof verification can try extra SPKI public keys after PROOF_SIGNING_KEY is rotated. Signing is unchanged. Co-authored-by: Odinaka Robert Nnamani <nnamani.odinakarobert@gmail.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.
Summary
Idle Postgres backends on the 1 GiB RDS instance come from the shared client's postgres.js pool. Proof bundles also verify against only the current signing key, so a rotation would reject older proofs.
Configs touched
DB_POOL_MAX: optional positive integer. When set, it replaces the process default. Unset or blank keeps the default. Any other value stops the process at startup withDB_POOL_MAX must be a positive integer.idle_timeout20 seconds andmax_lifetime1800 seconds. The API passes a default max of 5. The worker passes a default max of 3.PROOF_SIGNING_KEY: a real multi-line PKCS8 PEM still works. A single line with literal\nescapes is normalized in the same place the key is read. The value is never logged.PROOF_VERIFY_PUBLIC_KEYS: optional comma-separated SPKI public PEMs (-----BEGIN PUBLIC KEY-----). Each entry may be multi-line or one line with\nescapes. Verification tries the current key, then each extra key. Signing still uses onlyPROOF_SIGNING_KEY. Proofs have no key id.Prod behaviour preserved
max2).ssl,connect_timeout, prepare).PROOF_SIGNING_KEYstill falls back to the dev key. Production still refuses to start without a real Ed25519 key that is not the committed dev key.POST /v1/proof/verifystill ignorespublic_keyon the bundle.PROOF_VERIFY_PUBLIC_KEYS.Proof verification today
public_keyandalgorithm, and the verifier ignores that public key. There is no key id.-----BEGIN PRIVATE KEY-----). It is not RSA.POST /v1/proof/verifyuses the server's keys. Each new proof response includes the current public key. After a rotation, put the old public key inPROOF_VERIFY_PUBLIC_KEYSor older bundles fail that endpoint. Offline checks that use the public key stored on an old bundle are unchanged.