Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
a99aaa9c
Unverified
Commit
a99aaa9c
authored
Oct 28, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Oct 28, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle `Origin: null` headers (#85402)
parent
b55e52f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
action-handler.ts
packages/next/src/server/app-render/action-handler.ts
+3
-2
block-cross-site.ts
...ages/next/src/server/lib/router-utils/block-cross-site.ts
+1
-1
app-action-allowed-origins.test.ts
...ctions-allowed-origins/app-action-allowed-origins.test.ts
+13
-0
No files found.
packages/next/src/server/app-render/action-handler.ts
View file @
a99aaa9c
...
...
@@ -551,9 +551,10 @@ export async function handleAction({
// When running actions the default is no-store, you can still `cache: 'force-cache'`
workStore
.
fetchCache
=
'default-no-store'
const
originHeader
=
req
.
headers
[
'origin'
]
const
originDomain
=
typeof
req
.
headers
[
'origin'
]
===
'string
'
?
new
URL
(
req
.
headers
[
'origin'
]
).
host
typeof
originHeader
===
'string'
&&
originHeader
!==
'null
'
?
new
URL
(
originHeader
).
host
:
undefined
const
host
=
parseHostHeader
(
req
.
headers
)
...
...
packages/next/src/server/lib/router-utils/block-cross-site.ts
View file @
a99aaa9c
...
...
@@ -85,7 +85,7 @@ export const blockCrossSite = (
// ensure websocket requests from allowed origin
const
rawOrigin
=
req
.
headers
[
'origin'
]
if
(
rawOrigin
)
{
if
(
rawOrigin
&&
rawOrigin
!==
'null'
)
{
const
parsedOrigin
=
parseUrl
(
rawOrigin
)
if
(
parsedOrigin
)
{
...
...
test/e2e/app-dir/actions-allowed-origins/app-action-allowed-origins.test.ts
View file @
a99aaa9c
...
...
@@ -26,4 +26,17 @@ describe('app-dir action allowed origins', () => {
return
await
browser
.
elementByCss
(
'#res'
).
text
()
},
'hi'
)
})
it
(
'should not crash for requests from privacy sensitive contexts'
,
async
function
()
{
const
res
=
await
next
.
fetch
(
'/'
,
{
method
:
'POST'
,
headers
:
{
Origin
:
'null'
,
'Content-type'
:
'application/x-www-form-urlencoded'
,
'Sec-Fetch-Site'
:
'same-origin'
,
},
})
expect
({
status
:
res
.
status
}).
toEqual
({
status
:
200
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment