Skip to content

fix(oauth): allow client secrets shorter than 8 characters#3283

Open
Jatlus wants to merge 1 commit into
MCPJam:mainfrom
Jatlus:Inspector-denies-my-client-secret-because-its-shorter-than-8-characters-#1723
Open

fix(oauth): allow client secrets shorter than 8 characters#3283
Jatlus wants to merge 1 commit into
MCPJam:mainfrom
Jatlus:Inspector-denies-my-client-secret-because-its-shorter-than-8-characters-#1723

Conversation

@Jatlus

@Jatlus Jatlus commented Jul 17, 2026

Copy link
Copy Markdown

Summary

Fixes #1723.

validateClientSecret rejected any non-empty client secret shorter than 8 characters, even though nothing about a short secret is actually invalid. The OAuth spec doesn't mandate a minimum length, and the value is issued by the identity provider, not chosen in the Inspector. Server-side validation (server/routes/v1/oauth.ts, server/routes/mcp/xaa.ts) only ever required the secret be non-empty (min(1)).

Fix

validateClientSecret now only rejects a secret that's present but trims to nothing (whitespace-only). This matches the server-side contract exactly. Any non-empty, non-whitespace value is accepted regardless of length.

Testing

mcpjam-inspector/client/src/components/connection/hooks/__tests__/use-server-form.test.ts — new describe("validateClientSecret") block:

  • "allows an empty client secret (public/PKCE client)"
  • "rejects a whitespace-only client secret"
  • "allows a single-character client secret"
  • "allows the reported repro value ('banana', 6 characters)"
  • "still allows client secrets 8+ characters long"
  • "does not affect validateClientId's own minimum-length rule", confirming this fix is scoped to the secret, not the separate client ID minimum.

44/44 passing on the affected test file. Manually verified the inline "Client Secret must be at least 8 characters if provided" error no longer appears when typing a short secret like banana.


Summary by cubic

Accepts OAuth client secrets shorter than 8 characters by aligning client-side validation with the server’s rules. Resolves Linear #1723 where the Inspector blocked valid, short secrets.

  • Bug Fixes
    • validateClientSecret now only rejects secrets that trim to empty; empty is allowed for public/PKCE clients; updated message to “Client Secret cannot be only whitespace.”
    • Added tests for empty, whitespace-only, 1-char, 6-char (“banana”), and 8+ char secrets, plus a check that the client ID minimum remains unchanged.

Written for commit fdec12f. Summary will update on new commits.

Review in cubic

validateClientSecret rejected any non-empty client secret under 8
characters, even though the OAuth spec doesn't mandate a minimum
length and the value is issued by the authorization server, not
chosen here. Server-side validation only requires the secret be
non-empty. The client-side check now matches that contract: it only
rejects a secret that's present but trims to nothing.

Fixes MCPJam#1723
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Jul 17, 2026
@chelojimenez

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c00a7ae-74a7-45f0-a2d4-c4051df00ad9

📥 Commits

Reviewing files that changed from the base of the PR and between 9683711 and fdec12f.

📒 Files selected for processing (2)
  • mcpjam-inspector/client/src/components/connection/hooks/__tests__/use-server-form.test.ts
  • mcpjam-inspector/client/src/components/connection/hooks/use-server-form.ts

Walkthrough

Updated validateClientSecret to reject only whitespace-only values while accepting empty, short, and longer non-whitespace secrets. Added tests covering these cases and confirming that client ID minimum-length validation remains unchanged.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

mcpjam-inspector/client/src/components/connection/hooks/__tests__/use-server-form.test.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: ESLint configuration in --config is invalid:

  • Unexpected top-level property "__esModule".

    at ConfigValidator.validateConfigSchema (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2177:19)
    at ConfigArrayFactory._normalizeConfigData (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3019:19)
    at ConfigArrayFactory._loadConfigData (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2984:21)
    at ConfigArrayFactory.loadFile (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2850:40)
    at createCLIConfigArray (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3660:35)
    at new CascadingConfigArrayFactory (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3735:29)
    at new CLIEngine (/soundcheck/node_modules/eslint/lib/cli-engine/cli-engine.js:617:36)
    at new ESLint (/soundcheck/node_modules/eslint/lib/eslint/eslint.js:430:27)
    at Object.execute (/soundcheck/node_modules/eslint/lib/cli.js:410:24)
    at async main (/soundcheck/node_modules/eslint/bin/eslint.js:152:22)

mcpjam-inspector/client/src/components/connection/hooks/use-server-form.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: ESLint configuration in --config is invalid:

  • Unexpected top-level property "__esModule".

    at ConfigValidator.validateConfigSchema (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2177:19)
    at ConfigArrayFactory._normalizeConfigData (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3019:19)
    at ConfigArrayFactory._loadConfigData (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2984:21)
    at ConfigArrayFactory.loadFile (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2850:40)
    at createCLIConfigArray (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3660:35)
    at new CascadingConfigArrayFactory (/soundcheck/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3735:29)
    at new CLIEngine (/soundcheck/node_modules/eslint/lib/cli-engine/cli-engine.js:617:36)
    at new ESLint (/soundcheck/node_modules/eslint/lib/eslint/eslint.js:430:27)
    at Object.execute (/soundcheck/node_modules/eslint/lib/cli.js:410:24)
    at async main (/soundcheck/node_modules/eslint/bin/eslint.js:152:22)


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.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 2 files

Re-trigger cubic

@ignaciojimenezr

Copy link
Copy Markdown
Collaborator

Hey @Jatlus , thanks for the PR! While reviewing it, I noticed that we trim leading and trailing whitespace from client secrets. For example, " secret " gets saved as "secret", which changes the secret and could cause authentication to fail.

You didn’t introduce this behavior, but since you’re already working in this area, could you please fix this issue as well?

@ignaciojimenezr ignaciojimenezr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey @Jatlus , thanks for the PR! While reviewing it, I noticed that we trim leading and trailing whitespace from client secrets. For example, " secret " gets saved as "secret", which changes the secret and could cause authentication to fail.

You didn’t introduce this behavior, but since you’re already working in this area, could you please fix this issue as well?

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

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Inspector denies my client secret because its shorter than 8 characters

3 participants