removed equal sign from env buffer, added defensive guard against the key (#62)
* removed equal sign from env buffer, added defensive guard against the key * Update packages/k8s/src/k8s/utils.ts Co-authored-by: John Sudol <[email protected]> * Update packages/k8s/src/k8s/utils.ts Co-authored-by: Ferenc Hammerl <[email protected]> * fix format --------- Co-authored-by: John Sudol <[email protected]> Co-authored-by: Ferenc Hammerl <[email protected]>
This commit is contained in:
co-authored by
John Sudol
Ferenc Hammerl
parent
7754cb80eb
commit
ae31f04223
@@ -111,11 +111,13 @@ export function writeEntryPointScript(
|
|||||||
if (environmentVariables && Object.entries(environmentVariables).length) {
|
if (environmentVariables && Object.entries(environmentVariables).length) {
|
||||||
const envBuffer: string[] = []
|
const envBuffer: string[] = []
|
||||||
for (const [key, value] of Object.entries(environmentVariables)) {
|
for (const [key, value] of Object.entries(environmentVariables)) {
|
||||||
|
if (key.includes(`=`) || key.includes(`'`) || key.includes(`"`)) {
|
||||||
|
throw new Error(
|
||||||
|
`environment key ${key} is invalid - the key must not contain =, ' or "`
|
||||||
|
)
|
||||||
|
}
|
||||||
envBuffer.push(
|
envBuffer.push(
|
||||||
`"${key}=${value
|
`"${key}=${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`
|
||||||
.replace(/\\/g, '\\\\')
|
|
||||||
.replace(/"/g, '\\"')
|
|
||||||
.replace(/=/g, '\\=')}"`
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
environmentPrefix = `env ${envBuffer.join(' ')} `
|
environmentPrefix = `env ${envBuffer.join(' ')} `
|
||||||
|
|||||||
Reference in New Issue
Block a user