Skip to content

Commit 8ce405d

Browse files
jamesadevineCopilot
andcommitted
refactor: move templates into src/data/ directory
Move pipeline templates from top-level templates/ into src/data/ alongside ecosystem_domains.json, keeping injected content separate from source code. Update all include paths, documentation, workflow path filters, and test references. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 418c4c6 commit 8ce405d

15 files changed

Lines changed: 22 additions & 23 deletions

.github/workflows/doc-freshness-check.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ Compare the `FrontMatter` struct in `src/compile/types.rs` against the documente
7575
Scan template files for markers:
7676

7777
```bash
78-
grep -oP '\{\{[^}]+\}\}' templates/base.yml
79-
grep -oP '\{\{[^}]+\}\}' templates/1es-base.yml
78+
grep -oP '\{\{[^}]+\}\}' src/data/base.yml
79+
grep -oP '\{\{[^}]+\}\}' src/data/1es-base.yml
8080
```
8181

8282
Compare against documented markers in `AGENTS.md`. Check for:

.github/workflows/red-team-security.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ grep -rn 'allow\|block\|domain\|host' src/compile/common.rs | head -30
101101

102102
### Category D: Credential & Secret Exposure
103103

104-
Audit `src/compile/standalone.rs`, `src/compile/common.rs`, and `templates/base.yml` for:
104+
Audit `src/compile/standalone.rs`, `src/compile/common.rs`, and `src/data/base.yml` for:
105105

106106
- **Token leakage**: Are ADO tokens (`SC_READ_TOKEN`, `SC_WRITE_TOKEN`, `SYSTEM_ACCESSTOKEN`) ever logged, printed, or embedded in non-secret pipeline variables?
107107
- **MCP env passthrough**: Can the `env:` field in MCP configs leak host environment variables that shouldn't be accessible inside the AWF sandbox?
@@ -111,8 +111,8 @@ Audit `src/compile/standalone.rs`, `src/compile/common.rs`, and `templates/base.
111111
Focus files:
112112
```bash
113113
grep -rn 'SECRET\|TOKEN\|API_KEY\|secret\|password' src/compile/
114-
grep -rn 'SC_READ_TOKEN\|SC_WRITE_TOKEN' src/compile/ templates/
115-
cat templates/base.yml | grep -A2 -B2 'TOKEN\|SECRET\|env:'
114+
grep -rn 'SC_READ_TOKEN\|SC_WRITE_TOKEN' src/compile/ src/data/
115+
cat src/data/base.yml | grep -A2 -B2 'TOKEN\|SECRET\|env:'
116116
```
117117

118118
### Category E: Logic & Authorization Flaws
@@ -135,7 +135,7 @@ grep -rn 'allowed_repos\|repository' src/tools/create_pr.rs
135135

136136
### Category F: Supply Chain & Dependency Integrity
137137

138-
Audit `src/compile/common.rs`, `Cargo.toml`, and `templates/base.yml` for:
138+
Audit `src/compile/common.rs`, `Cargo.toml`, and `src/data/base.yml` for:
139139

140140
- **Binary integrity**: Are the `ado-aw`, AWF, and MCPG binaries downloaded with proper checksum verification? Can the checksums file itself be tampered with?
141141
- **Docker image pinning**: Is the MCPG Docker image pinned by digest, or only by tag? Tag-only pinning allows image replacement attacks.

.github/workflows/rust-pr-reviewer.lock.yml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/rust-pr-reviewer.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
paths:
88
- "src/**"
99
- "tests/**"
10-
- "templates/**"
1110
- "Cargo.toml"
1211
- "Cargo.lock"
1312
description: Reviews Rust code changes for quality, error handling, security, and project conventions

.github/workflows/rust-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
paths:
66
- "src/**"
77
- "tests/**"
8-
- "templates/**"
98
- "Cargo.toml"
109
- "Cargo.lock"
1110

AGENTS.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ Alongside the correctly generated pipeline yaml, an agent file is generated from
6868
│ ├── runtimes/ # Runtime environment implementations
6969
│ │ ├── mod.rs # Module entry point
7070
│ │ └── lean.rs # Lean 4 theorem prover runtime
71+
│ ├── data/
72+
│ │ ├── base.yml # Base pipeline template for standalone
73+
│ │ ├── 1es-base.yml # Base pipeline template for 1ES target
74+
│ │ ├── ecosystem_domains.json # Network allowlists per ecosystem
75+
│ │ ├── init-agent.md # Dispatcher agent template for `init` command
76+
│ │ └── threat-analysis.md # Threat detection analysis prompt template
7177
│ └── tools/ # First-class tool implementations (compiler auto-configures)
7278
│ ├── mod.rs
7379
│ └── cache_memory.rs
74-
├── templates/
75-
│ ├── base.yml # Base pipeline template for standalone
76-
│ ├── 1es-base.yml # Base pipeline template for 1ES target
77-
│ ├── init-agent.md # Dispatcher agent template for `init` command
78-
│ └── threat-analysis.md # Threat detection analysis prompt template
7980
├── examples/ # Example agent definitions
8081
├── tests/ # Integration tests and fixtures
8182
├── Cargo.toml # Rust dependencies
@@ -540,8 +541,8 @@ When using `target: 1es`, the pipeline will extend `1es/1ES.Unofficial.PipelineT
540541

