fix: block template marker delimiters in front matter identity fields#315
Conversation
Block `{{` in name, description, and trigger fields to prevent
second-order template injection where a value like `{{ agent_content }}`
would be expanded by a later replacement pass, allowing arbitrary YAML
injection into the generated pipeline.
Closes #302
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/91f10480-fd27-4ac7-9105-cbea31200461
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/91f10480-fd27-4ac7-9105-cbea31200461 Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
|
/rust-review |
|
✅ Rust PR Reviewer completed successfully! |
🔍 Rust PR ReviewSummary: Fix is correct and well-targeted — good to merge with one minor note. Findings🐛 Bugs / Logic Issues
|
|
@copilot Implement feedback bugs and suggestions! |
…messages
Address rust-review feedback:
- Add missing contains_pipeline_command() check to reject_pipeline_injection()
to match the docstring's claim of ##vso[/##[ protection
- Include Found: '{}' in template marker error for debuggability
- Add test cases for pipeline command rejection
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/6b4b1bb0-b925-4b27-a00c-d0f4e576b263
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Both items addressed in
Also added test cases for pipeline command rejection in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Second-order template injection via
name: "{{ agent_content }}". The sequential replacement fold incompile_sharedprocesses{{ agent_name }}before{{ agent_content }}, so a name containing a template marker becomes a live marker that gets expanded on the next pass — injecting the entire markdown body (attacker-controlled YAML) into the pipeline as an unquoted top-level scalar. Injectedjobs:blocks run outside AWF sandbox with unrestricted network and token access.Changes
src/validate.rs: Addedcontains_template_marker()detecting{{in values. Integrated intoreject_pipeline_injection()so all fields embedded into YAML templates (name, description, trigger fields) are covered. Also added the missingcontains_pipeline_command()check toreject_pipeline_injection()so the function body now matches its docstring's claim of##vso[/##[protection. All error messages now include the offending value (Found: '{}') for debuggability.src/compile/common.rs: Updatedvalidate_front_matter_identitydoc comment. Added tests for template marker rejection in both name and description.