Skip to content

refactor(oauth): extract authorize-param validation into src/util#223

Merged
mgoldsborough merged 2 commits into
NimbleBrainInc:mainfrom
Ovaculos:fix/extract-oauth-params-util
May 24, 2026
Merged

refactor(oauth): extract authorize-param validation into src/util#223
mgoldsborough merged 2 commits into
NimbleBrainInc:mainfrom
Ovaculos:fix/extract-oauth-params-util

Conversation

@Ovaculos
Copy link
Copy Markdown
Contributor

Summary

  • Move validateAdditionalAuthorizationParams + RESERVED_AUTHORIZE_PARAMS out of src/tools/workspace-oauth-provider.ts into a new dependency-free src/util/oauth-params.ts.
  • Re-point all consumers (bundles/lifecycle.ts, registries/projection.ts, tools/connector-tools.ts, and the provider's own constructor) at the new module. No re-export — all call sites are in-repo.
  • The registry layer (projection.ts) imported only the validator yet transitively pulled the MCP SDK auth client, the OAuth flow registry, validateBundleUrl, and crypto/fs. The helpers are pure; src/util/ is where pure helpers live (mirrors url.ts).

Pure code move — function body, signature, reserved-key list unchanged. Error-message prefix updated [workspace-oauth-provider][oauth-params] to match the new module.

Closes #198

Test plan

  • New test/unit/oauth-params.test.ts — undefined, empty, non-reserved, every reserved key, OIDC hijack vectors, multi-key error message (6 cases)
  • bun run verify:static — format, lint, tsc, check:cycles, codegen all clean
  • bun run test:unit (246 pass) + bun run test:integration (475 pass, 0 fail)
  • Smoke suite fails locally on a pre-existing Python 3.9 env issue (from datetime import UTC), unrelated to this change

🤖 Generated with Claude Code

Move validateAdditionalAuthorizationParams and RESERVED_AUTHORIZE_PARAMS
out of workspace-oauth-provider.ts into a dependency-free
src/util/oauth-params.ts. The registry layer (projection.ts) imported the
validator only, yet transitively pulled the MCP SDK auth client, the OAuth
flow registry, validateBundleUrl, and crypto/fs. The helpers are pure;
src/util/ is where pure helpers live (mirrors url.ts).

Closes NimbleBrainInc#198
@mgoldsborough mgoldsborough added the qa-reviewed QA review completed with no critical issues label May 23, 2026
Resolve import-ordering conflicts in lifecycle.ts and
workspace-oauth-provider.ts: keep main's new WorkspaceContext /
AutomationDomainContext imports alongside the PR's split of
validateAdditionalAuthorizationParams into src/util/oauth-params.ts.
@mgoldsborough mgoldsborough merged commit 440d632 into NimbleBrainInc:main May 24, 2026
4 checks passed
@Ovaculos Ovaculos deleted the fix/extract-oauth-params-util branch May 24, 2026 22:25
mgoldsborough added a commit that referenced this pull request May 25, 2026
…t conflicts

main advanced 3 commits past the branch point; #223 ("refactor(oauth):
extract authorize-param validation into src/util") moved
`validateAdditionalAuthorizationParams` from `tools/workspace-oauth-provider.ts`
to `util/oauth-params.ts`. Two import conflicts, resolved by usage:

- src/bundles/lifecycle.ts — imports `validateAdditionalAuthorizationParams`
  from the new `util/oauth-params.ts` path and keeps `WorkspaceOAuthProvider`
  (both used). Drops `UserPoolSource` — this branch's T008 removed the
  per-user OAuth pool, so it has zero usages here (main still had it).
- src/tools/connector-tools.ts — drops the conflicted import entirely:
  `validateAdditionalAuthorizationParams` is already imported from
  `util/oauth-params.ts`, and `WorkspaceOAuthProvider` has zero usages in
  this file's refactored form.

Import-only resolution; no behavioral change. verify:static green,
unit 3097 / integration 611, 0 fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qa-reviewed QA review completed with no critical issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move validateAdditionalAuthorizationParams out of workspace-oauth-provider into a util

2 participants