Skip to content

Commit 6ef4f12

Browse files
fix: pass skew protection token down to config (#6797)
1 parent 53fb9a9 commit 6ef4f12

File tree

7 files changed

+20
-0
lines changed

7 files changed

+20
-0
lines changed

packages/build/src/core/build.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const tExecBuild = async function ({
8686
enhancedSecretScan,
8787
edgeFunctionsBootstrapURL,
8888
eventHandlers,
89+
skewProtectionToken,
8990
}) {
9091
const configOpts = getConfigOpts({
9192
config,
@@ -107,6 +108,7 @@ const tExecBuild = async function ({
107108
buildId,
108109
testOpts,
109110
featureFlags,
111+
skewProtectionToken,
110112
})
111113

112114
const {

packages/build/src/core/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const getConfigOpts = function ({
3737
buildId,
3838
testOpts,
3939
featureFlags,
40+
skewProtectionToken,
4041
}) {
4142
return {
4243
config,
@@ -58,6 +59,7 @@ export const getConfigOpts = function ({
5859
env: envOpt,
5960
testOpts,
6061
featureFlags,
62+
skewProtectionToken,
6163
}
6264
}
6365

packages/build/src/log/messages/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const INTERNAL_FLAGS = [
6060
'edgeFunctionsBootstrapURL',
6161
'eventHandlers',
6262
'logger',
63+
'skewProtectionToken',
6364
]
6465
const HIDDEN_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, ...INTERNAL_FLAGS]
6566
const HIDDEN_DEBUG_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, 'eventHandlers', 'logger']
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name: test
2+
inputs: []
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[[plugins]]
2+
package = "./plugin.js"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const onPreBuild = function () {
2+
console.log(JSON.stringify(process.env))
3+
}

packages/build/tests/core/tests.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,14 @@ test('--node-path is not used by core plugins', async (t) => {
356356
t.snapshot(normalizeOutput(output))
357357
})
358358

359+
test('--skew-protection-token', async (t) => {
360+
const output = await new Fixture('./fixtures/plugin_echo_env')
361+
.withFlags({ skewProtectionToken: 'foobar' })
362+
.runWithBuild()
363+
364+
t.true(output.includes(`"NETLIFY_SKEW_PROTECTION_TOKEN":"foobar"`))
365+
})
366+
359367
test('featureFlags can be used programmatically', async (t) => {
360368
const output = await new Fixture('./fixtures/empty')
361369
.withFlags({ featureFlags: { test: true, testTwo: false } })

0 commit comments

Comments
 (0)