fix(deps): drop @openauthjs/openauth and clear all audit advisories - #229
Merged
Conversation
`npm run audit:ci` was failing, with three advisories reaching consumers
(`npm audit --omit=dev`). All three are now gone; the gate reports 0.
`@openauthjs/openauth` was in the production dependency tree for exactly one
function - `generatePKCE`, used once in `createAuthorizationFlow` - and it
declared `hono` as a peer dependency. That is the only reason `hono` was a
direct dependency and an override here: nothing imports it. Between them they
carried the two hono advisories (ReDoS in CORS middleware, plus the same
advisory reached through openauth), which could not be cleared while the
package stayed.
PKCE generation now lives in `lib/auth/auth.ts`, with semantics preserved
exactly:
- 64 random bytes, base64url-encoded, giving an 86-character verifier
(RFC 7636 allows 43-128).
- challenge = base64url(SHA-256(ASCII(verifier))).
- Both encoders emit unpadded base64url, so the wire format is unchanged.
- The upstream helper also returned `method: "S256"`. Nothing read it:
`PKCEPair` is `{ challenge, verifier }` and the authorize request already
hardcodes `code_challenge_method=S256`. The `as PKCEPair` cast the old
call site needed is gone with it.
Removing it takes 11 packages out of the tree: @openauthjs/openauth, its
dependencies (@standard-schema/spec, aws4fetch, jose), its peers (arctic,
hono), and the @oslojs/* chain those pulled in.
Two remaining advisories were unblocked by upstream releases rather than by
this repo:
- `brace-expansion` (high, reached via @opentui/solid -> babel-plugin-
module-resolver -> glob@9 -> minimatch@9). Previously assessed as
upstream-only, since even @opentui/solid@0.5.1 still pins
babel-plugin-module-resolver 5.0.2. That assessment is out of date:
brace-expansion shipped the fix itself in 5.0.9. The existing `^5.0.8`
override allowed it but the lockfile had 5.0.8 pinned; the override is
now `^5.0.9`.
- `nanoid` (high, dev-only, via vitest -> vite -> postcss). This was
previously masked because `audit:prod` failed first and short-circuited
the gate. Overridden to ^3.3.18, which satisfies postcss's own range.
Test coverage: the existing PKCE assertions checked shape and uniqueness,
both of which pass for a challenge that is not derived from the verifier at
all - the server would reject the exchange and nothing would catch it. The
derivation is now pinned, recomputed through `createHash` rather than the
`webcrypto.subtle` path the implementation uses, so the two would have to
break identically to agree. Verified by breaking the hashed input and
confirming the test fails.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
📝 WalkthroughWalkthroughThe authorization flow now uses a local Web Crypto PKCE generator. Runtime dependencies and package overrides were updated. Tests verify the PKCE challenge derivation and RFC 7636 constraints. ChangesLocal PKCE generation
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
npm run audit:ciwas failing, with three advisories reaching consumers (npm audit --omit=dev). All three are gone — the gate now reports 0 vulnerabilities.The root cause was one function
@openauthjs/openauthsat in the production tree for exactly one thing —generatePKCE, called once increateAuthorizationFlow— and it declareshonoas a peer dependency. That is the only reasonhonowas a direct dependency and an override here; nothing in this codebase imports it. Between them they carried both hono advisories, which could not be cleared while the package stayed.This is the same removal @sussdorff is making in the sibling repo (ndycode/codex-multi-auth#661), applied here where it also happens to be a security fix.
11 packages leave the tree:
@openauthjs/openauth, its dependencies (@standard-schema/spec,aws4fetch,jose), its peers (arctic,hono), and the@oslojs/*chain those pulled in.PKCE semantics are preserved exactly
Now inline in
lib/auth/auth.ts:challenge = base64url(SHA-256(ASCII(verifier))).method: "S256". Nothing read it —PKCEPairis{ challenge, verifier }and the authorize request already hardcodescode_challenge_method=S256(auth.ts:224). Theas PKCEPaircast the old call site needed goes away with it.Two advisories were unblocked upstream, not by this repo
brace-expansion(high)nanoid(high, dev-only)^3.3.18The
brace-expansionreassessment is worth recording. It's reached via@opentui/solid → babel-plugin-module-resolver → glob@9 → minimatch@9, and even@opentui/solid@0.5.1(latest) still pinsbabel-plugin-module-resolver5.0.2 — so upgrading upstream genuinely doesn't help. But brace-expansion shipped the fix itself in 5.0.9. The existing^5.0.8override already allowed it; the lockfile just had 5.0.8 pinned. Override moved to^5.0.9.nanoidonly became visible onceaudit:prodstopped failing and short-circuiting the gate. It comes viavitest → vite → postcss;^3.3.18satisfies postcss's own range.Tests
The existing PKCE assertions checked shape and uniqueness — both of which pass for a challenge that isn't derived from the verifier at all. That failure mode is silent locally and only surfaces as a rejected token exchange against the real server, which is exactly the kind of thing a dependency swap can introduce.
The derivation is now pinned, recomputed with
createHashrather than thewebcrypto.subtlepath the implementation uses, so the two would have to break identically to agree. Plus conformance checks on the base64url alphabet and the 86/43-character lengths.Verified it discriminates: I changed the implementation to hash the wrong input and confirmed the test fails.
Verification
npm run audit:ci— 0 vulnerabilities (was 3 prod + 1 dev)npm run typecheck— cleannpx eslint lib test --ext .ts— cleannpm test— 117 files, 2964 passed, 1 skipped, 0 failednpm run build— cleanWindows only; Linux/non-root not run.
One caveat on scope: overrides only apply to this repo's install tree, so the
brace-expansionandnanoidentries fix this repo's audit. The@openauthjs/openauth/honoremoval is different — that genuinely leaves the published dependency tree, so it reaches installers.🤖 Generated with Claude Code
Summary by CodeRabbit
Security & Reliability
Maintenance
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
the pr replaces the single openauth pkce dependency with an equivalent node crypto implementation and removes the resulting hono dependency chain.
Confidence Score: 5/5
the pr appears safe to merge, with pkce token safety, concurrent flow isolation, and windows compatibility adequately preserved.
the inlined pkce implementation matches the consumed oauth contract, removed packages have no remaining runtime imports, and the manifest and lockfile changes are synchronized.
Important Files Changed
Sequence Diagram
Reviews (1): Last reviewed commit: "fix(deps): drop @openauthjs/openauth and..." | Re-trigger Greptile
Context used: