use equals filter by default (#3145)
Now that we've filters moved from concatenated strings into slices it's possible for selector scopes to prefer equals over contains as the standard matching behavior. This will minimize the possibility of pulling in unintended resources for details and restore. <!-- PR description--> --- #### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Test Plan - [x] 💪 Manual - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
09ef350bc0
commit
6d022d196a
@ -572,13 +572,13 @@ func (suite *SelectorScopesSuite) TestScopesPII() {
|
||||
`"pass":"Pass"`,
|
||||
`"fail":"Fail"`,
|
||||
`"foo":"EQ:bar"`,
|
||||
`"qux":"Cont:fnords,smarf"`,
|
||||
`"qux":"EQ:fnords,smarf"`,
|
||||
},
|
||||
containsPlain: []string{
|
||||
`"pass":"Pass"`,
|
||||
`"fail":"Fail"`,
|
||||
`"foo":"EQ:bar"`,
|
||||
`"qux":"Cont:fnords,smarf"`,
|
||||
`"qux":"EQ:fnords,smarf"`,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -585,11 +585,7 @@ func filterize(
|
||||
return defaultFilter(targets)
|
||||
}
|
||||
|
||||
if len(targets) == 1 {
|
||||
return filters.Equal(targets)
|
||||
}
|
||||
|
||||
return filters.Contains(targets)
|
||||
return filters.Equal(targets)
|
||||
}
|
||||
|
||||
// pathFilterFactory returns the appropriate path filter
|
||||
|
||||
@ -439,8 +439,8 @@ func (suite *SelectorSuite) TestSelector_pii() {
|
||||
ResourceOwners: filterFor(scopeConfig{}, "owner_1", "owner_2"),
|
||||
}
|
||||
},
|
||||
expect: `{"resourceOwners":"Cont:***,***","discreteOwner":"***"}`,
|
||||
expectPlain: `{"resourceOwners":"Cont:owner_1,owner_2","discreteOwner":"owner"}`,
|
||||
expect: `{"resourceOwners":"EQ:***,***","discreteOwner":"***"}`,
|
||||
expectPlain: `{"resourceOwners":"EQ:owner_1,owner_2","discreteOwner":"owner"}`,
|
||||
},
|
||||
{
|
||||
name: "one scope each type",
|
||||
@ -456,14 +456,14 @@ func (suite *SelectorSuite) TestSelector_pii() {
|
||||
},
|
||||
//nolint:lll
|
||||
expect: `{"service":1,` +
|
||||
`"resourceOwners":"Cont:***,***",` +
|
||||
`"resourceOwners":"EQ:***,***",` +
|
||||
`"discreteOwner":"***",` +
|
||||
`"exclusions":[{"ExchangeMail":"Pass","ExchangeMailFolder":"PathCont:***","category":"Identity:***","type":"Identity:***"}],` +
|
||||
`"filters":[{"ExchangeMail":"Pass","ExchangeMailFolder":"PathSfx:***","category":"Identity:***","type":"Identity:***"}],` +
|
||||
`"includes":[{"ExchangeMail":"Pass","ExchangeMailFolder":"PathPfx:***","category":"Identity:***","type":"Identity:***"}]}`,
|
||||
//nolint:lll
|
||||
expectPlain: `{"service":1,` +
|
||||
`"resourceOwners":"Cont:owner_1,owner_2",` +
|
||||
`"resourceOwners":"EQ:owner_1,owner_2",` +
|
||||
`"discreteOwner":"owner",` +
|
||||
`"exclusions":[{"ExchangeMail":"Pass","ExchangeMailFolder":"PathCont:e","category":"Identity:ExchangeMailFolder","type":"Identity:ExchangeMail"}],` +
|
||||
`"filters":[{"ExchangeMail":"Pass","ExchangeMailFolder":"PathSfx:f","category":"Identity:ExchangeMailFolder","type":"Identity:ExchangeMail"}],` +
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user