mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-06 02:43:19 +08:00
Strip INPUT_* env variables from subprocesses
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as exec from '../src/exec'
|
||||
import * as tr from '../src/toolrunner'
|
||||
import * as im from '../src/interfaces'
|
||||
|
||||
import * as childProcess from 'child_process'
|
||||
@@ -620,6 +621,14 @@ describe('@actions/exec', () => {
|
||||
expect(output.trim()).toBe(`args[0]: "hello"${os.EOL}args[1]: "world"`)
|
||||
})
|
||||
|
||||
it('tool runner strips INPUT_ params from environment for child process', () => {
|
||||
const env = {INPUT_TEST: 'input value', SOME_OTHER_ENV: 'some other value'}
|
||||
const sanitizedEnv = tr.stripInputEnvironmentVariables(env)
|
||||
|
||||
expect(sanitizedEnv).not.toHaveProperty('INPUT_TEST')
|
||||
expect(sanitizedEnv).toHaveProperty('SOME_OTHER_ENV')
|
||||
})
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
it('Exec roots relative tool path using process.cwd (Windows path separator)', async () => {
|
||||
let exitCode: number
|
||||
|
||||
Reference in New Issue
Block a user