Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new script injection input #332

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
3,120 changes: 3,120 additions & 0 deletions coverage.txt

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions expr_insecure.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ func (m *UntrustedInputMap) findObjectProp(name string) (*UntrustedInputMap, boo
if c, ok := m.Children[name]; ok {
return c, true
}
c, ok := m.Children["**"]
if name != "*" && ok {
return c, true
}
}
return nil, false
}
Expand Down
2 changes: 1 addition & 1 deletion expr_insecure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestExprInsecureBuiltinUntrustedInputs(t *testing.T) {
rec = func(m map[string]*UntrustedInputMap, path []string) {
for k, v := range m {
p := append(path, k)
if k == "*" {
if k == "*" || k == "**" {
if len(m) != 1 {
t.Errorf("%v has * key but it also has other keys in %v", k, p)
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/err/evaluated_template.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test.yaml:22:20: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type object [expression]
test.yaml:22:38: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type {cache-hit: string} [expression]
test.yaml:22:63: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type array<any> [expression]
test.yaml:24:20: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type null [expression]
test.yaml:24:20: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type null [expression]
2 changes: 1 addition & 1 deletion testdata/examples/type_checks.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test.yaml:7:28: property access of object must be type of string but got "number" [expression]
test.yaml:9:24: property "os" is not defined in object type {id: string; network: string} [expression]
test.yaml:11:24: receiver of object dereference "owner" must be type of object but got "string" [expression]
test.yaml:13:20: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type {string => string} [expression]
test.yaml:13:20: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type {string => string} [expression]
2 changes: 1 addition & 1 deletion testdata/ok/issue-113.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ jobs:
- run: |
if [[ -z ${{ env.FOO }} ]]; then
echo "FOO is empty"
fi
fi
Loading