Proposal: Multiselect Attribute Operators for ABAC Simple Mode
PR: mattermost/mattermost#35896
BLUF
Replace the overloaded in operator for multiselect attributes with two new operators: has any of (OR) and has all of (AND, default). This eliminates a semantic mismatch where in means OR for select attributes but AND for multiselect — a silent misconfiguration risk in classified environments. If OR CEL generation proves infeasible with the locked backend, ship has all of only in v1 and add has any of in a fast-follow.
The Problem
PR #35896 reuses the in operator for multiselect attributes, but the underlying logic is inverted:
Attribute Type | Expression | Operator Label | Actual Logic |
|---|---|---|---|
Select (single-value) |
|
| OR — user's dept is Eng or Ops |
Multiselect (multi-value) |
|
| AND — user has Dragon and Phoenix |
Same label. Opposite behavior. An admin configuring both attribute types in one policy has no way to tell them apart. In IL4/IL5 environments, this creates a data spillage or denial-of-access risk.
Proposed Solution
Operator Mapping (Simple Mode)
Attribute Type | Operator | Meaning | CEL Output | Help Text |
|---|---|---|---|---|
Select / Text |
| Exact single match |
| — |
Select / Text |
| Any of the values (OR) |
| "Matches any of the selected values" |
Multiselect |
| User has at least one of the values (OR) |
| "User has at least one of these values" |
Multiselect |
| User has every one of the values (AND) |
| "User has all of these values" |
Key Design Decisions
Operator naming: "has" verb family
"Has all of" / "has any of" are concise (10 chars each), plain-English, and self-explanatory
Creates a clean two-family system:
is/infor scalar attributes,hasfor set attributesResearch showed "includes" is the industry standard (Klaviyo, Amplitude) but adds a third verb family that breaks Mattermost's short-label pattern. The clarity difference is negligible.
Avoids the Jira anti-pattern of mapping "equals" to IN semantics
Operator dropdown behavior
When a multiselect attribute is selected, the operator dropdown shows only
has any ofandhas all of(notisorin)When switching from a select to multiselect attribute, operator auto-resets to
has any ofWhen switching from multiselect to select, operator auto-resets to
is
Advanced mode (CEL editor) implications
The CEL output is standard
inmembership tests — no new CEL syntax neededAn admin who switches to advanced mode sees
"Dragon" in user.programs || "Phoenix" in user.programs— theinkeyword here is CEL's native membership test, not the simple-modeinoperator labelSwitching back to simple mode: the backend visual AST parser sees
||-joinedinexpressions → maps tohas any of;&&-joined → maps tohas all of
Inline plain-language summary (recommended, not required for v1)
Below each rule row, show a plain-English summary: "User must have any of: Dragon Spacecraft, Black Phoenix"
Differentiation opportunity: no competitor does this. High value for DoD admins auditing policies.
Implementation Scope
Frontend Changes (PR #35896 update)
Add
has any ofandhas all ofto operator constants — new entries in the operator descriptor mapFilter operators by attribute type — multiselect shows only
has any of/has all of; select/text shows onlyis/inUpdate CEL generation in
table_editor.tsx:has all of→ values joined with&&(already implemented as currentinbehavior)has any of→ values joined with||(new: same pattern, different joiner)
Update default operator logic — multiselect rows default to
has all ofUpdate attribute-switch handler — reset operator when crossing type boundaries
Add help text — tooltip on each multiselect operator explaining the logic
Backend Changes
None required if the visual AST → CEL conversion already handles
||-joinedinexpressions[VERIFY WITH ENGINEERING] Confirm that the visual AST parser can round-trip
"v1" in attr || "v2" in attrback to simple mode ashas any of
Fallback: Ship has all of only
If engineering confirms that OR CEL generation or round-tripping is not feasible without AST changes:
Ship only
has all of(AND) in v1Hide the operator dropdown for multiselect (only one option)
Add
has any ofin a fast-follow once backend supports itThis is acceptable but not preferred — it forces OR use cases to the CEL editor
What This Looks Like
┌─────────────────────────────────────────────────────────┐
│ Access Rules [All attributes required ▼] │
│ │
│ ┌──────────────┐ ┌────────────┐ ┌─────────────────────┐ │
│ │ Program ▼ │ │ has any of▼│ │ Dragon ✕ Phoenix ✕│ │
│ └──────────────┘ └────────────┘ └─────────────────────┘ │
│ ℹ️ User must have any of: Dragon Spacecraft, Black Phoenix │
│ │
│ ┌──────────────┐ ┌────────────┐ ┌─────────────────────┐ │
│ │ Clearance ▼ │ │ is ▼ │ │ Top Secret │ │
│ └──────────────┘ └────────────┘ └─────────────────────┘ │
│ │
│ + Select user attribute │
└────────────────────────────────────────────────────────────────┘
Operator Dropdown (when multiselect attribute selected)
┌─────────────┐
│ has any of │ ← "User has at least one of these values"
│ has all of │ ← "User has all of these values"
└─────────────┘
Cheatsheet Update
Add to the Expression Syntax Cheatsheet modal:
Operator | Meaning | Attribute Type | Example |
|---|---|---|---|
| Exact match | Select / Text |
|
| Any of the values | Select / Text |
|
| Has at least one value | Multiselect |
|
| Has all values | Multiselect |
|
Risk Register
Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
Admins confuse | Low | Low | Different verb family signals different attribute type. Tooltip clarifies. |
OR CEL round-trip fails with locked backend | Medium | High | Verify with engineering before implementation. Fallback: ship AND-only. |
Operator dropdown truncates on narrow viewports | Low | Low | "Has all of" / "has any of" are 10 chars — shorter than "includes" variants. |
Open Items
[VERIFY WITH ENGINEERING] Can the visual AST parser round-trip
"v1" in attr || "v2" in attrtohas any ofin simple mode?
Appendix: Alternative — Single "has" Operator with One Value Per Row
Description
An alternative was evaluated: use a single has operator for multiselect attributes, restricted to one value per row. Admins would express AND logic by adding multiple rows with the same attribute (joined by the global "All attributes required" toggle), and OR logic by switching the global toggle to "Any 1 attribute required."
Example — "User must have Dragon AND Phoenix" (global = All attributes required):
[Program] [has] [Dragon]
[Program] [has] [Phoenix]Pros
Simpler operator vocabulary: One operator (
has) instead of two. Nothing to learn.Simpler value picker: Single-value select instead of multi-value chip picker.
Trivial CEL round-trip: Each row maps to exactly one
"value" in attrexpression. No compound pattern recognition needed in the parser.Simpler mental model (narrow case): "Each row is one check. The global operator combines them."
No backend changes: Works with existing CEL generation and AST parsing.
Cons (including fatal flaw)
Fatal composability flaw — cannot express mixed-logic policies:
The global logical operator (AND/OR) applies to ALL rows. When an admin needs AND between multiselect rows but OR within another attribute (or vice versa), this approach breaks:
Policy Intent | Approach A (recommended) | Single "has" |
|---|---|---|
"Has ANY of [Dragon, Phoenix] AND Clearance is Top Secret" |
|
|
"Has ALL of [Dragon, Phoenix] OR Dept is Engineering" |
|
|
These are common policy patterns in defense environments (e.g., "must be read into any of these compartments AND hold TS/SCI"). Forcing admins to the CEL editor for routine policies defeats the purpose of simple mode.
Row proliferation: An "all of 5 values" policy requires 5 rows instead of 1, making the rule table harder to scan and audit. At scale (10+ multiselect values across multiple attributes), the table becomes unwieldy.
Breaks existing multi-value pattern: Select attributes already support
inwith multiple values in a single row. Restricting multiselect to single-value rows is an inconsistency that will confuse admins.AND/OR logic is spatially separated from data: The admin must look at the global toggle (top of the table) to understand the relationship between rows. With
has all of/has any of, the intent is self-documenting within the row itself.
Decision
Rejected. The composability flaw is disqualifying. A simple mode that cannot express "has any of X values AND some other condition" — one of the most common real-world policy patterns — forces admins into the CEL editor for routine work. The implementation simplicity gains do not justify the expressiveness loss for DoD system admins managing classified channel access.