Add single quotes for inner command.
Change to bash as interpreter. Forbid single quotes for user commands.
This commit is contained in:

committed by
Sebastian Serth

parent
4c25473c9e
commit
8950ab3776
@ -95,7 +95,7 @@ func TestAWSFunctionWorkload_ExecuteInteractively(t *testing.T) {
|
||||
cancel()
|
||||
|
||||
expectedRequestData := "{\"action\":\"" + environment.Image() +
|
||||
"\",\"cmd\":[\"env\",\"CODEOCEAN=true\",\"sh\",\"-c\",\"unset \\\"${!AWS@}\\\" \\u0026\\u0026 " + command +
|
||||
"\",\"cmd\":[\"env\",\"CODEOCEAN=true\",\"bash\",\"-c\",\"unset \\\"${!AWS@}\\\" \\u0026\\u0026 " + command +
|
||||
"\"],\"files\":{}}"
|
||||
assert.Equal(t, expectedRequestData, awsMock.receivedData)
|
||||
})
|
||||
@ -129,8 +129,8 @@ func TestAWSFunctionWorkload_UpdateFileSystem(t *testing.T) {
|
||||
execCancel()
|
||||
|
||||
expectedRequestData := "{\"action\":\"" + environment.Image() +
|
||||
"\",\"cmd\":[\"env\",\"CODEOCEAN=true\",\"sh\",\"-c\",\"unset \\\"${!AWS@}\\\" \\u0026\\u0026 " + command + "\"]," +
|
||||
"\"files\":{\"" + string(myFile.Path) + "\":\"" + base64.StdEncoding.EncodeToString(myFile.Content) + "\"}}"
|
||||
"\",\"cmd\":[\"env\",\"CODEOCEAN=true\",\"bash\",\"-c\",\"unset \\\"${!AWS@}\\\" \\u0026\\u0026 " + command +
|
||||
"\"]," + "\"files\":{\"" + string(myFile.Path) + "\":\"" + base64.StdEncoding.EncodeToString(myFile.Content) + "\"}}"
|
||||
assert.Equal(t, expectedRequestData, awsMock.receivedData)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user