mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-25 10:40:02 +08:00
* Add set conversion helper for generic_oidc predicate expressions This adds a small enhanced version of `set()` for generic_oidc that can convert lists to sets. This is needed because almost all interesting functions in the predicate language operate on sets, not lists. So, when given `[]any` parsed from JSON claims, they fail. This limitation affects: - `contains()`, `contains_any()`, `contains_all()` - `regexp.match()` - `is_empty()` - ...and every other function that claims to operate on `[]string` according to the public docs but actually operates on sets. I just created a tiny override that defers to a new `expression.NewFlattenedSet()` constructor. It lets us (or others) easily override the built-in `set()` impl that only accepts variadic `string...` with this better variant, without potentially causing unexpected changes that might, for example, cause expressions to allow access that were previously broken due to this limitation. * Fix failing test * Fix imports * Use bool as parser's generic param instead of any Removes an unnecessary cast.