Merge branch 'next' into dependabot/npm_and_yarn/integration-tests/next/selenium-webdriver-4.41.0

This commit is contained in:
James Read 2026-02-25 18:51:30 -05:00 committed by GitHub
commit 1d61117d67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 33 additions and 20 deletions

View File

@ -3,6 +3,7 @@ listenAddressSingleHTTPFrontend: 0.0.0.0:1337
logLevel: "DEBUG" logLevel: "DEBUG"
checkForUpdates: false checkForUpdates: false
popupOnStart: execution-dialog
actions: actions:
- title: Test checkbox argument - title: Test checkbox argument

View File

@ -3,6 +3,7 @@ listenAddressSingleHTTPFrontend: 0.0.0.0:1337
logLevel: "DEBUG" logLevel: "DEBUG"
checkForUpdates: false checkForUpdates: false
popupOnStart: execution-dialog
actions: actions:
- title: Test datetime argument - title: Test datetime argument

View File

@ -3,6 +3,7 @@ listenAddressSingleHTTPFrontend: 0.0.0.0:1337
logLevel: "DEBUG" logLevel: "DEBUG"
checkForUpdates: false checkForUpdates: false
popupOnStart: execution-dialog
actions: actions:
- title: Test suggestionsBrowserKey - title: Test suggestionsBrowserKey

View File

@ -718,13 +718,18 @@ func filterToDefinedArgumentsOnly(req *ExecutionRequest) {
} }
filtered := make(map[string]string) filtered := make(map[string]string)
for k, v := range req.Arguments { for k, v := range req.Arguments {
if _, ok := definedNames[k]; ok || strings.HasPrefix(k, "ot_") { if keepArgument(k, definedNames) {
filtered[k] = v filtered[k] = v
} }
} }
req.Arguments = filtered req.Arguments = filtered
} }
func keepArgument(name string, definedNames map[string]struct{}) bool {
_, ok := definedNames[name]
return ok || strings.HasPrefix(name, "ot_")
}
func hasWebhookTag(req *ExecutionRequest) bool { func hasWebhookTag(req *ExecutionRequest) bool {
for _, tag := range req.Tags { for _, tag := range req.Tags {
if tag == "webhook" { if tag == "webhook" {

View File

@ -366,8 +366,8 @@ func TestFilterToDefinedArgumentsOnly(t *testing.T) {
}, },
} }
req.Arguments = map[string]string{ req.Arguments = map[string]string{
"name": "Alice", "name": "Alice",
"webhook_path": "/malicious/$(id)", "webhook_path": "/malicious/$(id)",
"extra_undefined": "ignored", "extra_undefined": "ignored",
} }
@ -381,13 +381,13 @@ func TestFilterToDefinedArgumentsOnly(t *testing.T) {
func TestFilterToDefinedArgumentsPreservesSystemArgs(t *testing.T) { func TestFilterToDefinedArgumentsPreservesSystemArgs(t *testing.T) {
req := newExecRequest() req := newExecRequest()
req.Binding.Action = &config.Action{ req.Binding.Action = &config.Action{
Title: "Filter test", Title: "Filter test",
Shell: "echo test", Shell: "echo test",
Arguments: []config.ActionArgument{}, Arguments: []config.ActionArgument{},
} }
req.Arguments = map[string]string{ req.Arguments = map[string]string{
"ot_executionTrackingId": "track-123", "ot_executionTrackingId": "track-123",
"ot_username": "webhook", "ot_username": "webhook",
} }
filterToDefinedArgumentsOnly(req) filterToDefinedArgumentsOnly(req)

View File

@ -62,20 +62,25 @@ func TestParseTemplateWithActionContext_Json(t *testing.T) {
} }
assert.NoError(t, err) assert.NoError(t, err)
if tt.checkJsonOnly { if tt.checkJsonOnly {
prefix := strings.TrimSuffix(tt.expectedOutput, " ") assertJsonOutput(t, output, tt.expectedOutput, tt.args)
assert.True(t, strings.HasPrefix(output, prefix), "output %q should start with %q", output, prefix)
jsonPart := strings.TrimPrefix(output, prefix)
jsonPart = strings.TrimSpace(jsonPart)
var decoded map[string]string
err := json.Unmarshal([]byte(jsonPart), &decoded)
assert.NoError(t, err)
for k, v := range tt.args {
assert.Equal(t, v, decoded[k], "decoded JSON should contain %s=%s", k, v)
}
assert.Len(t, decoded, len(tt.args))
} else { } else {
assert.Equal(t, tt.expectedOutput, output) assert.Equal(t, tt.expectedOutput, output)
} }
}) })
} }
} }
func assertJsonOutput(t *testing.T, output, expectedPrefix string, args map[string]string) {
t.Helper()
prefix := strings.TrimSuffix(expectedPrefix, " ")
assert.True(t, strings.HasPrefix(output, prefix), "output %q should start with %q", output, prefix)
jsonPart := strings.TrimPrefix(output, prefix)
jsonPart = strings.TrimSpace(jsonPart)
var decoded map[string]string
err := json.Unmarshal([]byte(jsonPart), &decoded)
assert.NoError(t, err)
for k, v := range args {
assert.Equal(t, v, decoded[k], "decoded JSON should contain %s=%s", k, v)
}
assert.Len(t, decoded, len(args))
}

View File

@ -16,9 +16,9 @@ func TestFilterToDefinedArguments(t *testing.T) {
}, },
} }
args := map[string]string{ args := map[string]string{
"repo": "my-repo", "repo": "my-repo",
"branch": "main", "branch": "main",
"webhook_path": "/deploy/prod", "webhook_path": "/deploy/prod",
"webhook_header_x_custom": "malicious", "webhook_header_x_custom": "malicious",
} }