Skip to content

Commit

Permalink
Merge pull request #1 from hugo-syn/main
Browse files Browse the repository at this point in the history
restore most of the tests
  • Loading branch information
hugo-syn authored Aug 4, 2023
2 parents 80e2c02 + 08e25d4 commit a1d9a3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions expr_insecure.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func (m *UntrustedInputMap) findObjectProp(name string) (*UntrustedInputMap, boo
if c, ok := m.Children[name]; ok {
return c, true
}
if c, ok := m.Children["*"]; ok {
c, ok := m.Children["**"]
if name != "*" && ok {
return c, true
}
}
Expand Down Expand Up @@ -137,7 +138,7 @@ var BuiltinUntrustedInputs = UntrustedInputSearchRoots{
NewUntrustedInputMap("head_ref"),
),
"env": NewUntrustedInputMap("env",
NewUntrustedInputMap("*"),
NewUntrustedInputMap("**"),
),
}

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

0 comments on commit a1d9a3a

Please sign in to comment.