Repository navigation
fix(server): webhook retries and redirects, env booleans, log and trace privacy, CI pinning - #180
Merged
Merged
Conversation
z.coerce.boolean() turned every non-empty string into true, so OTEL_ENABLED=false enabled tracing and WEBHOOK_REMOVE_ON_FAIL=false was ignored.
The BullMQ worker wrapped a retrying fetch in a 3 second abort and then treated the resulting error as non-retryable, so failed deliveries were dropped. Make one attempt per job run and throw retryable errors so the queue's attempts and backoff apply. Deliveries also no longer follow redirects, and the URL is checked against private addresses again before each delivery.
Request logs paired the client address with the concrete /vault/<id> path, linking who created a secret to who read it. Log the route pattern and drop the address and port.
The rate limiter shares Redis with the vault, so a Redis at maxmemory made every request fail. Skip rate limiting when its store errors, keep internal error messages out of 5xx responses, and document sizing and monitoring REDIS_MAXMEMORY.
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 was wrong
WEBHOOK_MAX_ATTEMPTS/WEBHOOK_BACKOFF_*had no effect.fetchfollowed redirects, so a webhook host could send the server's POST on to an internal address.OTEL_ENABLED=falseturned tracing on (CFYI-CFG-001).z.coerce.boolean()reads every non-empty string as true. The same applied toWEBHOOK_REMOVE_ON_COMPLETE,WEBHOOK_REMOVE_ON_FAILandWEBHOOK_REQUIRE_HTTPS.url.query=h=…, andhtogether with the id is enough to fetch (and burn) a secret./vault/<id>, which the privacy page says the service can't know.maxmemoryevery request returned 500.NPM_TOKENand GHCR write access.What changed
HTTPErrororTimeoutErrorsoisRetryableFetchErrorlets BullMQ's attempts and backoff apply. The nested retry client is gone fromindex.ts; the HTTP sender was effectively single-attempt already and stays that way. Both senders useredirect: 'manual', which treats a 3xx as a failed, non-retryable delivery. Both also re-runassertWebhookUrlAllowed(withWEBHOOK_REQUIRE_HTTPS) before each delivery and drop the job if it fails.envBooleanhelper (zodstringbool, with empty meaning unset) is used for all four boolean env vars. Unrecognised values now fail at startup.redactedQueryParamsServer: ['h']for the HTTP instrumentation. The API is unchanged./vault/:vaultId) with no client address or port.skipOnError: true, and 5xx responses send a genericmsg. The README covers sizing and alerting onREDIS_MAXMEMORY.release.ymlactions are pinned to full commit SHAs, with version comments.patchchangesets.How it was tested
pnpm build,pnpm typecheck,pnpm lint(0 errors; the existing core warning),pnpm format:check: pass.main's code:webhook.test.ts: real BullMQ. A 503 is retried, a timeout is retried, the URL is re-checked before delivery, and a 307 to a second local server is not followed.telemetry.test.ts: a real NodeSDK with an in-memory exporter; the span has nohvalue.logging.test.ts: no vault id, hash or IP in the serialized request.config.test.ts:envBoolean.app.test.ts: a failing rate-limit store still lets a create succeed, and a 500 does not leak its message.pnpm test:e2enot run.For the reviewer
connect.lookup. A DNS failure at delivery now drops the job instead of retrying.url.pathwith the vault id and the client address, so operators who enable tracing hold that linkage. The privacy copy doesn't state a log retention period; that's yours to decide.TRUST_PROXYdoesn't affect them.Left out
NPM_TOKEN, and job-level permissions: these need registry-side setup. Pinningci.yml/desktop.ymlwas skipped because neither holds publish credentials.USER node,pnpm deploy), SC-002 (Dependabot, image pinning): these are policy choices for you to make.