Skip to content

fix(mock-oauth2-provider): resolve CodeQL prototype pollution and open redirect - #11810

Open
raymondfeng wants to merge 3 commits into
masterfrom
fix/mock-oauth2-codeql
Open

raymondfeng wants to merge 3 commits into
masterfrom
fix/mock-oauth2-codeql

Conversation

@raymondfeng

Copy link
Copy Markdown
Contributor

Resolves two CodeQL findings in the mock-oauth2-provider test fixture. Split out of #11793.

  • Prototype pollution (js/prototype-polluting-assignment): registered apps and issued tokens were plain objects keyed by request values, so a __proto__ key reached Object.prototype. They are Maps now.
  • Open redirect (js/server-side-unvalidated-url-redirection): redirect_uri is parsed and restricted to loopback hosts, since this provider only serves test applications on the same machine. It is validated before a token is issued, so a rejected (400) request no longer leaves a token behind.

The async route handlers are also wrapped so that rejections reach Express instead of becoming unhandled promise rejections. #11793 needs this, because no-misused-promises reports these handlers under TypeScript 6.

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine: the fixture compiles and lints clean, and the full suite was run on feat(build)!: compile with the TypeScript 7 native compiler #11793, which includes this commit
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

🤖 Generated with Claude Code

…n redirect

Registered apps and issued tokens were held in plain objects keyed by values
taken from the request, so a `__proto__` key reached `Object.prototype`. They
are `Map`s now, which also drops the `[key: string]: any` index signature from
the `App` interface (CodeQL js/prototype-polluting-assignment).

`redirect_uri` is validated before a token is issued and the callback url is
built from the parsed `URL` rather than by concatenating the request value. A
real authorization server matches `redirect_uri` against the callback urls
registered for the client; this provider only ever serves test applications
running on the same machine, so it accepts loopback hosts
(CodeQL js/server-side-unvalidated-url-redirection).

The async route handlers are wrapped so that rejections reach Express instead
of becoming unhandled promise rejections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
raymondfeng and others added 2 commits October 1, 2026 22:15
The US Census geocoder now returns slightly different coordinates for the test
address, so `GeoLookupService` and `TodoApplication` tests fail on every
platform, on master as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
The hook that launches puppeteer and loads the page intermittently exceeds
15 seconds on the ubuntu-latest runners. It now gets 30 seconds, the same as
the hook that generates the bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant