Skip to content

chore: integrate adapters repository - #2898

Merged
tada5hi merged 7 commits into
masterfrom
2897-adapters
Mar 13, 2026
Merged

tada5hi merged 7 commits into
masterfrom
2897-adapters

Conversation

@tada5hi

@tada5hi tada5hi commented Mar 12, 2026 •

Copy link
Copy Markdown
Collaborator

resolves #2897

Summary by CodeRabbit

  • New Features

    • HTTP server adapter middleware for token authentication
    • Socket.IO server adapter with token verification
    • Token verification kit with in-memory and Redis cache implementations
  • Documentation

    • Added READMEs, LICENSEs, and changelogs for new packages
  • Tests

    • Unit tests and test utilities for verifier behaviors
  • Chores

    • Release manifest and release-please config updated for three packages
    • .gitignore adjusted to track .claude/skills

@coderabbitai

coderabbitai Bot commented Mar 12, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@tada5hi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 13 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 65556f83-3ea6-4439-bdd4-04d0efe16577

📥 Commits

Reviewing files that changed from the base of the PR and between 6709c6f and bb66fbb.

📒 Files selected for processing (7)
  • packages/server-adapter-http/LICENSE
  • packages/server-adapter-kit/LICENSE
  • packages/server-adapter-kit/src/verifier/cache/redis.ts
  • packages/server-adapter-kit/src/verifier/module.ts
  • packages/server-adapter-kit/src/verifier/types.ts
  • packages/server-adapter-socket-io/LICENSE
  • release-please-config.json
📝 Walkthrough

Walkthrough

Adds three new server adapter packages—@authup/server-adapter-http, @authup/server-adapter-kit, @authup/server-adapter-socket-io—including middleware implementations, a TokenVerifier with caching (memory/redis), package manifests, build configs, docs, and release manifest/registering changes. Also unignores .claude/skills.

Changes

