Repository navigation
Fix an open redirect and update vulnerable dependencies - #27
Merged
Merged
Conversation
/logg-inn checked the redirect target as a string, so "/<tab>/evil.example" got through: browsers drop the tab and follow it to //evil.example. The target is now resolved with the URL parser, as a browser would, and must be on the same origin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Next.js 16.3.3 has two unauthenticated remote code execution vulnerabilities, among others; 16.4.3 fixes them. sharp, undici and DOMPurify come in through Astro and Payload at vulnerable versions, so pnpm overrides lift them to fixed ones until those packages do. The admin list view e2e test now allows the query the list view may add to the URL once loaded, which made it flaky. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes the two most urgent findings from a security review of the login (#23).
Open redirect after password login
/logg-inn?redirect=%2F%09%2Fevil.examplesent someone who logged in with a password tohttp://evil.example/.Cause: the check rejected
//and\, but not a tab. Browsers drop tabs and newlines from aLocationheader, so/<tab>/evil.exampleturns into//evil.example.Fix: the target is now resolved with the URL parser, as a browser would resolve it, and must be on the same origin. Only its path, query and fragment are used.
Tests: added cases for tabs, newlines, backslashes and
javascript:, plus same-site targets.The Entra ID path in the CMS (
safeRedirectinsrc/cms/src/auth/oidc.ts) wasn't affected, because it already compared origins afternew URL().Vulnerable dependencies
pnpm audit --prodwent from 4 critical, 10 high to 0 critical, 2 high.next(+eslint-config-next)use cache), RCE innext/og, SSRF, DoSsharpundici(viapayload)dompurify(via the admin panel's Monaco editor)The overrides are in
pnpm-workspace.yaml. Remove each one once Payload or Astro depends on a fixed version itself.Left as they are:
happy-dom(2 high): it comes from Payload's rich text package and is only used when converting HTML to Lexical, which Saman doesn't do. The fix is a major version (21), so I'm waiting for Payload to update it rather than forcing it.esbuild(moderate), viadrizzle-kit: only a problem for esbuild's own dev server, which isn't used.deepmerge(low).Other
?depth=1&limit=10after loading, which made the test fail intermittently after the upgrade.Tests
pnpm lint: no errors or warnings.pnpm test: CMS 28 passed, web 15 passed.pnpm test:e2e: 9 passed.pnpm --filter cms buildsucceeds on Next.js 16.4.3.🤖 Generated with Claude Code