You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(safeoutputs): support glob wildcards anywhere in allowed-tags patterns (#442)
* fix(safeoutputs): support glob wildcards anywhere in allowed-tags patterns
tag_matches_pattern only handled a trailing '*' (prefix match). Patterns
like 'copilot:repo=msazuresphere/4x4/*@main' silently fell through to
exact-match comparison, rejecting valid tags such as
'copilot:repo=msazuresphere/4x4/VsCodeExtension@main'.
Switch to glob_match::glob_match (already a dependency) so '*' works in
any position. Also consolidate the inline matching in add_build_tag.rs to
use the shared tag_matches_pattern helper, gaining case-insensitive
matching it was previously missing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor(safeoutputs): replace hand-rolled globs with shared wildcard_match
Address PR review feedback:
- Replace glob_match::glob_match with a purpose-built wildcard_match()
that treats * as matching any character including /. Tags and artifact
names are not file paths, so / should not act as a segment separator.
- Add name_matches_pattern() (case-sensitive) alongside the existing
tag_matches_pattern() (case-insensitive) for artifact name allow-lists.
- Consolidate upload_build_attachment.rs and upload_pipeline_artifact.rs
to use name_matches_pattern instead of inline strip_suffix + starts_with.
- Leave queue_build.rs branch matching as-is — it has intentionally
different semantics (case-sensitive, requires / separator).
- Update docs/safe-outputs.md to describe * wildcard support instead of
the old 'prefix wildcards' language.
- Add comprehensive tests for wildcard_match, slash-crossing, and
name_matches_pattern.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/safe-outputs.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ Creates an Azure DevOps work item.
72
72
- `iteration-path`- Iteration path for the work item
73
73
- `assignee`- User to assign (email or display name)
74
74
- `tags`- Static list of tags always applied to the work item (regardless of agent input)
75
-
- `allowed-tags` - Allowlist of tags the agent is permitted to use via the `tags` parameter. If empty, any agent-provided tags are accepted. Supports prefix wildcards: entries ending with `*` match by prefix (e.g., `"agent-*"` matches `"agent-created"`, `"agent-review"`, etc.).
75
+
- `allowed-tags`- Allowlist of tags the agent is permitted to use via the `tags` parameter. If empty, any agent-provided tags are accepted. Supports `*` wildcards anywhere in the pattern (e.g., `"agent-*"` matches `"agent-created"`; `"copilot:repo=org/project/*@main"` matches any repo name).
76
76
- `custom-fields` - Map of custom field reference names to values (e.g., `Custom.MyField: "value"`)
77
77
- `max` - Maximum number of create-work-item outputs allowed per run (default: 1)
78
78
- `include-stats` - Whether to append agent execution stats to the work item description (default: true)
allowed-tags: [] # Optional — restrict which tags the agent can set (empty = any; supports prefix wildcards like "agent-*")
115
+
allowed-tags: [] # Optional — restrict which tags the agent can set (empty = any; supports * wildcards like "agent-*")
116
116
```
117
117
118
118
**Security note:** Every field that can be modified requires explicit opt-in (`true`) in the front matter configuration. If the `max` limit is exceeded, additional entries are skipped rather than aborting the entire batch.
@@ -378,7 +378,7 @@ Adds a tag to an Azure DevOps build.
378
378
```yaml
379
379
safe-outputs:
380
380
add-build-tag:
381
-
allowed-tags: [] # Optional — restrict which tags can be applied (supports prefix wildcards)
381
+
allowed-tags: [] # Optional — restrict which tags can be applied (supports * wildcards)
382
382
tag-prefix: "agent-" # Optional — prefix prepended to all tags
383
383
allow-any-build: false # When false, only the current pipeline build can be tagged (default: false)
0 commit comments