541542
The compiler transforms the input into valid Azure DevOps pipeline YAML based on the target platform:
542543

543-
- **Standalone**: Uses `templates/base.yml`
544-
- **1ES**: Uses `templates/1es-base.yml`
544+
- **Standalone**: Uses `src/data/base.yml`
545+
- **1ES**: Uses `src/data/1es-base.yml`
545546

546547
Explicit markings are embedded in these templates that the compiler is allowed to replace e.g. `{{ copilot_params }}` denotes parameters which are passed to the copilot command line tool. The compiler should not replace sections denoted by `${{ some content }}`. What follows is a mapping of markings to responsibilities (primarily for the standalone template).
547548

@@ -831,7 +832,7 @@ Example output:
831832

832833
## {{ threat_analysis_prompt }}
833834

834-
Should be replaced with the embedded threat detection analysis prompt from `templates/threat-analysis.md`. This prompt template includes markers for `{{ source_path }}`, `{{ agent_name }}`, `{{ agent_description }}`, and `{{ working_directory }}` which are replaced during compilation.
835+
Should be replaced with the embedded threat detection analysis prompt from `src/data/threat-analysis.md`. This prompt template includes markers for `{{ source_path }}`, `{{ agent_name }}`, `{{ agent_description }}`, and `{{ working_directory }}` which are replaced during compilation.
835836

836837
The threat analysis prompt instructs the security analysis agent to check for:
837838
- Prompt injection attempts

src/compile/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ pub async fn compile_shared(
20362036
validate_resolve_pr_thread_statuses(front_matter)?;
20372037

20382038
// 11. Threat analysis prompt
2039-
let threat_analysis_prompt = include_str!("../../templates/threat-analysis.md");
2039+
let threat_analysis_prompt = include_str!("../data/threat-analysis.md");
20402040
let template = replace_with_indent(
20412041
&config.template,
20422042
"{{ threat_analysis_prompt }}",

src/compile/onees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl Compiler for OneESCompiler {
6363
let teardown_job = generate_teardown_job(&front_matter.teardown, &front_matter.name);
6464

6565
let config = CompileConfig {
66-
template: include_str!("../../templates/1es-base.yml").to_string(),
66+
template: include_str!("../data/1es-base.yml").to_string(),
6767
extra_replacements: vec![
6868
("{{ firewall_version }}".into(), AWF_VERSION.into()),
6969
("{{ mcpg_version }}".into(), MCPG_VERSION.into()),

src/compile/standalone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl Compiler for StandaloneCompiler {
5858
let mcpg_docker_env = generate_mcpg_docker_env(front_matter);
5959

6060
let config = CompileConfig {
61-
template: include_str!("../../templates/base.yml").to_string(),
61+
template: include_str!("../data/base.yml").to_string(),
6262
extra_replacements: vec![
6363
("{{ firewall_version }}".into(), AWF_VERSION.into()),
6464
("{{ mcpg_version }}".into(), MCPG_VERSION.into()),

0 commit comments

Comments
 (0)