Cohort / File(s) Summary
Release & Config
/.gitignore, /.release-please-manifest.json, /release-please-config.json
Unignore .claude/skills; register three new packages in release manifests and release-please config (version entries added).
HTTP Server Adapter
packages/server-adapter-http/*
New package: package.json, build (rollup), tsconfigs, README, LICENSE, CHANGELOG, editorconfig; exports and src API with createMiddleware (extract token from header/cookie, verify via tokenVerifier) and types.
Server Adapter Kit (core)
packages/server-adapter-kit/*, packages/server-adapter-kit/src/verifier/*
New core package: TokenVerifier (local JWK verification and remote introspection), ITokenVerifier/types, caching interfaces and implementations (MemoryTokenVerifierCache, RedisTokenVerifierCache), rollup/tsconfigs, package metadata, unit tests and test utilities.
Socket.IO Server Adapter
packages/server-adapter-socket-io/*
New package: package.json, build (rollup), tsconfigs, README, LICENSE, CHANGELOG, editorconfig; exports and src API with createMiddleware for Socket.IO handshake token verification and types.
Docs & Boilerplate
packages/server-adapter-*/CHANGELOG.md, LICENSE, README.md, *.editorconfig, tsconfig*.json
Changelogs, Apache-2.0 LICENSE files, READMEs, editorconfig and tsconfig build/config files added across the three packages.
Tests & Test Utils
packages/server-adapter-kit/test/*
Unit tests for verifier, test data (JWK/token), and utilities (faker, response-error) added to validate verifier behavior and caching.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant TokenVerifier
    participant Cache as TokenCache
    participant HttpClient
    participant JWKServer as JWK Server

    Client->>TokenVerifier: verify(token)
    TokenVerifier->>Cache: get(token)
    alt cached
        Cache-->>TokenVerifier: TokenVerificationData
    else not cached
        TokenVerifier->>TokenVerifier: extract header / kid
        TokenVerifier->>HttpClient: GET /.well-known/jwks or /jwks
        HttpClient->>JWKServer: request JWK
        JWKServer-->>HttpClient: JWK
        HttpClient-->>TokenVerifier: JWK
        TokenVerifier->>TokenVerifier: import key & verify JWT
        TokenVerifier->>TokenVerifier: compute expiry
        TokenVerifier->>Cache: set(token, data, ttl)
        Cache-->>TokenVerifier: stored
    end
    TokenVerifier-->>Client: TokenVerificationData
Loading
sequenceDiagram
    participant Client
    participant TokenVerifier
    participant Cache as TokenCache
    participant Remote as IntrospectionServer

    Client->>TokenVerifier: verify(token)
    TokenVerifier->>Cache: get(token)
    alt cached
        Cache-->>TokenVerifier: TokenVerificationData
    else not cached
        TokenVerifier->>Remote: POST /introspect (token)
        alt success
            Remote-->>TokenVerifier: introspection data
            TokenVerifier->>TokenVerifier: compute expiry
            TokenVerifier->>Cache: set(token, data, ttl)
            Cache-->>TokenVerifier: stored
        else error
            Remote-->>TokenVerifier: error response
            TokenVerifier->>TokenVerifier: map to JWTError
        end
    end
    TokenVerifier-->>Client: TokenVerificationData | Error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Poem

🐰 New adapters hop, a cheerful sprint,
Tokens checked with a careful glint.
HTTP, Socket, and a verifier bright,
Caches hold secrets safe through the night.
Hooray — the monorepo grows in delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: integrate adapters repository' directly matches the main changeset objective of integrating three new adapter packages into the project.
Linked Issues check ✅ Passed The PR successfully integrates three server adapter packages (http, kit, socket-io) with full configuration, source code, and release metadata as required by issue #2897.
Out of Scope Changes check ✅ Passed All changes are scoped to adding three new server adapter packages and updating release configuration files; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2897-adapters
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

🧹 Nitpick comments (7)
packages/server-adapter-kit/test/utils/faker.ts (1)

30-49: Use the same kid for useJwk() and sign().

packages/server-adapter-kit/src/verifier/module.ts:75-92 resolves keys by header.kid. Here sign() always emits keyId: 'foo', but useJwk() never stamps that kid onto the generated JWK, so any mock that actually honors the requested key id will miss.

Suggested alignment
 export class Faker {
+    protected readonly keyId = 'foo';
+
     protected keyPair: CryptoKeyPair | undefined;
@@
     async useJwk() : Promise<OAuth2JsonWebKey> {
@@
-        this.jwk = (await key.toJWK()) as OAuth2JsonWebKey;
+        this.jwk = {
+            ...(await key.toJWK()) as OAuth2JsonWebKey,
+            kid: this.keyId,
+        };
@@
     async sign(payload: Record<string, any>) {
         const keyPair = await this.useKeyPair();
         return signToken(payload, {
             type: 'rsa',
             key: keyPair.privateKey,
-            keyId: 'foo',
+            keyId: this.keyId,
         });
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-kit/test/utils/faker.ts` around lines 30 - 49, The
JWK returned by useJwk() and the keyId used in sign() must match so header.kid
resolves; update the implementation to use a single kid value (or derive it from
the key pair) and ensure useJwk() sets that kid on the generated
OAuth2JsonWebKey (this.jwk.kid) and sign() uses the same kid when calling
signToken (referencing the useJwk and sign functions / keyId handling so both
produce the identical kid).
packages/server-adapter-kit/test/unit/verifier.spec.ts (1)

30-90: Add regression coverage for revoked and nearly expired tokens.

The current suite only checks malformed-token failures, so it would miss both an active: false introspection response and a cache entry whose TTL outlives the token's remaining validity. Please add explicit cases for those two paths.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-kit/test/unit/verifier.spec.ts` around lines 30 - 90,
Add two unit tests: one that simulates an introspection response with active:
false to ensure TokenVerifier.verify throws a JWTError for a revoked token (use
TokenVerifier with a creator or mocked response returning { active: false } and
assert verify(token) rejects as JWTError); and another that simulates a cached
verification whose cache TTL outlives the token's remaining validity by
inserting a cached entry via MemoryTokenVerifierCache.set (or constructing the
cache entry manually) with an expiry timestamp very near/earlier than now while
the cache TTL is longer, then call TokenVerifier.verify(token) and assert it
does not accept the stale token (throws JWTError), using the same
TokenVerifier.verify, MemoryTokenVerifierCache, and creator where appropriate to
trigger revalidation.
packages/server-adapter-socket-io/README.md (1)

7-7: Update description to match package purpose.

Consider updating the description to be consistent with the naming convention and clearer about the package's role.

📝 Suggested description update
-A socket.io plugin for authup.
+A Socket.IO server adapter for Authup authentication.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-socket-io/README.md` at line 7, Update the one-line
description in README.md so it matches the package name and purpose: replace "A
socket.io plugin for authup." with a clearer statement referencing the package
identifier server-adapter-socket-io and describing its role (e.g., "Socket.IO
adapter for AuthUp server integration" or similar) so it follows the repo naming
convention and clearly communicates that this package adapts AuthUp server
auth/events to Socket.IO.
packages/server-adapter-kit/LICENSE (1)

189-189: Consider updating the copyright year range.

The copyright year ends at 2024. Since the code is being actively developed and integrated, consider updating to 2021-2026 or confirming this is intentional.

📝 Suggested update
-   Copyright 2021-2024 Peter Placzek
+   Copyright 2021-2026 Peter Placzek
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-kit/LICENSE` at line 189, Update the copyright year
range in the LICENSE entry that currently reads "Copyright 2021-2024 Peter
Placzek" to the correct end year (e.g., "Copyright 2021-2026 Peter Placzek") or
confirm and leave as-is; locate and edit the exact line string "Copyright
2021-2024 Peter Placzek" in the LICENSE file to reflect the intended year range.
packages/server-adapter-http/rollup.config.mjs (1)

14-16: Remove unnecessary ioredis external declaration.

The package does not import or depend on ioredis (verified by searching the source and checking package.json). This declaration appears to be copy-paste from another adapter configuration and can be safely removed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-http/rollup.config.mjs` around lines 14 - 16, Remove
the unnecessary external declaration for "ioredis" from the rollup config's
external array: locate the external: [...] block in rollup.config.mjs and delete
the 'ioredis' entry so the bundle configuration only lists actually used
externals; ensure no other references to 'ioredis' remain in the file after the
change.
packages/server-adapter-http/package.json (1)

37-45: Update the published repository metadata to the monorepo.

These fields still point at authup/adapters and packages/server-http, so npm/source links will resolve to the old repo and the wrong directory after this integration.

Proposed fix
     "repository": {
         "type": "git",
-        "url": "git+https://github.com/authup/adapters.git",
-        "directory": "packages/server-http"
+        "url": "git+https://github.com/authup/authup.git",
+        "directory": "packages/server-adapter-http"
     },
     "bugs": {
-        "url": "https://github.com/authup/adapters/issues"
+        "url": "https://github.com/authup/authup/issues"
     },
-    "homepage": "https://github.com/authup/adapters#readme",
+    "homepage": "https://github.com/authup/authup#readme",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-http/package.json` around lines 37 - 45, Update the
package.json metadata so links point to the new monorepo and correct package
directory: replace repository.url with the monorepo git URL, set
repository.directory to "packages/server-adapter-http", update bugs.url to the
monorepo issues URL, and change homepage to the monorepo README URL; modify the
existing keys (repository, bugs, homepage) in package.json to these new values
so npm/source links resolve to the correct repo and package location.
packages/server-adapter-socket-io/package.json (1)

37-45: Point the package metadata at the integrated repo and renamed directory.

repository, bugs, and homepage still reference the old adapters repo, and packages/server-socket-io no longer matches this package’s location.

Proposed fix
     "repository": {
         "type": "git",
-        "url": "git+https://github.com/authup/adapters.git",
-        "directory": "packages/server-socket-io"
+        "url": "git+https://github.com/authup/authup.git",
+        "directory": "packages/server-adapter-socket-io"
     },
     "bugs": {
-        "url": "https://github.com/authup/adapters/issues"
+        "url": "https://github.com/authup/authup/issues"
     },
-    "homepage": "https://github.com/authup/adapters#readme",
+    "homepage": "https://github.com/authup/authup#readme",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-socket-io/package.json` around lines 37 - 45, Update
the package.json metadata entries so they point to the integrated repository and
the package's current directory: change the "repository.url" to the correct
monorepo URL, set "repository.directory" to the package's actual path (not
"packages/server-socket-io"), and update "bugs.url" and "homepage" to the
integrated repo's issue tracker and readme URL respectively; ensure the
"repository.type" remains "git" and values are valid URLs for npm metadata
consumers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/server-adapter-http/CHANGELOG.md`:
- Line 27: Fix the two typos in the changelog by replacing the misspelled word
"epxlicit" with "explicit" (the entry "* epxlicit cache + tokenVerifier
instance") and replacing "form" with "from" at the other changelog entry; update
those exact strings so the published CHANGELOG.md shows the correct user-facing
text.

In `@packages/server-adapter-http/LICENSE`:
- Line 189: Update the copyright year range in the LICENSE line that currently
reads "Copyright 2021-2024 Peter Placzek" to reflect the current year (change to
"Copyright 2021-2026"); locate and modify that exact string in the LICENSE file
so the header reflects ongoing development.

In `@packages/server-adapter-http/src/module.ts`:
- Around line 33-45: The malformed/bearer checks currently throw Errors directly
(using the authorization variable and its parsing logic), which bypasses the
middleware error path; instead create the Error objects for the three failure
cases (malformed header, non-Bearer type, empty token) and pass them into the
Express-style next(error) handler used elsewhere in this module so all auth
parsing failures follow the same next(e) path as token verification errors.
- Around line 38-40: The check that compares the Authorization scheme is
case-sensitive and will reject valid variants like "bearer" or "BEARER"; update
the comparison around the variables type and spaceIndex so the auth-scheme token
is compared case-insensitively (for example compare type.toLowerCase() to
'bearer' or use a case-insensitive match) and keep the existing error path
otherwise so the code using authorization, spaceIndex, and type behaves the same
for valid Bearer variants.

In `@packages/server-adapter-kit/CHANGELOG.md`:
- Line 20: Typo in the changelog entry: replace the misspelled word "epxlicit"
with "explicit" in the changelog line "* epxlicit cache + tokenVerifier instance
([2a69258]...)" so the entry reads "* explicit cache + tokenVerifier instance
([2a69258]...)" (update the string in CHANGELOG.md where that exact entry
appears).
- Line 64: Correct the typo in the changelog entry by changing "init project
form source" to "init project from source" in the line that contains "* init
project form source
([9bb2008](https://github.com/authup/adapters/commit/9bb20089d4cfce0511789858b49fa5c51eb4b6f2))"
so the wording reads "init project from source" while keeping the existing
commit reference intact.

In `@packages/server-adapter-kit/package.json`:
- Around line 47-55: Update the package.json metadata to point to this monorepo
and package path: change the repository.url to the monorepo repo URL, set
repository.directory to "packages/server-adapter-kit", update bugs.url to the
monorepo issues URL, and update homepage to the monorepo README URL so npm
points to the correct source tree and issue tracker.

In `@packages/server-adapter-kit/src/verifier/cache/types.ts`:
- Around line 10-12: The cache contract currently has an optional TTL parameter
which lets implementations diverge; change the ITokenVerifierCache.set signature
to require seconds: number (i.e., remove the optional flag) so TTL is part of
the shared contract, update any implementation methods referenced by set (e.g.,
the in-memory implementation in memory.ts that multiplies seconds and the Redis
implementation in redis.ts that creates non-expiring entries when seconds is
missing) to accept and apply the required seconds without guards for undefined,
and ensure callers that compute TTL from token iat/exp pass that positive
seconds value when calling ITokenVerifierCache.set (keep get(token: string):
Promise<TokenVerificationData | undefined> and the TokenVerificationData type
unchanged).

In `@packages/server-adapter-kit/src/verifier/module.ts`:
- Around line 137-177: After successful introspection (where payload is set),
verify that payload.active is true and reject inactive responses before
computing TTL or calling getTokenExpiresIn/transform; if payload.active is
false, throw a JWTError (e.g., with ErrorCode.JWT_INVALID and an appropriate
status/message) so inactive tokens are not cached or treated as
authenticated—insert this check between the payload assignment and the calls to
this.getTokenExpiresIn(payload) and this.transform(payload).
- Around line 193-208: The getTokenExpiresIn function currently returns the
original token lifetime (payload.exp - payload.iat); change it to compute
remaining lifetime by subtracting the current Unix time from payload.exp (e.g.,
payload.exp - Math.floor(Date.now()/1000)) so the cache TTL reflects time left
until expiry; keep the existing checks for payload.exp and payload.iat, throw
JWTError.expired() if the computed remaining seconds <= 0, and return the
remaining seconds as an integer. Reference: getTokenExpiresIn and
OAuth2TokenPayload.

In `@packages/server-adapter-kit/test/data/token.ts`:
- Line 30: The fixture contains a personal-looking address in the email property
(email: '[email protected]'); replace that value with a reserved test
address such as [email protected] (or another example/placeholder test value) in
the token fixture object so no PII is committed.
- Around line 14-43: The fixture TokenPayload and its use in introspectToken are
missing iat and exp so getTokenExpiresIn(...) in the verifier will throw; change
the TokenPayload declaration to include both iat and exp (remove the Omit<...,
'exp'> and/or use the full OAuth2TokenIntrospectionResponse type) and populate
iat (e.g. issued-at epoch seconds) and exp (expiry epoch seconds > iat) with
reasonable test values before casting/returning it from introspectToken so the
default branch returns a valid, cacheable token response for the verifier; keep
the symbol names TokenPayload and introspectToken unchanged.

In `@packages/server-adapter-socket-io/CHANGELOG.md`:
- Line 27: Update the release notes to fix typos: replace the misspelled word
"epxlicit" with "explicit" in the entry that contains "epxlicit cache +
tokenVerifier instance" and replace "form" with "from" wherever the entry uses
"form" (the user-visible changelog lines referenced); ensure both corrected
strings are saved in CHANGELOG.md so the published changelog shows "explicit
cache + tokenVerifier instance" and the correct "from" wording.

In `@packages/server-adapter-socket-io/LICENSE`:
- Line 189: Update the copyright year range in the LICENSE file: locate the line
containing "Copyright 2021-2024 Peter Placzek" and change the end year to 2026
so it reads "Copyright 2021-2026 Peter Placzek"; save the LICENSE file and
include the change in the PR.

In `@packages/server-adapter-socket-io/README.md`:
- Around line 1-5: The README uses the wrong package name and badge URLs:
replace occurrences of "@authup/plugin-socket-io" in the title and badges with
the correct package name "@authup/server-adapter-socket-io" and update the badge
links from the "authup/plugins" repo to the "authup/authup" repo (for both npm
badge and GitHub Actions/Snyk badges) so they match the actual package directory
and sibling READMEs; ensure the textual title, npm badge URL, GitHub Actions
badge URL, and Snyk badge URL are all updated consistently.

In `@packages/server-adapter-socket-io/src/module.ts`:
- Around line 19-29: Move the call to context.tokenVerifierHandler(socket, data)
inside the same try block that awaits context.tokenVerifier.verify(token) so any
errors from the handler are caught and forwarded via next(err); remove the outer
undefined widening by declaring data as const (or let) inside the try as type
TokenVerificationData from the verify() result and then call
context.tokenVerifierHandler(socket, data) before returning next(), and in the
catch call next(e as Error) for any thrown errors.
- Around line 13-22: The code currently reads socket.handshake.auth.token and
only checks falsiness; ensure token is a string before calling
context.tokenVerifier.verify by adding an explicit type check (e.g., typeof
token === "string") and return next() when token is missing or not a string;
update the logic around socket.handshake.auth / token and the call to
context.tokenVerifier.verify(token) to only invoke verify with a validated
string to satisfy the verifier contract.

In `@release-please-config.json`:
- Around line 21-23: The linked-versions group is missing the server adapter
packages; update the plugins[1].components array (the components list used for
linked-versions) to include "packages/server-adapter-http",
"packages/server-adapter-kit", and "packages/server-adapter-socket-io" so they
are part of the monorepo's linked-version release cycle; locate the
plugins[1].components entry in release-please-config.json and add those three
package identifiers to that array so they match the top-level packages map.

---

Nitpick comments:
In `@packages/server-adapter-http/package.json`:
- Around line 37-45: Update the package.json metadata so links point to the new
monorepo and correct package directory: replace repository.url with the monorepo
git URL, set repository.directory to "packages/server-adapter-http", update
bugs.url to the monorepo issues URL, and change homepage to the monorepo README
URL; modify the existing keys (repository, bugs, homepage) in package.json to
these new values so npm/source links resolve to the correct repo and package
location.

In `@packages/server-adapter-http/rollup.config.mjs`:
- Around line 14-16: Remove the unnecessary external declaration for "ioredis"
from the rollup config's external array: locate the external: [...] block in
rollup.config.mjs and delete the 'ioredis' entry so the bundle configuration
only lists actually used externals; ensure no other references to 'ioredis'
remain in the file after the change.

In `@packages/server-adapter-kit/LICENSE`:
- Line 189: Update the copyright year range in the LICENSE entry that currently
reads "Copyright 2021-2024 Peter Placzek" to the correct end year (e.g.,
"Copyright 2021-2026 Peter Placzek") or confirm and leave as-is; locate and edit
the exact line string "Copyright 2021-2024 Peter Placzek" in the LICENSE file to
reflect the intended year range.

In `@packages/server-adapter-kit/test/unit/verifier.spec.ts`:
- Around line 30-90: Add two unit tests: one that simulates an introspection
response with active: false to ensure TokenVerifier.verify throws a JWTError for
a revoked token (use TokenVerifier with a creator or mocked response returning {
active: false } and assert verify(token) rejects as JWTError); and another that
simulates a cached verification whose cache TTL outlives the token's remaining
validity by inserting a cached entry via MemoryTokenVerifierCache.set (or
constructing the cache entry manually) with an expiry timestamp very
near/earlier than now while the cache TTL is longer, then call
TokenVerifier.verify(token) and assert it does not accept the stale token
(throws JWTError), using the same TokenVerifier.verify,
MemoryTokenVerifierCache, and creator where appropriate to trigger revalidation.

In `@packages/server-adapter-kit/test/utils/faker.ts`:
- Around line 30-49: The JWK returned by useJwk() and the keyId used in sign()
must match so header.kid resolves; update the implementation to use a single kid
value (or derive it from the key pair) and ensure useJwk() sets that kid on the
generated OAuth2JsonWebKey (this.jwk.kid) and sign() uses the same kid when
calling signToken (referencing the useJwk and sign functions / keyId handling so
both produce the identical kid).

In `@packages/server-adapter-socket-io/package.json`:
- Around line 37-45: Update the package.json metadata entries so they point to
the integrated repository and the package's current directory: change the
"repository.url" to the correct monorepo URL, set "repository.directory" to the
package's actual path (not "packages/server-socket-io"), and update "bugs.url"
and "homepage" to the integrated repo's issue tracker and readme URL
respectively; ensure the "repository.type" remains "git" and values are valid
URLs for npm metadata consumers.

In `@packages/server-adapter-socket-io/README.md`:
- Line 7: Update the one-line description in README.md so it matches the package
name and purpose: replace "A socket.io plugin for authup." with a clearer
statement referencing the package identifier server-adapter-socket-io and
describing its role (e.g., "Socket.IO adapter for AuthUp server integration" or
similar) so it follows the repo naming convention and clearly communicates that
this package adapts AuthUp server auth/events to Socket.IO.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bae5a626-dbab-48c7-a58a-9a1a6949df34

📥 Commits

Reviewing files that changed from the base of the PR and between c49209f and 1f1f6cf.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (48)
  • .agents/skills/update-docs/SKILL.md
  • .gitignore
  • .release-please-manifest.json
  • packages/server-adapter-http/.editorconfig
  • packages/server-adapter-http/CHANGELOG.md
  • packages/server-adapter-http/LICENSE
  • packages/server-adapter-http/README.md
  • packages/server-adapter-http/package.json
  • packages/server-adapter-http/rollup.config.mjs
  • packages/server-adapter-http/src/index.ts
  • packages/server-adapter-http/src/module.ts
  • packages/server-adapter-http/src/types.ts
  • packages/server-adapter-http/tsconfig.build.json
  • packages/server-adapter-http/tsconfig.json
  • packages/server-adapter-kit/.editorconfig
  • packages/server-adapter-kit/CHANGELOG.md
  • packages/server-adapter-kit/LICENSE
  • packages/server-adapter-kit/README.md
  • packages/server-adapter-kit/package.json
  • packages/server-adapter-kit/rollup.config.mjs
  • packages/server-adapter-kit/src/index.ts
  • packages/server-adapter-kit/src/verifier/cache/index.ts
  • packages/server-adapter-kit/src/verifier/cache/memory.ts
  • packages/server-adapter-kit/src/verifier/cache/redis.ts
  • packages/server-adapter-kit/src/verifier/cache/types.ts
  • packages/server-adapter-kit/src/verifier/index.ts
  • packages/server-adapter-kit/src/verifier/module.ts
  • packages/server-adapter-kit/src/verifier/types.ts
  • packages/server-adapter-kit/test/data/jwk.ts
  • packages/server-adapter-kit/test/data/token.ts
  • packages/server-adapter-kit/test/unit/verifier.spec.ts
  • packages/server-adapter-kit/test/utils/faker.ts
  • packages/server-adapter-kit/test/utils/index.ts
  • packages/server-adapter-kit/test/utils/response-error.ts
  • packages/server-adapter-kit/tsconfig.build.json
  • packages/server-adapter-kit/tsconfig.json
  • packages/server-adapter-socket-io/.editorconfig
  • packages/server-adapter-socket-io/CHANGELOG.md
  • packages/server-adapter-socket-io/LICENSE
  • packages/server-adapter-socket-io/README.md
  • packages/server-adapter-socket-io/package.json
  • packages/server-adapter-socket-io/rollup.config.mjs
  • packages/server-adapter-socket-io/src/index.ts
  • packages/server-adapter-socket-io/src/module.ts
  • packages/server-adapter-socket-io/src/types.ts
  • packages/server-adapter-socket-io/tsconfig.build.json
  • packages/server-adapter-socket-io/tsconfig.json
  • release-please-config.json

Comment thread packages/server-adapter-http/LICENSE Resolved
Comment on lines +38 to +40
const type = authorization.substring(0, spaceIndex);
if (type !== 'Bearer') {
throw new Error('Only Bearer tokens are accepted as authentication method.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Under the HTTP authentication specification for the Authorization header, is the auth-scheme token (for example Bearer) case-insensitive? Please cite the relevant standard text.

💡 Result:

Yes. In HTTP Authentication, the auth-scheme token (e.g., Bearer) is case-insensitive.

Relevant standard text:

  • RFC 9110 (HTTP Semantics), §11.1: “It uses a case-insensitive token to identify the authentication scheme: auth-scheme = token.” [1]
  • (Older, obsoleted) RFC 7235, §2.1: “It uses a case-insensitive token … to identify the authentication scheme … auth-scheme = token.” [2]

Therefore, Authorization: bearer ... and Authorization: Bearer ... are equivalent with respect to the scheme token.

Sources: [1] RFC 9110 https://datatracker.ietf.org/doc/html/rfc9110, [2] RFC 7235 https://httpwg.org/specs/rfc7235.html


Use case-insensitive comparison for the Authorization scheme.

Per RFC 9110 §11.1 and RFC 7235 §2.1, the auth-scheme token (e.g., Bearer) must be matched case-insensitively. The current code rejects valid variants like bearer or BEARER because it only accepts the exact spelling Bearer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-http/src/module.ts` around lines 38 - 40, The check
that compares the Authorization scheme is case-sensitive and will reject valid
variants like "bearer" or "BEARER"; update the comparison around the variables
type and spaceIndex so the auth-scheme token is compared case-insensitively (for
example compare type.toLowerCase() to 'bearer' or use a case-insensitive match)
and keep the existing error path otherwise so the code using authorization,
spaceIndex, and type behaves the same for valid Bearer variants.

Comment thread release-please-config.json Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
packages/server-adapter-http/src/module.ts (1)

19-23: ⚠️ Potential issue | 🟠 Major

Handle Bearer scheme parsing case-insensitively and with a strict prefix.

Line 19 and Line 39 currently use case-sensitive checks; this rejects valid scheme variants (bearer, BEARER) and may misclassify cookie values that merely start with "Bearer" but are not "Bearer " prefixed.

Proposed fix
-                if (!cookieToken.startsWith('Bearer')) {
+                if (!/^Bearer\s+/i.test(cookieToken)) {
                     authorization = `Bearer ${cookieToken}`;
                 } else {
                     authorization = cookieToken;
                 }
...
-            if (type !== 'Bearer') {
+            if (type.toLowerCase() !== 'bearer') {
                 throw new Error('Only Bearer tokens are accepted as authentication method.');
             }

Also applies to: 38-40

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-http/src/module.ts` around lines 19 - 23, Update the
Bearer-scheme parsing so it's case-insensitive and only treats values that start
with the scheme plus a space as already-formed. Specifically, where cookieToken
and authorization are handled, replace the current startsWith('Bearer') logic
with a case-insensitive check for the exact prefix 'bearer ' (e.g.
cookieToken.toLowerCase().startsWith('bearer ')); if that is true set
authorization = cookieToken (preserve original casing), otherwise set
authorization = `Bearer ${cookieToken}`. Apply the same change to both
occurrences that manipulate cookieToken/authorization.
🧹 Nitpick comments (1)
packages/server-adapter-socket-io/package.json (1)

1-56: Consider adding socket.io as a peerDependency.

This package is a socket.io server adapter but doesn't declare socket.io as a dependency. Based on the types in src/types.ts (using Socket, Handshake, Next), the package expects consumers to have socket.io installed. Adding it as a peerDependency would make this requirement explicit and help avoid version mismatches.

♻️ Suggested addition
     "dependencies": {
         "@authup/core-kit": "^1.0.0-beta.30",
         "@authup/server-adapter-kit": "^1.0.0-beta.30"
     },
+    "peerDependencies": {
+        "socket.io": "^4.0.0"
+    },
     "devDependencies": {
         "vitest": "^4.0.18"
     },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/server-adapter-socket-io/package.json` around lines 1 - 56, The
package is missing socket.io as a declared peer dependency; update package.json
to add a peerDependencies entry for "socket.io" (specifying a compatible semver
range aligned with the project's supported socket.io versions) so consumers must
provide it, and reference the runtime types used in src/types.ts (Socket,
Handshake, Next) to justify the requirement; ensure you also keep any existing
"dependencies" entries unchanged and adjust package.json export/build scripts
only if needed for publishing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/server-adapter-kit/src/verifier/cache/redis.ts`:
- Around line 32-43: The current buildKey usage exposes raw bearer tokens in
Redis keys via get/set; change buildKey to derive the key from a secure digest
(e.g., HMAC-SHA256 or SHA-256) of the token rather than embedding the token
itself so keys never contain the raw credential; update the buildKey
implementation used by get(token) and set(token, ...) to compute a hex digest
(using a server-side secret for HMAC or a straight SHA-256 if no secret is
available), and ensure any tests/config accept the new deterministic digest
behavior while leaving TokenVerificationData storage in values unchanged.

In `@packages/server-adapter-kit/src/verifier/module.ts`:
- Around line 86-92: The catch block around this.client.getJwk(header.kid) in
module.ts currently maps all failures to JWTError.payloadPropertyInvalid('kid');
change it so only a genuine "key not found" response (e.g., a 404 or explicit
NotFound error from getJwk) is translated to
JWTError.payloadPropertyInvalid('kid'), while transport/timeout/5xx errors from
getJwk are either re-thrown or wrapped in a different error (e.g., an
internal/temporarily-unavailable JWTError) so outages are not misreported as
invalid-kid; specifically inspect the error returned by this.client.getJwk and
branch: if error indicates missing JWK -> throw
JWTError.payloadPropertyInvalid('kid'), else propagate or wrap the original
error instead of collapsing everything into payloadPropertyInvalid.
- Around line 128-132: The current logic short-circuits on this.cache.get(token)
(in the token introspection path) and later stores results until the token's
exp, which causes remote introspection to be effectively cached for the full
token lifetime; change that by introducing a configurable short TTL for remote
introspection (e.g., remoteIntrospectionTTL) and use it when reading/writing the
cache for the remote introspection branch instead of using the token exp or
indefinite caching; locate the cache read at this.cache.get(token) and the store
logic around where the code currently uses exp (the later store block) and
update the store to pass the short TTL (or skip caching by default) and ensure
the get path honors/keys the same TTL-backed entry so
revocations/permission/user-disable changes are respected.

---

Duplicate comments:
In `@packages/server-adapter-http/src/module.ts`:
- Around line 19-23: Update the Bearer-scheme parsing so it's case-insensitive
and only treats values that start with the scheme plus a space as
already-formed. Specifically, where cookieToken and authorization are handled,
replace the current startsWith('Bearer') logic with a case-insensitive check for
the exact prefix 'bearer ' (e.g. cookieToken.toLowerCase().startsWith('bearer
')); if that is true set authorization = cookieToken (preserve original casing),
otherwise set authorization = `Bearer ${cookieToken}`. Apply the same change to
both occurrences that manipulate cookieToken/authorization.

---

Nitpick comments:
In `@packages/server-adapter-socket-io/package.json`:
- Around line 1-56: The package is missing socket.io as a declared peer
dependency; update package.json to add a peerDependencies entry for "socket.io"
(specifying a compatible semver range aligned with the project's supported
socket.io versions) so consumers must provide it, and reference the runtime
types used in src/types.ts (Socket, Handshake, Next) to justify the requirement;
ensure you also keep any existing "dependencies" entries unchanged and adjust
package.json export/build scripts only if needed for publishing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 66f2b0b4-e25a-4f37-881e-7b56ac371fe0

📥 Commits

Reviewing files that changed from the base of the PR and between 1f1f6cf and 6709c6f.

📒 Files selected for processing (13)
  • packages/server-adapter-http/CHANGELOG.md
  • packages/server-adapter-http/package.json
  • packages/server-adapter-http/src/module.ts
  • packages/server-adapter-kit/CHANGELOG.md
  • packages/server-adapter-kit/package.json
  • packages/server-adapter-kit/src/verifier/cache/redis.ts
  • packages/server-adapter-kit/src/verifier/cache/types.ts
  • packages/server-adapter-kit/src/verifier/module.ts
  • packages/server-adapter-kit/test/data/token.ts
  • packages/server-adapter-socket-io/CHANGELOG.md
  • packages/server-adapter-socket-io/README.md
  • packages/server-adapter-socket-io/package.json
  • packages/server-adapter-socket-io/src/module.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/server-adapter-http/package.json
  • packages/server-adapter-kit/test/data/token.ts
  • packages/server-adapter-kit/package.json
  • packages/server-adapter-socket-io/README.md
  • packages/server-adapter-socket-io/src/module.ts
  • packages/server-adapter-kit/CHANGELOG.md
  • packages/server-adapter-socket-io/CHANGELOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Integrate Adapters Repository

1 participant