Repository navigation
fix(authz): harden PLATFORM_AUTHZ_TIMEOUT_MS parse (empty/typo → deny-all self-DoS) - #4
Merged
Merged
Conversation
…nger deny-all `Number(process.env.PLATFORM_AUTHZ_TIMEOUT_MS ?? default)` parsed `''` -> 0 and `'abc'` -> NaN, either of which fires the AbortController immediately so every PEP->platform authz call aborts and this fail-closed client denies ALL access (a self-inflicted outage from an empty IaC-templated value). Add `sanitizeAuthzTimeoutMs` (fallback on non-finite/<=0, clamp to [250, 60000] ms) mirroring the platform's `config.sanitizeTimeoutMs`, with a regression test. Part of cccvu/wiki-v2 issue 14 (production config fail-fast). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This was referenced Sep 2, 2026
PMQ9
added a commit
that referenced
this pull request
Sep 16, 2026
Takes docmost#319 (magic-link token in the URL fragment + ResponseHeadersModule) and docmost#320 (raw transport evidence with audit events). The one conflict is app.module.ts seam #4, where both sides registered a CCC module next to CollabDisconnectModule; both are kept (ConditionalPageModule adds a controller, ResponseHeadersModule a global response hook, so order is immaterial). The import-boundary spec's seam #4 comment now names ConditionalPageModule alongside the modules docmost#319 listed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Sep 16, 2026
PMQ9
added a commit
that referenced
this pull request
Sep 19, 2026
…at the platform (docmost#310) CI's fork boot smokes caught that the NODE_ENV-gated posture + boot validator refused to boot legitimate http deployments: the documented standalone self-host (native, NODE_ENV=production required for migrations/start:prod, APP_URL=http:// localhost:3000) and both fork CI smokes (the contract smoke boots a remote fork over http and carries a plain cookie across its native->remote flip). Upstream Docmost derives cookie Secure from isHttps() precisely so http self-hosting works. - Posture now gated on isHttps() (restores upstream's `secure: isHttps()` and adds the __Host- prefix over https). Name + secure share the one isHttps() authority, so prefix<=>Secure still holds by construction. Over http -> plain authToken. - Remove the fork boot validator (validate-cookie-posture.ts + session-cookie.module.ts + app.module seam #4 addition): a fork boot check cannot tell the CCC https deployment from a legitimate http self-host/CI config (all are NODE_ENV=production). - Fail-closed protection for the CCC deployment moves to the PLATFORM (super repo): it authoritatively knows it is production and observes the fork's real Set-Cookie, so it rejects a non-__Host- fork session cookie in production posture. - Reword seam comments + service-bridge OpenAPI ("in production" -> "over https"). Fork server jest (session-cookie/route-guard/ws/service-bridge, 33 suites) green; tsc clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This was referenced Sep 20, 2026
10 tasks done
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 this does
Hardens the CCC authz client's per-request timeout parse in
apps/server/src/authz/platform-authz.client.ts.Number(process.env.PLATFORM_AUTHZ_TIMEOUT_MS ?? DEFAULT_TIMEOUT_MS)parsed an empty string to0and anon-numeric string to
NaN. Either makes theAbortControllerfire immediately, so every PEP→platformauthz call aborts → this fail-closed client returns null → denies all access. An empty value is easy to
produce from IaC templating an unset env var, so this was a latent self-inflicted deny-all outage.
Adds
sanitizeAuthzTimeoutMs(raw, fallback)— falls back on any non-finite /<= 0value and clamps to[250, 60000]ms — mirroring the platform's ownconfig.sanitizeTimeoutMs. Duplicated here because the forkcannot import platform code across the submodule boundary. Includes a regression test in
platform-authz.client.spec.ts(runs in thedocmost-authzCI job).Why
Part of cccvu/wiki-v2 issue 14 (production configuration fail-fast). Surfaced by that issue's repo-wide
config-hazard audit as the one fork-side instance of the same "unsafe default parsing" pattern.
Testing
sanitizeAuthzTimeoutMsunit cases:undefined/''/'abc'/'-10'/'0'→ fallback (never 0/NaN);'1'→ 250 (clamp floor);'600000'→ 60000 (clamp cap);'2000'→ passthrough.Risk & rollback
Low. Pure hardening of one field parse; no signature/behavior change on valid input. Revert the single commit
to roll back.
🤖 Generated with Claude Code