From a39a0bad6e089cd46a9094d11d6459d649007968 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 12:52:41 +0000 Subject: [PATCH] chore(workflows): recompile safe-output fixtures with ado-aw v0.47.0 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/safe-outputs/azure-cli.lock.yml | 243 ++++++++-------- tests/safe-outputs/canary.lock.yml | 259 +++++++++-------- tests/safe-outputs/janitor.lock.yml | 255 +++++++++-------- tests/safe-outputs/noop-target.lock.yml | 243 ++++++++-------- .../smoke-failure-reporter.lock.yml | 270 ++++++++++-------- 5 files changed, 661 insertions(+), 609 deletions(-) diff --git a/tests/safe-outputs/azure-cli.lock.yml b/tests/safe-outputs/azure-cli.lock.yml index 9bc71a5d5..79ff2af5c 100644 --- a/tests/safe-outputs/azure-cli.lock.yml +++ b/tests/safe-outputs/azure-cli.lock.yml @@ -1,5 +1,5 @@ # This file is auto-generated by ado-aw. Do not edit manually. -# @ado-aw source="tests/safe-outputs/azure-cli.md" version=0.45.1 +# @ado-aw source="tests/safe-outputs/azure-cli.md" version=0.47.0 name: Daily smoke az CLI access-$(BuildID) resources: @@ -84,7 +84,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -99,7 +99,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | AGENTIC_PIPELINES_PATH="$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" chmod +x "$AGENTIC_PIPELINES_PATH" @@ -118,24 +118,60 @@ jobs: # These duplicate the compile-time values baked into the YAML, but MCPG's # Docker container requires MCP_GATEWAY_PORT and MCP_GATEWAY_DOMAIN env vars # to start — the ADO variable indirection satisfies that contract. - echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]80" - echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]host.docker.internal" + echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]8080" + echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]awmg-mcpg" # Write MCPG (MCP Gateway) configuration to a file cat > "$(Agent.TempDirectory)/staging/mcpg-config.json" << 'MCPG_CONFIG_EOF' { "mcpServers": { "safeoutputs": { - "type": "http", - "url": "http://localhost:${SAFE_OUTPUTS_PORT}/mcp", - "headers": { - "Authorization": "Bearer ${SAFE_OUTPUTS_API_KEY}" + "type": "stdio", + "container": "ghcr.io/github/gh-aw-firewall/agent:0.27.32", + "entrypoint": "/usr/local/bin/ado-aw", + "entrypointArgs": [ + "mcp", + "--enabled-tools", + "missing-data", + "--enabled-tools", + "missing-tool", + "--enabled-tools", + "noop", + "--enabled-tools", + "report-incomplete", + "/safeoutputs", + "$(Build.SourcesDirectory)" + ], + "mounts": [ + "/tmp/awf-tools/ado-aw:/usr/local/bin/ado-aw:ro", + "$(Build.SourcesDirectory):$(Build.SourcesDirectory):rw", + "/tmp/awf-tools/staging:/safeoutputs:rw" + ], + "args": [ + "--network", + "none", + "--user", + "${MCP_RUNNER_UID}:${MCP_RUNNER_GID}", + "--cap-drop", + "ALL", + "--security-opt", + "no-new-privileges", + "--read-only", + "--tmpfs", + "/tmp:rw,nosuid,nodev,noexec", + "--pids-limit", + "256", + "-w", + "$(Build.SourcesDirectory)" + ], + "env": { + "HOME": "/tmp" } } }, "gateway": { - "port": 80, - "domain": "host.docker.internal", + "port": 8080, + "domain": "awmg-mcpg", "apiKey": "${MCP_GATEWAY_API_KEY}", "payloadDir": "/tmp/gh-aw/mcp-payloads" } @@ -168,6 +204,9 @@ jobs: # Copy MCPG config to /tmp cp "$(Agent.TempDirectory)/staging/mcpg-config.json" /tmp/awf-tools/staging/mcpg-config.json + if [ -f "$(Agent.TempDirectory)/staging/custom-tools.json" ]; then + cp "$(Agent.TempDirectory)/staging/custom-tools.json" /tmp/awf-tools/staging/custom-tools.json + fi displayName: Prepare tooling - bash: | # Write agent instructions to /tmp so it's accessible inside AWF container @@ -185,7 +224,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -202,16 +241,15 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 docker pull ghcr.io/github/gh-aw-mcpg:v0.4.1 - displayName: Pre-pull AWF and MCPG container images (v0.27.9) + displayName: Pre-pull AWF and MCPG container images (v0.27.32) - task: UseNode@1 inputs: version: 22.x @@ -221,28 +259,28 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() - bash: | set -eo pipefail - node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "Build.Repository.Name=$(Build.Repository.Name)" + node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.BuildId=$(Build.BuildId)" --var "Build.Repository.Name=$(Build.Repository.Name)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "System.CollectionUri=$(System.CollectionUri)" displayName: Resolve runtime imports (agent prompt) condition: succeeded() - bash: | - # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/azure-cli.md","target":"standalone","version":"0.45.1"} - echo 'ado-aw metadata: source=tests/safe-outputs/azure-cli.md org= repo= version=0.45.1 target=standalone' + # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/azure-cli.md","target":"standalone","version":"0.47.0"} + echo 'ado-aw metadata: source=tests/safe-outputs/azure-cli.md org= repo= version=0.47.0 target=standalone' displayName: ado-aw - bash: | set -eo pipefail mkdir -p "$(Agent.TempDirectory)/staging" cat >"$(Agent.TempDirectory)/staging/aw_info.json" <<'AW_INFO_EOF' - {"agent_name":"Daily smoke: az CLI access","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.45.1","engine":"copilot","model":"gpt-5-mini","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/azure-cli.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} + {"agent_name":"Daily smoke: az CLI access","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.47.0","engine":"copilot","model":"claude-sonnet-4.6","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/azure-cli.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} AW_INFO_EOF displayName: Emit aw_info.json condition: always() @@ -288,50 +326,13 @@ jobs: echo "Azure CLI prompt appended" displayName: Append Azure CLI prompt condition: ne(variables['AW_AZ_MOUNTS'], '') - - bash: | - SAFE_OUTPUTS_PORT=8100 - SAFE_OUTPUTS_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PORT]$SAFE_OUTPUTS_PORT" - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_API_KEY;issecret=true]$SAFE_OUTPUTS_API_KEY" - - mkdir -p "$(Agent.TempDirectory)/staging/logs" - - # Start SafeOutputs as HTTP server in the background - # NOTE: --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete expands to either "" or "--enabled-tools X ... " - # (with trailing space). The value MUST be newline-free; is_safe_tool_name enforces this. - # Positional args (output_directory, bounding_directory) MUST come after all named - # options — clap parses them positionally and reordering would break the command. - nohup /tmp/awf-tools/ado-aw mcp-http \ - --port "$SAFE_OUTPUTS_PORT" \ - --api-key "$SAFE_OUTPUTS_API_KEY" \ - --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete "/tmp/awf-tools/staging" \ - "$(Build.SourcesDirectory)" \ - > "$(Agent.TempDirectory)/staging/logs/safeoutputs.log" 2>&1 & - SAFE_OUTPUTS_PID=$! - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PID]$SAFE_OUTPUTS_PID" - echo "SafeOutputs HTTP server started on port $SAFE_OUTPUTS_PORT (PID: $SAFE_OUTPUTS_PID)" - - # Wait for server to be ready - READY=false - # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop - for i in $(seq 1 30); do - if curl -sf "http://localhost:$SAFE_OUTPUTS_PORT/health" > /dev/null 2>&1; then - echo "SafeOutputs HTTP server is ready" - READY=true - break - fi - sleep 1 - done - if [ "$READY" != "true" ]; then - echo "##vso[task.complete result=Failed]SafeOutputs HTTP server did not become ready within 30s" - exit 1 - fi - displayName: Start SafeOutputs HTTP server - bash: | # Substitute runtime values into MCPG config + MCP_RUNNER_UID=$(id -u) + MCP_RUNNER_GID=$(id -g) MCPG_CONFIG=$(sed \ - -e "s|\${SAFE_OUTPUTS_PORT}|$(SAFE_OUTPUTS_PORT)|g" \ - -e "s|\${SAFE_OUTPUTS_API_KEY}|$(SAFE_OUTPUTS_API_KEY)|g" \ + -e "s|\${MCP_RUNNER_UID}|$MCP_RUNNER_UID|g" \ + -e "s|\${MCP_RUNNER_GID}|$MCP_RUNNER_GID|g" \ -e "s|\${MCP_GATEWAY_API_KEY}|$(MCP_GATEWAY_API_KEY)|g" \ /tmp/awf-tools/staging/mcpg-config.json) @@ -341,26 +342,22 @@ jobs: # Remove any leftover container or stale output from a previous interrupted run # (--rm only cleans up on clean exit; OOM/SIGKILL may leave it behind) - docker rm -f mcpg 2>/dev/null || true + docker rm -f awmg-mcpg 2>/dev/null || true GATEWAY_OUTPUT="/tmp/gh-aw/mcp-config/gateway-output.json" mkdir -p "$(dirname "$GATEWAY_OUTPUT")" /tmp/gh-aw/mcp-logs rm -f "$GATEWAY_OUTPUT" - # Start MCPG Docker container on host network. + # Start MCPG on Docker's bridge network. AWF attaches this named, + # trusted container to its internal network after creating awf-net. # The Docker socket mount is required because MCPG spawns stdio-based MCP # servers as sibling containers. This grants significant host access — acceptable # here because the pipeline agent is already trusted and network-isolated by AWF. # - # WORKAROUND: Override entrypoint to bypass run_containerized.sh which has a - # validate_port_mapping() bug — it calls `docker inspect .NetworkSettings.Ports` - # which is empty with --network host (by design), causing a spurious error: - # [ERROR] Port 80 is not exposed from the container - # Upstream fix: https://github.com/github/gh-aw-mcpg/issues/TBD - # # stdout → gateway-output.json (machine-readable config, read after health check) echo "$MCPG_CONFIG" | docker run -i --rm \ - --name mcpg \ - --network host \ + --name awmg-mcpg \ + --network bridge \ + -p 127.0.0.1:8080:8080 \ --entrypoint /app/awmg \ -v /var/run/docker.sock:/var/run/docker.sock \ -e MCP_GATEWAY_PORT="$(MCP_GATEWAY_PORT)" \ @@ -369,7 +366,7 @@ jobs: \ \ ghcr.io/github/gh-aw-mcpg:v0.4.1 \ - --routed --listen 0.0.0.0:80 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ + --routed --listen 0.0.0.0:8080 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ > "$GATEWAY_OUTPUT" 2> >(tee /tmp/gh-aw/mcp-logs/stderr.log >&2) & MCPG_PID=$! echo "MCPG started (PID: $MCPG_PID)" @@ -378,7 +375,7 @@ jobs: READY=false # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop for i in $(seq 1 30); do - if curl -sf "http://localhost:80/health" > /dev/null 2>&1; then + if curl -sf "http://localhost:8080/health" > /dev/null 2>&1; then echo "MCPG is ready" READY=true break @@ -415,8 +412,8 @@ jobs: # Convert gateway output to Copilot CLI mcp-config.json. # Mirrors gh-aw's convert_gateway_config_copilot.cjs: - # - Rewrite URLs from 127.0.0.1 to host.docker.internal (AWF container needs - # host.docker.internal to reach MCPG on the host; 127.0.0.1 is container loopback) + # - Rewrite gateway URLs to the stable MCPG container name that AWF + # attaches to its internal network # - Ensure tools: ["*"] on each server entry (Copilot CLI requirement) # - Mark generated MCPG entries as default/trusted servers for Copilot CLI # - Preserve all other fields (headers, type, etc.) @@ -436,28 +433,30 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging/logs" echo "=== Running AI agent with AWF network isolation ===" - echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" + echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" - # AWF provides L7 domain whitelisting via Squid proxy + Docker containers. - # --enable-host-access allows the AWF container to reach host services - # (MCPG and SafeOutputs) via host.docker.internal. + # AWF provides L7 domain whitelisting via a rootless Docker topology. + # The named MCPG container is attached to AWF's internal network as a + # trusted endpoint; the agent has no route to the host. # AWF auto-mounts /tmp:/tmp:rw into the container, so copilot binary, # agent prompt, and MCP config are placed under /tmp/awf-tools/. # Stream agent output in real-time while filtering VSO commands. # sed -u = unbuffered (line-by-line) so output appears immediately. # tee writes to both stdout (ADO pipeline log) and the artifact file. # pipefail (set above) ensures AWF's exit code propagates through the pipe. - # shellcheck disable=SC2046 # $(AW_AZ_MOUNTS) is an ADO macro substituted before bash sees it, not bash command substitution; word-splitting the expanded value into separate --mount tokens is intentional - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2046,SC2016 # ADO macros are substituted before bash; the single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --topology-attach "awmg-mcpg" \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ - --enable-host-access \ - $(AW_AZ_MOUNTS) \ + $(AW_AZ_MOUNTS) \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/staging/logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- 'export NO_PROXY="${NO_PROXY:+$NO_PROXY,}awmg-mcpg"; export no_proxy="$NO_PROXY"; /tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-tool github --allow-tool safeoutputs --allow-tool "shell(az)" --allow-tool "shell(head)"' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$AGENT_OUTPUT_FILE" \ @@ -497,16 +496,9 @@ jobs: - bash: | # Stop MCPG container echo "Stopping MCPG..." - docker stop mcpg 2>/dev/null || true - echo "MCPG stopped" - - # Stop SafeOutputs HTTP server - if [ -n "$(SAFE_OUTPUTS_PID)" ]; then - echo "Stopping SafeOutputs (PID: $(SAFE_OUTPUTS_PID))..." - kill "$(SAFE_OUTPUTS_PID)" 2>/dev/null || true - echo "SafeOutputs stopped" - fi - displayName: Stop MCPG and SafeOutputs + docker stop awmg-mcpg 2>/dev/null || true + echo "MCPG and stdio child containers stopped" + displayName: Stop MCPG condition: always() - bash: | # Copy all logs to output directory for artifact upload @@ -532,12 +524,17 @@ jobs: - job: Detection displayName: Detection dependsOn: Agent + timeoutInMinutes: 15 pool: name: AZS-1ES-L-Playground-ubuntu-22.04 steps: - checkout: self - download: current artifact: agent_outputs_$(Build.BuildId) + - bash: | + mkdir -p "$(Build.SourcesDirectory)/safe_outputs" + cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" + displayName: Prepare safe outputs for analysis - bash: | set -euo pipefail TARBALL_NAME="copilot-linux-x64.tar.gz" @@ -586,7 +583,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -601,7 +598,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - task: DockerInstaller@0 inputs: dockerVersion: 26.1.4 @@ -609,7 +606,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -626,19 +623,14 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest - displayName: Pre-pull AWF container images (v0.27.9) - - bash: | - mkdir -p "$(Build.SourcesDirectory)/safe_outputs" - cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" - displayName: Prepare safe outputs for analysis + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 + displayName: Pre-pull AWF container images (v0.27.32) - bash: | # Write threat analysis prompt to /tmp (accessible inside AWF container) cat > "/tmp/awf-tools/threat-analysis-prompt.md" << 'THREAT_ANALYSIS_EOF_2e7f277d8c1b' @@ -695,14 +687,17 @@ jobs: THREAT_OUTPUT_FILE="$(Agent.TempDirectory)/threat-analysis-output.txt" # Stream threat analysis output in real-time with VSO command filtering - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2016 # The single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/threat-analysis-logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-tool github --allow-tool safeoutputs --allow-tool "shell(az)" --allow-tool "shell(head)"' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$THREAT_OUTPUT_FILE" \ @@ -807,7 +802,7 @@ jobs: artifact: analyzed_outputs_$(Build.BuildId) - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -822,7 +817,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | ls -la "$(Pipeline.Workspace)/agentic-pipeline-compiler" chmod +x "$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" @@ -832,7 +827,11 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging" displayName: Prepare output directory - bash: | - ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/azure-cli.md" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" + mkdir -p "$(Agent.TempDirectory)/ado-aw-custom" + printf '%s' 'ewogICJjYWNoZU1lbW9yeSI6IG51bGwsCiAgImNoZWNrb3V0IjogW10sCiAgImN1c3RvbVRvb2xzIjogW10sCiAgImRlYnVnQ3JlYXRlSXNzdWUiOiBudWxsLAogICJuYW1lIjogIkRhaWx5IHNtb2tlOiBheiBDTEkgYWNjZXNzIiwKICAicmVwb1JlZnMiOiB7fSwKICAicmVwb3NpdG9yaWVzIjogW10sCiAgInRvb2xDb25maWdzIjogewogICAgIm5vb3AiOiB7CiAgICAgICJzdGFnZWQiOiBmYWxzZQogICAgfQogIH0KfQ==' | base64 --decode > "$(Agent.TempDirectory)/ado-aw-resolved-config.json" + displayName: Write custom job runtime config + - bash: | + ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/azure-cli.md" --resolved-config "$(Agent.TempDirectory)/ado-aw-resolved-config.json" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" EXIT_CODE=$? if [ $EXIT_CODE -eq 2 ]; then echo "##vso[task.complete result=SucceededWithIssues;]Executor completed with warnings" @@ -892,11 +891,11 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() - task: DownloadPipelineArtifact@2 diff --git a/tests/safe-outputs/canary.lock.yml b/tests/safe-outputs/canary.lock.yml index 9e7553798..d538ba16e 100644 --- a/tests/safe-outputs/canary.lock.yml +++ b/tests/safe-outputs/canary.lock.yml @@ -1,5 +1,5 @@ # This file is auto-generated by ado-aw. Do not edit manually. -# @ado-aw source="tests/safe-outputs/canary.md" version=0.45.1 +# @ado-aw source="tests/safe-outputs/canary.md" version=0.47.0 name: Daily safe-output smoke canary-$(BuildID) resources: @@ -84,7 +84,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -99,7 +99,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | AGENTIC_PIPELINES_PATH="$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" chmod +x "$AGENTIC_PIPELINES_PATH" @@ -118,24 +118,64 @@ jobs: # These duplicate the compile-time values baked into the YAML, but MCPG's # Docker container requires MCP_GATEWAY_PORT and MCP_GATEWAY_DOMAIN env vars # to start — the ADO variable indirection satisfies that contract. - echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]80" - echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]host.docker.internal" + echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]8080" + echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]awmg-mcpg" # Write MCPG (MCP Gateway) configuration to a file cat > "$(Agent.TempDirectory)/staging/mcpg-config.json" << 'MCPG_CONFIG_EOF' { "mcpServers": { "safeoutputs": { - "type": "http", - "url": "http://localhost:${SAFE_OUTPUTS_PORT}/mcp", - "headers": { - "Authorization": "Bearer ${SAFE_OUTPUTS_API_KEY}" + "type": "stdio", + "container": "ghcr.io/github/gh-aw-firewall/agent:0.27.32", + "entrypoint": "/usr/local/bin/ado-aw", + "entrypointArgs": [ + "mcp", + "--enabled-tools", + "add-build-tag", + "--enabled-tools", + "create-work-item", + "--enabled-tools", + "missing-data", + "--enabled-tools", + "missing-tool", + "--enabled-tools", + "noop", + "--enabled-tools", + "report-incomplete", + "/safeoutputs", + "$(Build.SourcesDirectory)" + ], + "mounts": [ + "/tmp/awf-tools/ado-aw:/usr/local/bin/ado-aw:ro", + "$(Build.SourcesDirectory):$(Build.SourcesDirectory):rw", + "/tmp/awf-tools/staging:/safeoutputs:rw" + ], + "args": [ + "--network", + "none", + "--user", + "${MCP_RUNNER_UID}:${MCP_RUNNER_GID}", + "--cap-drop", + "ALL", + "--security-opt", + "no-new-privileges", + "--read-only", + "--tmpfs", + "/tmp:rw,nosuid,nodev,noexec", + "--pids-limit", + "256", + "-w", + "$(Build.SourcesDirectory)" + ], + "env": { + "HOME": "/tmp" } } }, "gateway": { - "port": 80, - "domain": "host.docker.internal", + "port": 8080, + "domain": "awmg-mcpg", "apiKey": "${MCP_GATEWAY_API_KEY}", "payloadDir": "/tmp/gh-aw/mcp-payloads" } @@ -168,6 +208,9 @@ jobs: # Copy MCPG config to /tmp cp "$(Agent.TempDirectory)/staging/mcpg-config.json" /tmp/awf-tools/staging/mcpg-config.json + if [ -f "$(Agent.TempDirectory)/staging/custom-tools.json" ]; then + cp "$(Agent.TempDirectory)/staging/custom-tools.json" /tmp/awf-tools/staging/custom-tools.json + fi displayName: Prepare tooling - bash: | # Write agent instructions to /tmp so it's accessible inside AWF container @@ -185,7 +228,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -202,16 +245,15 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 docker pull ghcr.io/github/gh-aw-mcpg:v0.4.1 - displayName: Pre-pull AWF and MCPG container images (v0.27.9) + displayName: Pre-pull AWF and MCPG container images (v0.27.32) - task: UseNode@1 inputs: version: 22.x @@ -221,28 +263,28 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() - bash: | set -eo pipefail - node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "Build.Repository.Name=$(Build.Repository.Name)" + node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.BuildId=$(Build.BuildId)" --var "Build.Repository.Name=$(Build.Repository.Name)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "System.CollectionUri=$(System.CollectionUri)" displayName: Resolve runtime imports (agent prompt) condition: succeeded() - bash: | - # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/canary.md","target":"standalone","version":"0.45.1"} - echo 'ado-aw metadata: source=tests/safe-outputs/canary.md org= repo= version=0.45.1 target=standalone' + # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/canary.md","target":"standalone","version":"0.47.0"} + echo 'ado-aw metadata: source=tests/safe-outputs/canary.md org= repo= version=0.47.0 target=standalone' displayName: ado-aw - bash: | set -eo pipefail mkdir -p "$(Agent.TempDirectory)/staging" cat >"$(Agent.TempDirectory)/staging/aw_info.json" <<'AW_INFO_EOF' - {"agent_name":"Daily safe-output smoke: canary","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.45.1","engine":"copilot","model":"gpt-5-mini","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/canary.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} + {"agent_name":"Daily safe-output smoke: canary","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.47.0","engine":"copilot","model":"claude-sonnet-4.6","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/canary.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} AW_INFO_EOF displayName: Emit aw_info.json condition: always() @@ -288,50 +330,13 @@ jobs: echo "Azure CLI prompt appended" displayName: Append Azure CLI prompt condition: ne(variables['AW_AZ_MOUNTS'], '') - - bash: | - SAFE_OUTPUTS_PORT=8100 - SAFE_OUTPUTS_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PORT]$SAFE_OUTPUTS_PORT" - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_API_KEY;issecret=true]$SAFE_OUTPUTS_API_KEY" - - mkdir -p "$(Agent.TempDirectory)/staging/logs" - - # Start SafeOutputs as HTTP server in the background - # NOTE: --enabled-tools add-build-tag --enabled-tools create-work-item --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete expands to either "" or "--enabled-tools X ... " - # (with trailing space). The value MUST be newline-free; is_safe_tool_name enforces this. - # Positional args (output_directory, bounding_directory) MUST come after all named - # options — clap parses them positionally and reordering would break the command. - nohup /tmp/awf-tools/ado-aw mcp-http \ - --port "$SAFE_OUTPUTS_PORT" \ - --api-key "$SAFE_OUTPUTS_API_KEY" \ - --enabled-tools add-build-tag --enabled-tools create-work-item --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete "/tmp/awf-tools/staging" \ - "$(Build.SourcesDirectory)" \ - > "$(Agent.TempDirectory)/staging/logs/safeoutputs.log" 2>&1 & - SAFE_OUTPUTS_PID=$! - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PID]$SAFE_OUTPUTS_PID" - echo "SafeOutputs HTTP server started on port $SAFE_OUTPUTS_PORT (PID: $SAFE_OUTPUTS_PID)" - - # Wait for server to be ready - READY=false - # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop - for i in $(seq 1 30); do - if curl -sf "http://localhost:$SAFE_OUTPUTS_PORT/health" > /dev/null 2>&1; then - echo "SafeOutputs HTTP server is ready" - READY=true - break - fi - sleep 1 - done - if [ "$READY" != "true" ]; then - echo "##vso[task.complete result=Failed]SafeOutputs HTTP server did not become ready within 30s" - exit 1 - fi - displayName: Start SafeOutputs HTTP server - bash: | # Substitute runtime values into MCPG config + MCP_RUNNER_UID=$(id -u) + MCP_RUNNER_GID=$(id -g) MCPG_CONFIG=$(sed \ - -e "s|\${SAFE_OUTPUTS_PORT}|$(SAFE_OUTPUTS_PORT)|g" \ - -e "s|\${SAFE_OUTPUTS_API_KEY}|$(SAFE_OUTPUTS_API_KEY)|g" \ + -e "s|\${MCP_RUNNER_UID}|$MCP_RUNNER_UID|g" \ + -e "s|\${MCP_RUNNER_GID}|$MCP_RUNNER_GID|g" \ -e "s|\${MCP_GATEWAY_API_KEY}|$(MCP_GATEWAY_API_KEY)|g" \ /tmp/awf-tools/staging/mcpg-config.json) @@ -341,26 +346,22 @@ jobs: # Remove any leftover container or stale output from a previous interrupted run # (--rm only cleans up on clean exit; OOM/SIGKILL may leave it behind) - docker rm -f mcpg 2>/dev/null || true + docker rm -f awmg-mcpg 2>/dev/null || true GATEWAY_OUTPUT="/tmp/gh-aw/mcp-config/gateway-output.json" mkdir -p "$(dirname "$GATEWAY_OUTPUT")" /tmp/gh-aw/mcp-logs rm -f "$GATEWAY_OUTPUT" - # Start MCPG Docker container on host network. + # Start MCPG on Docker's bridge network. AWF attaches this named, + # trusted container to its internal network after creating awf-net. # The Docker socket mount is required because MCPG spawns stdio-based MCP # servers as sibling containers. This grants significant host access — acceptable # here because the pipeline agent is already trusted and network-isolated by AWF. # - # WORKAROUND: Override entrypoint to bypass run_containerized.sh which has a - # validate_port_mapping() bug — it calls `docker inspect .NetworkSettings.Ports` - # which is empty with --network host (by design), causing a spurious error: - # [ERROR] Port 80 is not exposed from the container - # Upstream fix: https://github.com/github/gh-aw-mcpg/issues/TBD - # # stdout → gateway-output.json (machine-readable config, read after health check) echo "$MCPG_CONFIG" | docker run -i --rm \ - --name mcpg \ - --network host \ + --name awmg-mcpg \ + --network bridge \ + -p 127.0.0.1:8080:8080 \ --entrypoint /app/awmg \ -v /var/run/docker.sock:/var/run/docker.sock \ -e MCP_GATEWAY_PORT="$(MCP_GATEWAY_PORT)" \ @@ -369,7 +370,7 @@ jobs: \ \ ghcr.io/github/gh-aw-mcpg:v0.4.1 \ - --routed --listen 0.0.0.0:80 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ + --routed --listen 0.0.0.0:8080 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ > "$GATEWAY_OUTPUT" 2> >(tee /tmp/gh-aw/mcp-logs/stderr.log >&2) & MCPG_PID=$! echo "MCPG started (PID: $MCPG_PID)" @@ -378,7 +379,7 @@ jobs: READY=false # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop for i in $(seq 1 30); do - if curl -sf "http://localhost:80/health" > /dev/null 2>&1; then + if curl -sf "http://localhost:8080/health" > /dev/null 2>&1; then echo "MCPG is ready" READY=true break @@ -415,8 +416,8 @@ jobs: # Convert gateway output to Copilot CLI mcp-config.json. # Mirrors gh-aw's convert_gateway_config_copilot.cjs: - # - Rewrite URLs from 127.0.0.1 to host.docker.internal (AWF container needs - # host.docker.internal to reach MCPG on the host; 127.0.0.1 is container loopback) + # - Rewrite gateway URLs to the stable MCPG container name that AWF + # attaches to its internal network # - Ensure tools: ["*"] on each server entry (Copilot CLI requirement) # - Mark generated MCPG entries as default/trusted servers for Copilot CLI # - Preserve all other fields (headers, type, etc.) @@ -436,28 +437,30 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging/logs" echo "=== Running AI agent with AWF network isolation ===" - echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" + echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" - # AWF provides L7 domain whitelisting via Squid proxy + Docker containers. - # --enable-host-access allows the AWF container to reach host services - # (MCPG and SafeOutputs) via host.docker.internal. + # AWF provides L7 domain whitelisting via a rootless Docker topology. + # The named MCPG container is attached to AWF's internal network as a + # trusted endpoint; the agent has no route to the host. # AWF auto-mounts /tmp:/tmp:rw into the container, so copilot binary, # agent prompt, and MCP config are placed under /tmp/awf-tools/. # Stream agent output in real-time while filtering VSO commands. # sed -u = unbuffered (line-by-line) so output appears immediately. # tee writes to both stdout (ADO pipeline log) and the artifact file. # pipefail (set above) ensures AWF's exit code propagates through the pipe. - # shellcheck disable=SC2046 # $(AW_AZ_MOUNTS) is an ADO macro substituted before bash sees it, not bash command substitution; word-splitting the expanded value into separate --mount tokens is intentional - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2046,SC2016 # ADO macros are substituted before bash; the single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --topology-attach "awmg-mcpg" \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ - --enable-host-access \ - $(AW_AZ_MOUNTS) \ + $(AW_AZ_MOUNTS) \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/staging/logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- 'export NO_PROXY="${NO_PROXY:+$NO_PROXY,}awmg-mcpg"; export no_proxy="$NO_PROXY"; /tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$AGENT_OUTPUT_FILE" \ @@ -497,16 +500,9 @@ jobs: - bash: | # Stop MCPG container echo "Stopping MCPG..." - docker stop mcpg 2>/dev/null || true - echo "MCPG stopped" - - # Stop SafeOutputs HTTP server - if [ -n "$(SAFE_OUTPUTS_PID)" ]; then - echo "Stopping SafeOutputs (PID: $(SAFE_OUTPUTS_PID))..." - kill "$(SAFE_OUTPUTS_PID)" 2>/dev/null || true - echo "SafeOutputs stopped" - fi - displayName: Stop MCPG and SafeOutputs + docker stop awmg-mcpg 2>/dev/null || true + echo "MCPG and stdio child containers stopped" + displayName: Stop MCPG condition: always() - bash: | # Copy all logs to output directory for artifact upload @@ -532,12 +528,17 @@ jobs: - job: Detection displayName: Detection dependsOn: Agent + timeoutInMinutes: 20 pool: name: AZS-1ES-L-Playground-ubuntu-22.04 steps: - checkout: self - download: current artifact: agent_outputs_$(Build.BuildId) + - bash: | + mkdir -p "$(Build.SourcesDirectory)/safe_outputs" + cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" + displayName: Prepare safe outputs for analysis - bash: | set -euo pipefail TARBALL_NAME="copilot-linux-x64.tar.gz" @@ -586,7 +587,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -601,7 +602,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - task: DockerInstaller@0 inputs: dockerVersion: 26.1.4 @@ -609,7 +610,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -626,19 +627,14 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest - displayName: Pre-pull AWF container images (v0.27.9) - - bash: | - mkdir -p "$(Build.SourcesDirectory)/safe_outputs" - cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" - displayName: Prepare safe outputs for analysis + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 + displayName: Pre-pull AWF container images (v0.27.32) - bash: | # Write threat analysis prompt to /tmp (accessible inside AWF container) cat > "/tmp/awf-tools/threat-analysis-prompt.md" << 'THREAT_ANALYSIS_EOF_289884b86904' @@ -695,14 +691,17 @@ jobs: THREAT_OUTPUT_FILE="$(Agent.TempDirectory)/threat-analysis-output.txt" # Stream threat analysis output in real-time with VSO command filtering - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2016 # The single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/threat-analysis-logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$THREAT_OUTPUT_FILE" \ @@ -819,7 +818,7 @@ jobs: artifact: analyzed_outputs_$(Build.BuildId) - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -834,7 +833,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | ls -la "$(Pipeline.Workspace)/agentic-pipeline-compiler" chmod +x "$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" @@ -844,7 +843,11 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging" displayName: Prepare output directory - bash: | - ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/canary.md" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" + mkdir -p "$(Agent.TempDirectory)/ado-aw-custom" + printf '%s' 'ewogICJjYWNoZU1lbW9yeSI6IG51bGwsCiAgImNoZWNrb3V0IjogW10sCiAgImN1c3RvbVRvb2xzIjogW10sCiAgImRlYnVnQ3JlYXRlSXNzdWUiOiBudWxsLAogICJuYW1lIjogIkRhaWx5IHNhZmUtb3V0cHV0IHNtb2tlOiBjYW5hcnkiLAogICJyZXBvUmVmcyI6IHt9LAogICJyZXBvc2l0b3JpZXMiOiBbXSwKICAidG9vbENvbmZpZ3MiOiB7CiAgICAiYWRkLWJ1aWxkLXRhZyI6IHsKICAgICAgIm1heCI6IDEsCiAgICAgICJzdGFnZWQiOiBmYWxzZSwKICAgICAgInRhZy1wcmVmaXgiOiAiYWRvLWF3LXNtb2tlLSIKICAgIH0sCiAgICAiY3JlYXRlLXdvcmstaXRlbSI6IHsKICAgICAgImFzc2lnbmVlIjogImRldmluZWphbWVzQG1pY3Jvc29mdC5jb20iLAogICAgICAiaW5jbHVkZS1zdGF0cyI6IGZhbHNlLAogICAgICAibWF4IjogMSwKICAgICAgInN0YWdlZCI6IGZhbHNlLAogICAgICAid29yay1pdGVtLXR5cGUiOiAiVGFzayIKICAgIH0sCiAgICAibm9vcCI6IHsKICAgICAgInN0YWdlZCI6IGZhbHNlCiAgICB9CiAgfQp9' | base64 --decode > "$(Agent.TempDirectory)/ado-aw-resolved-config.json" + displayName: Write custom job runtime config + - bash: | + ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/canary.md" --resolved-config "$(Agent.TempDirectory)/ado-aw-resolved-config.json" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" EXIT_CODE=$? if [ $EXIT_CODE -eq 2 ]; then echo "##vso[task.complete result=SucceededWithIssues;]Executor completed with warnings" @@ -904,13 +907,25 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() + - task: AzureCLI@2 + displayName: Acquire ADO token (SC_WRITE_TOKEN) + inputs: + azureSubscription: agent-playground-write + scriptType: bash + scriptLocation: inlineScript + addSpnToEnvironment: true + inlineScript: | + ADO_TOKEN=$(az account get-access-token \ + --resource 499b84ac-1321-427f-aa17-267ca6975798 \ + --query accessToken -o tsv) + echo "##vso[task.setvariable variable=SC_WRITE_TOKEN;issecret=true]$ADO_TOKEN" - task: DownloadPipelineArtifact@2 inputs: artifact: safe_outputs diff --git a/tests/safe-outputs/janitor.lock.yml b/tests/safe-outputs/janitor.lock.yml index e4b69847c..13a228b21 100644 --- a/tests/safe-outputs/janitor.lock.yml +++ b/tests/safe-outputs/janitor.lock.yml @@ -1,5 +1,5 @@ # This file is auto-generated by ado-aw. Do not edit manually. -# @ado-aw source="tests/safe-outputs/janitor.md" version=0.45.1 +# @ado-aw source="tests/safe-outputs/janitor.md" version=0.47.0 name: ado-aw smoke janitor-$(BuildID) resources: @@ -107,7 +107,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -122,7 +122,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | AGENTIC_PIPELINES_PATH="$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" chmod +x "$AGENTIC_PIPELINES_PATH" @@ -141,24 +141,60 @@ jobs: # These duplicate the compile-time values baked into the YAML, but MCPG's # Docker container requires MCP_GATEWAY_PORT and MCP_GATEWAY_DOMAIN env vars # to start — the ADO variable indirection satisfies that contract. - echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]80" - echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]host.docker.internal" + echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]8080" + echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]awmg-mcpg" # Write MCPG (MCP Gateway) configuration to a file cat > "$(Agent.TempDirectory)/staging/mcpg-config.json" << 'MCPG_CONFIG_EOF' { "mcpServers": { "safeoutputs": { - "type": "http", - "url": "http://localhost:${SAFE_OUTPUTS_PORT}/mcp", - "headers": { - "Authorization": "Bearer ${SAFE_OUTPUTS_API_KEY}" + "type": "stdio", + "container": "ghcr.io/github/gh-aw-firewall/agent:0.27.32", + "entrypoint": "/usr/local/bin/ado-aw", + "entrypointArgs": [ + "mcp", + "--enabled-tools", + "missing-data", + "--enabled-tools", + "missing-tool", + "--enabled-tools", + "noop", + "--enabled-tools", + "report-incomplete", + "/safeoutputs", + "$(Build.SourcesDirectory)" + ], + "mounts": [ + "/tmp/awf-tools/ado-aw:/usr/local/bin/ado-aw:ro", + "$(Build.SourcesDirectory):$(Build.SourcesDirectory):rw", + "/tmp/awf-tools/staging:/safeoutputs:rw" + ], + "args": [ + "--network", + "none", + "--user", + "${MCP_RUNNER_UID}:${MCP_RUNNER_GID}", + "--cap-drop", + "ALL", + "--security-opt", + "no-new-privileges", + "--read-only", + "--tmpfs", + "/tmp:rw,nosuid,nodev,noexec", + "--pids-limit", + "256", + "-w", + "$(Build.SourcesDirectory)" + ], + "env": { + "HOME": "/tmp" } } }, "gateway": { - "port": 80, - "domain": "host.docker.internal", + "port": 8080, + "domain": "awmg-mcpg", "apiKey": "${MCP_GATEWAY_API_KEY}", "payloadDir": "/tmp/gh-aw/mcp-payloads" } @@ -191,6 +227,9 @@ jobs: # Copy MCPG config to /tmp cp "$(Agent.TempDirectory)/staging/mcpg-config.json" /tmp/awf-tools/staging/mcpg-config.json + if [ -f "$(Agent.TempDirectory)/staging/custom-tools.json" ]; then + cp "$(Agent.TempDirectory)/staging/custom-tools.json" /tmp/awf-tools/staging/custom-tools.json + fi displayName: Prepare tooling - bash: | # Write agent instructions to /tmp so it's accessible inside AWF container @@ -208,7 +247,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -225,16 +264,15 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 docker pull ghcr.io/github/gh-aw-mcpg:v0.4.1 - displayName: Pre-pull AWF and MCPG container images (v0.27.9) + displayName: Pre-pull AWF and MCPG container images (v0.27.32) - task: UseNode@1 inputs: version: 22.x @@ -244,28 +282,28 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() - bash: | set -eo pipefail - node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "Build.Repository.Name=$(Build.Repository.Name)" + node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.BuildId=$(Build.BuildId)" --var "Build.Repository.Name=$(Build.Repository.Name)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "System.CollectionUri=$(System.CollectionUri)" displayName: Resolve runtime imports (agent prompt) condition: succeeded() - bash: | - # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/janitor.md","target":"standalone","version":"0.45.1"} - echo 'ado-aw metadata: source=tests/safe-outputs/janitor.md org= repo= version=0.45.1 target=standalone' + # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/janitor.md","target":"standalone","version":"0.47.0"} + echo 'ado-aw metadata: source=tests/safe-outputs/janitor.md org= repo= version=0.47.0 target=standalone' displayName: ado-aw - bash: | set -eo pipefail mkdir -p "$(Agent.TempDirectory)/staging" cat >"$(Agent.TempDirectory)/staging/aw_info.json" <<'AW_INFO_EOF' - {"agent_name":"ado-aw smoke janitor","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.45.1","engine":"copilot","model":"gpt-5-mini","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/janitor.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} + {"agent_name":"ado-aw smoke janitor","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.47.0","engine":"copilot","model":"claude-sonnet-4.6","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/janitor.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} AW_INFO_EOF displayName: Emit aw_info.json condition: always() @@ -311,50 +349,13 @@ jobs: echo "Azure CLI prompt appended" displayName: Append Azure CLI prompt condition: ne(variables['AW_AZ_MOUNTS'], '') - - bash: | - SAFE_OUTPUTS_PORT=8100 - SAFE_OUTPUTS_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PORT]$SAFE_OUTPUTS_PORT" - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_API_KEY;issecret=true]$SAFE_OUTPUTS_API_KEY" - - mkdir -p "$(Agent.TempDirectory)/staging/logs" - - # Start SafeOutputs as HTTP server in the background - # NOTE: --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete expands to either "" or "--enabled-tools X ... " - # (with trailing space). The value MUST be newline-free; is_safe_tool_name enforces this. - # Positional args (output_directory, bounding_directory) MUST come after all named - # options — clap parses them positionally and reordering would break the command. - nohup /tmp/awf-tools/ado-aw mcp-http \ - --port "$SAFE_OUTPUTS_PORT" \ - --api-key "$SAFE_OUTPUTS_API_KEY" \ - --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete "/tmp/awf-tools/staging" \ - "$(Build.SourcesDirectory)" \ - > "$(Agent.TempDirectory)/staging/logs/safeoutputs.log" 2>&1 & - SAFE_OUTPUTS_PID=$! - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PID]$SAFE_OUTPUTS_PID" - echo "SafeOutputs HTTP server started on port $SAFE_OUTPUTS_PORT (PID: $SAFE_OUTPUTS_PID)" - - # Wait for server to be ready - READY=false - # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop - for i in $(seq 1 30); do - if curl -sf "http://localhost:$SAFE_OUTPUTS_PORT/health" > /dev/null 2>&1; then - echo "SafeOutputs HTTP server is ready" - READY=true - break - fi - sleep 1 - done - if [ "$READY" != "true" ]; then - echo "##vso[task.complete result=Failed]SafeOutputs HTTP server did not become ready within 30s" - exit 1 - fi - displayName: Start SafeOutputs HTTP server - bash: | # Substitute runtime values into MCPG config + MCP_RUNNER_UID=$(id -u) + MCP_RUNNER_GID=$(id -g) MCPG_CONFIG=$(sed \ - -e "s|\${SAFE_OUTPUTS_PORT}|$(SAFE_OUTPUTS_PORT)|g" \ - -e "s|\${SAFE_OUTPUTS_API_KEY}|$(SAFE_OUTPUTS_API_KEY)|g" \ + -e "s|\${MCP_RUNNER_UID}|$MCP_RUNNER_UID|g" \ + -e "s|\${MCP_RUNNER_GID}|$MCP_RUNNER_GID|g" \ -e "s|\${MCP_GATEWAY_API_KEY}|$(MCP_GATEWAY_API_KEY)|g" \ /tmp/awf-tools/staging/mcpg-config.json) @@ -364,26 +365,22 @@ jobs: # Remove any leftover container or stale output from a previous interrupted run # (--rm only cleans up on clean exit; OOM/SIGKILL may leave it behind) - docker rm -f mcpg 2>/dev/null || true + docker rm -f awmg-mcpg 2>/dev/null || true GATEWAY_OUTPUT="/tmp/gh-aw/mcp-config/gateway-output.json" mkdir -p "$(dirname "$GATEWAY_OUTPUT")" /tmp/gh-aw/mcp-logs rm -f "$GATEWAY_OUTPUT" - # Start MCPG Docker container on host network. + # Start MCPG on Docker's bridge network. AWF attaches this named, + # trusted container to its internal network after creating awf-net. # The Docker socket mount is required because MCPG spawns stdio-based MCP # servers as sibling containers. This grants significant host access — acceptable # here because the pipeline agent is already trusted and network-isolated by AWF. # - # WORKAROUND: Override entrypoint to bypass run_containerized.sh which has a - # validate_port_mapping() bug — it calls `docker inspect .NetworkSettings.Ports` - # which is empty with --network host (by design), causing a spurious error: - # [ERROR] Port 80 is not exposed from the container - # Upstream fix: https://github.com/github/gh-aw-mcpg/issues/TBD - # # stdout → gateway-output.json (machine-readable config, read after health check) echo "$MCPG_CONFIG" | docker run -i --rm \ - --name mcpg \ - --network host \ + --name awmg-mcpg \ + --network bridge \ + -p 127.0.0.1:8080:8080 \ --entrypoint /app/awmg \ -v /var/run/docker.sock:/var/run/docker.sock \ -e MCP_GATEWAY_PORT="$(MCP_GATEWAY_PORT)" \ @@ -392,7 +389,7 @@ jobs: \ \ ghcr.io/github/gh-aw-mcpg:v0.4.1 \ - --routed --listen 0.0.0.0:80 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ + --routed --listen 0.0.0.0:8080 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ > "$GATEWAY_OUTPUT" 2> >(tee /tmp/gh-aw/mcp-logs/stderr.log >&2) & MCPG_PID=$! echo "MCPG started (PID: $MCPG_PID)" @@ -401,7 +398,7 @@ jobs: READY=false # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop for i in $(seq 1 30); do - if curl -sf "http://localhost:80/health" > /dev/null 2>&1; then + if curl -sf "http://localhost:8080/health" > /dev/null 2>&1; then echo "MCPG is ready" READY=true break @@ -438,8 +435,8 @@ jobs: # Convert gateway output to Copilot CLI mcp-config.json. # Mirrors gh-aw's convert_gateway_config_copilot.cjs: - # - Rewrite URLs from 127.0.0.1 to host.docker.internal (AWF container needs - # host.docker.internal to reach MCPG on the host; 127.0.0.1 is container loopback) + # - Rewrite gateway URLs to the stable MCPG container name that AWF + # attaches to its internal network # - Ensure tools: ["*"] on each server entry (Copilot CLI requirement) # - Mark generated MCPG entries as default/trusted servers for Copilot CLI # - Preserve all other fields (headers, type, etc.) @@ -459,28 +456,30 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging/logs" echo "=== Running AI agent with AWF network isolation ===" - echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" + echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" - # AWF provides L7 domain whitelisting via Squid proxy + Docker containers. - # --enable-host-access allows the AWF container to reach host services - # (MCPG and SafeOutputs) via host.docker.internal. + # AWF provides L7 domain whitelisting via a rootless Docker topology. + # The named MCPG container is attached to AWF's internal network as a + # trusted endpoint; the agent has no route to the host. # AWF auto-mounts /tmp:/tmp:rw into the container, so copilot binary, # agent prompt, and MCP config are placed under /tmp/awf-tools/. # Stream agent output in real-time while filtering VSO commands. # sed -u = unbuffered (line-by-line) so output appears immediately. # tee writes to both stdout (ADO pipeline log) and the artifact file. # pipefail (set above) ensures AWF's exit code propagates through the pipe. - # shellcheck disable=SC2046 # $(AW_AZ_MOUNTS) is an ADO macro substituted before bash sees it, not bash command substitution; word-splitting the expanded value into separate --mount tokens is intentional - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2046,SC2016 # ADO macros are substituted before bash; the single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --topology-attach "awmg-mcpg" \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ - --enable-host-access \ - $(AW_AZ_MOUNTS) \ + $(AW_AZ_MOUNTS) \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/staging/logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- 'export NO_PROXY="${NO_PROXY:+$NO_PROXY,}awmg-mcpg"; export no_proxy="$NO_PROXY"; /tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$AGENT_OUTPUT_FILE" \ @@ -520,16 +519,9 @@ jobs: - bash: | # Stop MCPG container echo "Stopping MCPG..." - docker stop mcpg 2>/dev/null || true - echo "MCPG stopped" - - # Stop SafeOutputs HTTP server - if [ -n "$(SAFE_OUTPUTS_PID)" ]; then - echo "Stopping SafeOutputs (PID: $(SAFE_OUTPUTS_PID))..." - kill "$(SAFE_OUTPUTS_PID)" 2>/dev/null || true - echo "SafeOutputs stopped" - fi - displayName: Stop MCPG and SafeOutputs + docker stop awmg-mcpg 2>/dev/null || true + echo "MCPG and stdio child containers stopped" + displayName: Stop MCPG condition: always() - bash: | # Copy all logs to output directory for artifact upload @@ -555,12 +547,17 @@ jobs: - job: Detection displayName: Detection dependsOn: Agent + timeoutInMinutes: 30 pool: name: AZS-1ES-L-Playground-ubuntu-22.04 steps: - checkout: self - download: current artifact: agent_outputs_$(Build.BuildId) + - bash: | + mkdir -p "$(Build.SourcesDirectory)/safe_outputs" + cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" + displayName: Prepare safe outputs for analysis - bash: | set -euo pipefail TARBALL_NAME="copilot-linux-x64.tar.gz" @@ -609,7 +606,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -624,7 +621,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - task: DockerInstaller@0 inputs: dockerVersion: 26.1.4 @@ -632,7 +629,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -649,19 +646,14 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest - displayName: Pre-pull AWF container images (v0.27.9) - - bash: | - mkdir -p "$(Build.SourcesDirectory)/safe_outputs" - cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" - displayName: Prepare safe outputs for analysis + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 + displayName: Pre-pull AWF container images (v0.27.32) - bash: | # Write threat analysis prompt to /tmp (accessible inside AWF container) cat > "/tmp/awf-tools/threat-analysis-prompt.md" << 'THREAT_ANALYSIS_EOF_1e9625ad0fd9' @@ -718,14 +710,17 @@ jobs: THREAT_OUTPUT_FILE="$(Agent.TempDirectory)/threat-analysis-output.txt" # Stream threat analysis output in real-time with VSO command filtering - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2016 # The single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/threat-analysis-logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$THREAT_OUTPUT_FILE" \ @@ -842,7 +837,7 @@ jobs: artifact: analyzed_outputs_$(Build.BuildId) - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -857,7 +852,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | ls -la "$(Pipeline.Workspace)/agentic-pipeline-compiler" chmod +x "$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" @@ -867,7 +862,11 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging" displayName: Prepare output directory - bash: | - ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/janitor.md" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" + mkdir -p "$(Agent.TempDirectory)/ado-aw-custom" + printf '%s' 'ewogICJjYWNoZU1lbW9yeSI6IG51bGwsCiAgImNoZWNrb3V0IjogW10sCiAgImN1c3RvbVRvb2xzIjogW10sCiAgImRlYnVnQ3JlYXRlSXNzdWUiOiBudWxsLAogICJuYW1lIjogImFkby1hdyBzbW9rZSBqYW5pdG9yIiwKICAicmVwb1JlZnMiOiB7fSwKICAicmVwb3NpdG9yaWVzIjogW10sCiAgInRvb2xDb25maWdzIjogewogICAgIm5vb3AiOiB7CiAgICAgICJzdGFnZWQiOiBmYWxzZQogICAgfQogIH0KfQ==' | base64 --decode > "$(Agent.TempDirectory)/ado-aw-resolved-config.json" + displayName: Write custom job runtime config + - bash: | + ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/janitor.md" --resolved-config "$(Agent.TempDirectory)/ado-aw-resolved-config.json" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" EXIT_CODE=$? if [ $EXIT_CODE -eq 2 ]; then echo "##vso[task.complete result=SucceededWithIssues;]Executor completed with warnings" @@ -927,13 +926,25 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() + - task: AzureCLI@2 + displayName: Acquire ADO token (SC_WRITE_TOKEN) + inputs: + azureSubscription: agent-playground-write + scriptType: bash + scriptLocation: inlineScript + addSpnToEnvironment: true + inlineScript: | + ADO_TOKEN=$(az account get-access-token \ + --resource 499b84ac-1321-427f-aa17-267ca6975798 \ + --query accessToken -o tsv) + echo "##vso[task.setvariable variable=SC_WRITE_TOKEN;issecret=true]$ADO_TOKEN" - task: DownloadPipelineArtifact@2 inputs: artifact: safe_outputs diff --git a/tests/safe-outputs/noop-target.lock.yml b/tests/safe-outputs/noop-target.lock.yml index 43628517c..9b40decd5 100644 --- a/tests/safe-outputs/noop-target.lock.yml +++ b/tests/safe-outputs/noop-target.lock.yml @@ -1,5 +1,5 @@ # This file is auto-generated by ado-aw. Do not edit manually. -# @ado-aw source="tests/safe-outputs/noop-target.md" version=0.45.1 +# @ado-aw source="tests/safe-outputs/noop-target.md" version=0.47.0 name: ado-aw smoke noop target-$(BuildID) resources: @@ -75,7 +75,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -90,7 +90,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | AGENTIC_PIPELINES_PATH="$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" chmod +x "$AGENTIC_PIPELINES_PATH" @@ -109,24 +109,60 @@ jobs: # These duplicate the compile-time values baked into the YAML, but MCPG's # Docker container requires MCP_GATEWAY_PORT and MCP_GATEWAY_DOMAIN env vars # to start — the ADO variable indirection satisfies that contract. - echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]80" - echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]host.docker.internal" + echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]8080" + echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]awmg-mcpg" # Write MCPG (MCP Gateway) configuration to a file cat > "$(Agent.TempDirectory)/staging/mcpg-config.json" << 'MCPG_CONFIG_EOF' { "mcpServers": { "safeoutputs": { - "type": "http", - "url": "http://localhost:${SAFE_OUTPUTS_PORT}/mcp", - "headers": { - "Authorization": "Bearer ${SAFE_OUTPUTS_API_KEY}" + "type": "stdio", + "container": "ghcr.io/github/gh-aw-firewall/agent:0.27.32", + "entrypoint": "/usr/local/bin/ado-aw", + "entrypointArgs": [ + "mcp", + "--enabled-tools", + "missing-data", + "--enabled-tools", + "missing-tool", + "--enabled-tools", + "noop", + "--enabled-tools", + "report-incomplete", + "/safeoutputs", + "$(Build.SourcesDirectory)" + ], + "mounts": [ + "/tmp/awf-tools/ado-aw:/usr/local/bin/ado-aw:ro", + "$(Build.SourcesDirectory):$(Build.SourcesDirectory):rw", + "/tmp/awf-tools/staging:/safeoutputs:rw" + ], + "args": [ + "--network", + "none", + "--user", + "${MCP_RUNNER_UID}:${MCP_RUNNER_GID}", + "--cap-drop", + "ALL", + "--security-opt", + "no-new-privileges", + "--read-only", + "--tmpfs", + "/tmp:rw,nosuid,nodev,noexec", + "--pids-limit", + "256", + "-w", + "$(Build.SourcesDirectory)" + ], + "env": { + "HOME": "/tmp" } } }, "gateway": { - "port": 80, - "domain": "host.docker.internal", + "port": 8080, + "domain": "awmg-mcpg", "apiKey": "${MCP_GATEWAY_API_KEY}", "payloadDir": "/tmp/gh-aw/mcp-payloads" } @@ -159,6 +195,9 @@ jobs: # Copy MCPG config to /tmp cp "$(Agent.TempDirectory)/staging/mcpg-config.json" /tmp/awf-tools/staging/mcpg-config.json + if [ -f "$(Agent.TempDirectory)/staging/custom-tools.json" ]; then + cp "$(Agent.TempDirectory)/staging/custom-tools.json" /tmp/awf-tools/staging/custom-tools.json + fi displayName: Prepare tooling - bash: | # Write agent instructions to /tmp so it's accessible inside AWF container @@ -176,7 +215,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -193,16 +232,15 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 docker pull ghcr.io/github/gh-aw-mcpg:v0.4.1 - displayName: Pre-pull AWF and MCPG container images (v0.27.9) + displayName: Pre-pull AWF and MCPG container images (v0.27.32) - task: UseNode@1 inputs: version: 22.x @@ -212,28 +250,28 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() - bash: | set -eo pipefail - node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "Build.Repository.Name=$(Build.Repository.Name)" + node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.BuildId=$(Build.BuildId)" --var "Build.Repository.Name=$(Build.Repository.Name)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "System.CollectionUri=$(System.CollectionUri)" displayName: Resolve runtime imports (agent prompt) condition: succeeded() - bash: | - # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/noop-target.md","target":"standalone","version":"0.45.1"} - echo 'ado-aw metadata: source=tests/safe-outputs/noop-target.md org= repo= version=0.45.1 target=standalone' + # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/noop-target.md","target":"standalone","version":"0.47.0"} + echo 'ado-aw metadata: source=tests/safe-outputs/noop-target.md org= repo= version=0.47.0 target=standalone' displayName: ado-aw - bash: | set -eo pipefail mkdir -p "$(Agent.TempDirectory)/staging" cat >"$(Agent.TempDirectory)/staging/aw_info.json" <<'AW_INFO_EOF' - {"agent_name":"ado-aw smoke noop target","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.45.1","engine":"copilot","model":"gpt-5-mini","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/noop-target.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} + {"agent_name":"ado-aw smoke noop target","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.47.0","engine":"copilot","model":"claude-sonnet-4.6","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/noop-target.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} AW_INFO_EOF displayName: Emit aw_info.json condition: always() @@ -279,50 +317,13 @@ jobs: echo "Azure CLI prompt appended" displayName: Append Azure CLI prompt condition: ne(variables['AW_AZ_MOUNTS'], '') - - bash: | - SAFE_OUTPUTS_PORT=8100 - SAFE_OUTPUTS_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PORT]$SAFE_OUTPUTS_PORT" - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_API_KEY;issecret=true]$SAFE_OUTPUTS_API_KEY" - - mkdir -p "$(Agent.TempDirectory)/staging/logs" - - # Start SafeOutputs as HTTP server in the background - # NOTE: --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete expands to either "" or "--enabled-tools X ... " - # (with trailing space). The value MUST be newline-free; is_safe_tool_name enforces this. - # Positional args (output_directory, bounding_directory) MUST come after all named - # options — clap parses them positionally and reordering would break the command. - nohup /tmp/awf-tools/ado-aw mcp-http \ - --port "$SAFE_OUTPUTS_PORT" \ - --api-key "$SAFE_OUTPUTS_API_KEY" \ - --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete "/tmp/awf-tools/staging" \ - "$(Build.SourcesDirectory)" \ - > "$(Agent.TempDirectory)/staging/logs/safeoutputs.log" 2>&1 & - SAFE_OUTPUTS_PID=$! - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PID]$SAFE_OUTPUTS_PID" - echo "SafeOutputs HTTP server started on port $SAFE_OUTPUTS_PORT (PID: $SAFE_OUTPUTS_PID)" - - # Wait for server to be ready - READY=false - # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop - for i in $(seq 1 30); do - if curl -sf "http://localhost:$SAFE_OUTPUTS_PORT/health" > /dev/null 2>&1; then - echo "SafeOutputs HTTP server is ready" - READY=true - break - fi - sleep 1 - done - if [ "$READY" != "true" ]; then - echo "##vso[task.complete result=Failed]SafeOutputs HTTP server did not become ready within 30s" - exit 1 - fi - displayName: Start SafeOutputs HTTP server - bash: | # Substitute runtime values into MCPG config + MCP_RUNNER_UID=$(id -u) + MCP_RUNNER_GID=$(id -g) MCPG_CONFIG=$(sed \ - -e "s|\${SAFE_OUTPUTS_PORT}|$(SAFE_OUTPUTS_PORT)|g" \ - -e "s|\${SAFE_OUTPUTS_API_KEY}|$(SAFE_OUTPUTS_API_KEY)|g" \ + -e "s|\${MCP_RUNNER_UID}|$MCP_RUNNER_UID|g" \ + -e "s|\${MCP_RUNNER_GID}|$MCP_RUNNER_GID|g" \ -e "s|\${MCP_GATEWAY_API_KEY}|$(MCP_GATEWAY_API_KEY)|g" \ /tmp/awf-tools/staging/mcpg-config.json) @@ -332,26 +333,22 @@ jobs: # Remove any leftover container or stale output from a previous interrupted run # (--rm only cleans up on clean exit; OOM/SIGKILL may leave it behind) - docker rm -f mcpg 2>/dev/null || true + docker rm -f awmg-mcpg 2>/dev/null || true GATEWAY_OUTPUT="/tmp/gh-aw/mcp-config/gateway-output.json" mkdir -p "$(dirname "$GATEWAY_OUTPUT")" /tmp/gh-aw/mcp-logs rm -f "$GATEWAY_OUTPUT" - # Start MCPG Docker container on host network. + # Start MCPG on Docker's bridge network. AWF attaches this named, + # trusted container to its internal network after creating awf-net. # The Docker socket mount is required because MCPG spawns stdio-based MCP # servers as sibling containers. This grants significant host access — acceptable # here because the pipeline agent is already trusted and network-isolated by AWF. # - # WORKAROUND: Override entrypoint to bypass run_containerized.sh which has a - # validate_port_mapping() bug — it calls `docker inspect .NetworkSettings.Ports` - # which is empty with --network host (by design), causing a spurious error: - # [ERROR] Port 80 is not exposed from the container - # Upstream fix: https://github.com/github/gh-aw-mcpg/issues/TBD - # # stdout → gateway-output.json (machine-readable config, read after health check) echo "$MCPG_CONFIG" | docker run -i --rm \ - --name mcpg \ - --network host \ + --name awmg-mcpg \ + --network bridge \ + -p 127.0.0.1:8080:8080 \ --entrypoint /app/awmg \ -v /var/run/docker.sock:/var/run/docker.sock \ -e MCP_GATEWAY_PORT="$(MCP_GATEWAY_PORT)" \ @@ -360,7 +357,7 @@ jobs: \ \ ghcr.io/github/gh-aw-mcpg:v0.4.1 \ - --routed --listen 0.0.0.0:80 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ + --routed --listen 0.0.0.0:8080 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ > "$GATEWAY_OUTPUT" 2> >(tee /tmp/gh-aw/mcp-logs/stderr.log >&2) & MCPG_PID=$! echo "MCPG started (PID: $MCPG_PID)" @@ -369,7 +366,7 @@ jobs: READY=false # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop for i in $(seq 1 30); do - if curl -sf "http://localhost:80/health" > /dev/null 2>&1; then + if curl -sf "http://localhost:8080/health" > /dev/null 2>&1; then echo "MCPG is ready" READY=true break @@ -406,8 +403,8 @@ jobs: # Convert gateway output to Copilot CLI mcp-config.json. # Mirrors gh-aw's convert_gateway_config_copilot.cjs: - # - Rewrite URLs from 127.0.0.1 to host.docker.internal (AWF container needs - # host.docker.internal to reach MCPG on the host; 127.0.0.1 is container loopback) + # - Rewrite gateway URLs to the stable MCPG container name that AWF + # attaches to its internal network # - Ensure tools: ["*"] on each server entry (Copilot CLI requirement) # - Mark generated MCPG entries as default/trusted servers for Copilot CLI # - Preserve all other fields (headers, type, etc.) @@ -427,28 +424,30 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging/logs" echo "=== Running AI agent with AWF network isolation ===" - echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" + echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" - # AWF provides L7 domain whitelisting via Squid proxy + Docker containers. - # --enable-host-access allows the AWF container to reach host services - # (MCPG and SafeOutputs) via host.docker.internal. + # AWF provides L7 domain whitelisting via a rootless Docker topology. + # The named MCPG container is attached to AWF's internal network as a + # trusted endpoint; the agent has no route to the host. # AWF auto-mounts /tmp:/tmp:rw into the container, so copilot binary, # agent prompt, and MCP config are placed under /tmp/awf-tools/. # Stream agent output in real-time while filtering VSO commands. # sed -u = unbuffered (line-by-line) so output appears immediately. # tee writes to both stdout (ADO pipeline log) and the artifact file. # pipefail (set above) ensures AWF's exit code propagates through the pipe. - # shellcheck disable=SC2046 # $(AW_AZ_MOUNTS) is an ADO macro substituted before bash sees it, not bash command substitution; word-splitting the expanded value into separate --mount tokens is intentional - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2046,SC2016 # ADO macros are substituted before bash; the single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --topology-attach "awmg-mcpg" \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ - --enable-host-access \ - $(AW_AZ_MOUNTS) \ + $(AW_AZ_MOUNTS) \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/staging/logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- 'export NO_PROXY="${NO_PROXY:+$NO_PROXY,}awmg-mcpg"; export no_proxy="$NO_PROXY"; /tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$AGENT_OUTPUT_FILE" \ @@ -488,16 +487,9 @@ jobs: - bash: | # Stop MCPG container echo "Stopping MCPG..." - docker stop mcpg 2>/dev/null || true - echo "MCPG stopped" - - # Stop SafeOutputs HTTP server - if [ -n "$(SAFE_OUTPUTS_PID)" ]; then - echo "Stopping SafeOutputs (PID: $(SAFE_OUTPUTS_PID))..." - kill "$(SAFE_OUTPUTS_PID)" 2>/dev/null || true - echo "SafeOutputs stopped" - fi - displayName: Stop MCPG and SafeOutputs + docker stop awmg-mcpg 2>/dev/null || true + echo "MCPG and stdio child containers stopped" + displayName: Stop MCPG condition: always() - bash: | # Copy all logs to output directory for artifact upload @@ -523,12 +515,17 @@ jobs: - job: Detection displayName: Detection dependsOn: Agent + timeoutInMinutes: 10 pool: name: AZS-1ES-L-Playground-ubuntu-22.04 steps: - checkout: self - download: current artifact: agent_outputs_$(Build.BuildId) + - bash: | + mkdir -p "$(Build.SourcesDirectory)/safe_outputs" + cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" + displayName: Prepare safe outputs for analysis - bash: | set -euo pipefail TARBALL_NAME="copilot-linux-x64.tar.gz" @@ -577,7 +574,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -592,7 +589,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - task: DockerInstaller@0 inputs: dockerVersion: 26.1.4 @@ -600,7 +597,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -617,19 +614,14 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest - displayName: Pre-pull AWF container images (v0.27.9) - - bash: | - mkdir -p "$(Build.SourcesDirectory)/safe_outputs" - cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" - displayName: Prepare safe outputs for analysis + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 + displayName: Pre-pull AWF container images (v0.27.32) - bash: | # Write threat analysis prompt to /tmp (accessible inside AWF container) cat > "/tmp/awf-tools/threat-analysis-prompt.md" << 'THREAT_ANALYSIS_EOF_4a4e4b79c985' @@ -686,14 +678,17 @@ jobs: THREAT_OUTPUT_FILE="$(Agent.TempDirectory)/threat-analysis-output.txt" # Stream threat analysis output in real-time with VSO command filtering - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2016 # The single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + --network-isolation \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/threat-analysis-logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$THREAT_OUTPUT_FILE" \ @@ -798,7 +793,7 @@ jobs: artifact: analyzed_outputs_$(Build.BuildId) - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -813,7 +808,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | ls -la "$(Pipeline.Workspace)/agentic-pipeline-compiler" chmod +x "$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" @@ -823,7 +818,11 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging" displayName: Prepare output directory - bash: | - ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/noop-target.md" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" + mkdir -p "$(Agent.TempDirectory)/ado-aw-custom" + printf '%s' 'ewogICJjYWNoZU1lbW9yeSI6IG51bGwsCiAgImNoZWNrb3V0IjogW10sCiAgImN1c3RvbVRvb2xzIjogW10sCiAgImRlYnVnQ3JlYXRlSXNzdWUiOiBudWxsLAogICJuYW1lIjogImFkby1hdyBzbW9rZSBub29wIHRhcmdldCIsCiAgInJlcG9SZWZzIjoge30sCiAgInJlcG9zaXRvcmllcyI6IFtdLAogICJ0b29sQ29uZmlncyI6IHsKICAgICJub29wIjogewogICAgICAic3RhZ2VkIjogZmFsc2UKICAgIH0KICB9Cn0=' | base64 --decode > "$(Agent.TempDirectory)/ado-aw-resolved-config.json" + displayName: Write custom job runtime config + - bash: | + ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/noop-target.md" --resolved-config "$(Agent.TempDirectory)/ado-aw-resolved-config.json" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" EXIT_CODE=$? if [ $EXIT_CODE -eq 2 ]; then echo "##vso[task.complete result=SucceededWithIssues;]Executor completed with warnings" @@ -883,11 +882,11 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() - task: DownloadPipelineArtifact@2 diff --git a/tests/safe-outputs/smoke-failure-reporter.lock.yml b/tests/safe-outputs/smoke-failure-reporter.lock.yml index 056591481..b4088514c 100644 --- a/tests/safe-outputs/smoke-failure-reporter.lock.yml +++ b/tests/safe-outputs/smoke-failure-reporter.lock.yml @@ -1,5 +1,5 @@ # This file is auto-generated by ado-aw. Do not edit manually. -# @ado-aw source="tests/safe-outputs/smoke-failure-reporter.md" version=0.45.1 +# @ado-aw source="tests/safe-outputs/smoke-failure-reporter.md" version=0.47.0 name: ado-aw smoke failure reporter-$(BuildID) resources: @@ -84,7 +84,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -99,7 +99,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | AGENTIC_PIPELINES_PATH="$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" chmod +x "$AGENTIC_PIPELINES_PATH" @@ -118,24 +118,88 @@ jobs: # These duplicate the compile-time values baked into the YAML, but MCPG's # Docker container requires MCP_GATEWAY_PORT and MCP_GATEWAY_DOMAIN env vars # to start — the ADO variable indirection satisfies that contract. - echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]80" - echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]host.docker.internal" + echo "##vso[task.setvariable variable=MCP_GATEWAY_PORT]8080" + echo "##vso[task.setvariable variable=MCP_GATEWAY_DOMAIN]awmg-mcpg" # Write MCPG (MCP Gateway) configuration to a file cat > "$(Agent.TempDirectory)/staging/mcpg-config.json" << 'MCPG_CONFIG_EOF' { "mcpServers": { + "azure-devops": { + "type": "stdio", + "container": "node:20-slim", + "entrypoint": "npx", + "entrypointArgs": [ + "-y", + "@azure-devops/mcp", + "msazuresphere", + "-d", + "pipelines", + "-a", + "envvar" + ], + "args": [ + "--network", + "host" + ], + "env": { + "ADO_MCP_AUTH_TOKEN": "" + }, + "tools": [ + "pipelines_definition", + "pipelines_build", + "pipelines_build_log" + ] + }, "safeoutputs": { - "type": "http", - "url": "http://localhost:${SAFE_OUTPUTS_PORT}/mcp", - "headers": { - "Authorization": "Bearer ${SAFE_OUTPUTS_API_KEY}" + "type": "stdio", + "container": "ghcr.io/github/gh-aw-firewall/agent:0.27.32", + "entrypoint": "/usr/local/bin/ado-aw", + "entrypointArgs": [ + "mcp", + "--enabled-tools", + "create-issue", + "--enabled-tools", + "missing-data", + "--enabled-tools", + "missing-tool", + "--enabled-tools", + "noop", + "--enabled-tools", + "report-incomplete", + "/safeoutputs", + "$(Build.SourcesDirectory)" + ], + "mounts": [ + "/tmp/awf-tools/ado-aw:/usr/local/bin/ado-aw:ro", + "$(Build.SourcesDirectory):$(Build.SourcesDirectory):rw", + "/tmp/awf-tools/staging:/safeoutputs:rw" + ], + "args": [ + "--network", + "none", + "--user", + "${MCP_RUNNER_UID}:${MCP_RUNNER_GID}", + "--cap-drop", + "ALL", + "--security-opt", + "no-new-privileges", + "--read-only", + "--tmpfs", + "/tmp:rw,nosuid,nodev,noexec", + "--pids-limit", + "256", + "-w", + "$(Build.SourcesDirectory)" + ], + "env": { + "HOME": "/tmp" } } }, "gateway": { - "port": 80, - "domain": "host.docker.internal", + "port": 8080, + "domain": "awmg-mcpg", "apiKey": "${MCP_GATEWAY_API_KEY}", "payloadDir": "/tmp/gh-aw/mcp-payloads" } @@ -168,6 +232,9 @@ jobs: # Copy MCPG config to /tmp cp "$(Agent.TempDirectory)/staging/mcpg-config.json" /tmp/awf-tools/staging/mcpg-config.json + if [ -f "$(Agent.TempDirectory)/staging/custom-tools.json" ]; then + cp "$(Agent.TempDirectory)/staging/custom-tools.json" /tmp/awf-tools/staging/custom-tools.json + fi displayName: Prepare tooling - bash: | # Write agent instructions to /tmp so it's accessible inside AWF container @@ -185,7 +252,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -202,16 +269,15 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 docker pull ghcr.io/github/gh-aw-mcpg:v0.4.1 - displayName: Pre-pull AWF and MCPG container images (v0.27.9) + displayName: Pre-pull AWF and MCPG container images (v0.27.32) - task: UseNode@1 inputs: version: 22.x @@ -221,28 +287,28 @@ jobs: - bash: | set -eo pipefail mkdir -p /tmp/ado-aw-scripts - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt - curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.45.1/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/checksums.txt" -o /tmp/ado-aw-scripts/checksums.txt + curl -fsSL "https://github.com/githubnext/ado-aw/releases/download/v0.47.0/ado-script.zip" -o /tmp/ado-aw-scripts/ado-script.zip cd /tmp/ado-aw-scripts && grep "ado-script.zip" checksums.txt | sha256sum -c - unzip -o /tmp/ado-aw-scripts/ado-script.zip -d /tmp/ado-aw-scripts/ - displayName: Download ado-aw scripts (v0.45.1) + displayName: Download ado-aw scripts (v0.47.0) timeoutInMinutes: 5 condition: succeeded() - bash: | set -eo pipefail - node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "Build.Repository.Name=$(Build.Repository.Name)" + node '/tmp/ado-aw-scripts/ado-script/import.js' /tmp/awf-tools/agent-prompt.md --base "$(Build.SourcesDirectory)" --var "Build.BuildId=$(Build.BuildId)" --var "Build.Repository.Name=$(Build.Repository.Name)" --var "Build.SourcesDirectory=$(Build.SourcesDirectory)" --var "System.CollectionUri=$(System.CollectionUri)" displayName: Resolve runtime imports (agent prompt) condition: succeeded() - bash: | - # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/smoke-failure-reporter.md","target":"standalone","version":"0.45.1"} - echo 'ado-aw metadata: source=tests/safe-outputs/smoke-failure-reporter.md org= repo= version=0.45.1 target=standalone' + # ado-aw-metadata: {"org":"","repo":"","schema":1,"source":"tests/safe-outputs/smoke-failure-reporter.md","target":"standalone","version":"0.47.0"} + echo 'ado-aw metadata: source=tests/safe-outputs/smoke-failure-reporter.md org= repo= version=0.47.0 target=standalone' displayName: ado-aw - bash: | set -eo pipefail mkdir -p "$(Agent.TempDirectory)/staging" cat >"$(Agent.TempDirectory)/staging/aw_info.json" <<'AW_INFO_EOF' - {"agent_name":"ado-aw smoke failure reporter","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.45.1","engine":"copilot","model":"gpt-5-mini","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/smoke-failure-reporter.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} + {"agent_name":"ado-aw smoke failure reporter","build_definition_id":"$(System.DefinitionId)","build_id":"$(Build.BuildId)","compiler_version":"0.47.0","engine":"copilot","model":"claude-sonnet-4.6","org":"","repo":"","schema":"ado-aw/aw_info/1","source":"tests/safe-outputs/smoke-failure-reporter.md","source_branch":"$(Build.SourceBranch)","source_version":"$(Build.SourceVersion)","target":"standalone"} AW_INFO_EOF displayName: Emit aw_info.json condition: always() @@ -288,50 +354,13 @@ jobs: echo "Azure CLI prompt appended" displayName: Append Azure CLI prompt condition: ne(variables['AW_AZ_MOUNTS'], '') - - bash: | - SAFE_OUTPUTS_PORT=8100 - SAFE_OUTPUTS_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PORT]$SAFE_OUTPUTS_PORT" - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_API_KEY;issecret=true]$SAFE_OUTPUTS_API_KEY" - - mkdir -p "$(Agent.TempDirectory)/staging/logs" - - # Start SafeOutputs as HTTP server in the background - # NOTE: --enabled-tools create-issue --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete expands to either "" or "--enabled-tools X ... " - # (with trailing space). The value MUST be newline-free; is_safe_tool_name enforces this. - # Positional args (output_directory, bounding_directory) MUST come after all named - # options — clap parses them positionally and reordering would break the command. - nohup /tmp/awf-tools/ado-aw mcp-http \ - --port "$SAFE_OUTPUTS_PORT" \ - --api-key "$SAFE_OUTPUTS_API_KEY" \ - --enabled-tools create-issue --enabled-tools missing-data --enabled-tools missing-tool --enabled-tools noop --enabled-tools report-incomplete "/tmp/awf-tools/staging" \ - "$(Build.SourcesDirectory)" \ - > "$(Agent.TempDirectory)/staging/logs/safeoutputs.log" 2>&1 & - SAFE_OUTPUTS_PID=$! - echo "##vso[task.setvariable variable=SAFE_OUTPUTS_PID]$SAFE_OUTPUTS_PID" - echo "SafeOutputs HTTP server started on port $SAFE_OUTPUTS_PORT (PID: $SAFE_OUTPUTS_PID)" - - # Wait for server to be ready - READY=false - # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop - for i in $(seq 1 30); do - if curl -sf "http://localhost:$SAFE_OUTPUTS_PORT/health" > /dev/null 2>&1; then - echo "SafeOutputs HTTP server is ready" - READY=true - break - fi - sleep 1 - done - if [ "$READY" != "true" ]; then - echo "##vso[task.complete result=Failed]SafeOutputs HTTP server did not become ready within 30s" - exit 1 - fi - displayName: Start SafeOutputs HTTP server - bash: | # Substitute runtime values into MCPG config + MCP_RUNNER_UID=$(id -u) + MCP_RUNNER_GID=$(id -g) MCPG_CONFIG=$(sed \ - -e "s|\${SAFE_OUTPUTS_PORT}|$(SAFE_OUTPUTS_PORT)|g" \ - -e "s|\${SAFE_OUTPUTS_API_KEY}|$(SAFE_OUTPUTS_API_KEY)|g" \ + -e "s|\${MCP_RUNNER_UID}|$MCP_RUNNER_UID|g" \ + -e "s|\${MCP_RUNNER_GID}|$MCP_RUNNER_GID|g" \ -e "s|\${MCP_GATEWAY_API_KEY}|$(MCP_GATEWAY_API_KEY)|g" \ /tmp/awf-tools/staging/mcpg-config.json) @@ -341,35 +370,30 @@ jobs: # Remove any leftover container or stale output from a previous interrupted run # (--rm only cleans up on clean exit; OOM/SIGKILL may leave it behind) - docker rm -f mcpg 2>/dev/null || true + docker rm -f awmg-mcpg 2>/dev/null || true GATEWAY_OUTPUT="/tmp/gh-aw/mcp-config/gateway-output.json" mkdir -p "$(dirname "$GATEWAY_OUTPUT")" /tmp/gh-aw/mcp-logs rm -f "$GATEWAY_OUTPUT" - # Start MCPG Docker container on host network. + # Start MCPG on Docker's bridge network. AWF attaches this named, + # trusted container to its internal network after creating awf-net. # The Docker socket mount is required because MCPG spawns stdio-based MCP # servers as sibling containers. This grants significant host access — acceptable # here because the pipeline agent is already trusted and network-isolated by AWF. # - # WORKAROUND: Override entrypoint to bypass run_containerized.sh which has a - # validate_port_mapping() bug — it calls `docker inspect .NetworkSettings.Ports` - # which is empty with --network host (by design), causing a spurious error: - # [ERROR] Port 80 is not exposed from the container - # Upstream fix: https://github.com/github/gh-aw-mcpg/issues/TBD - # # stdout → gateway-output.json (machine-readable config, read after health check) echo "$MCPG_CONFIG" | docker run -i --rm \ - --name mcpg \ - --network host \ + --name awmg-mcpg \ + --network bridge \ + -p 127.0.0.1:8080:8080 \ --entrypoint /app/awmg \ -v /var/run/docker.sock:/var/run/docker.sock \ -e MCP_GATEWAY_PORT="$(MCP_GATEWAY_PORT)" \ -e MCP_GATEWAY_DOMAIN="$(MCP_GATEWAY_DOMAIN)" \ -e MCP_GATEWAY_API_KEY="$(MCP_GATEWAY_API_KEY)" \ - \ - \ + -e ADO_MCP_AUTH_TOKEN="$SC_READ_TOKEN" \ ghcr.io/github/gh-aw-mcpg:v0.4.1 \ - --routed --listen 0.0.0.0:80 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ + --routed --listen 0.0.0.0:8080 --config-stdin --log-dir /tmp/gh-aw/mcp-logs \ > "$GATEWAY_OUTPUT" 2> >(tee /tmp/gh-aw/mcp-logs/stderr.log >&2) & MCPG_PID=$! echo "MCPG started (PID: $MCPG_PID)" @@ -378,7 +402,7 @@ jobs: READY=false # shellcheck disable=SC2034 # i is intentionally unused; wait-N-times loop for i in $(seq 1 30); do - if curl -sf "http://localhost:80/health" > /dev/null 2>&1; then + if curl -sf "http://localhost:8080/health" > /dev/null 2>&1; then echo "MCPG is ready" READY=true break @@ -415,8 +439,8 @@ jobs: # Convert gateway output to Copilot CLI mcp-config.json. # Mirrors gh-aw's convert_gateway_config_copilot.cjs: - # - Rewrite URLs from 127.0.0.1 to host.docker.internal (AWF container needs - # host.docker.internal to reach MCPG on the host; 127.0.0.1 is container loopback) + # - Rewrite gateway URLs to the stable MCPG container name that AWF + # attaches to its internal network # - Ensure tools: ["*"] on each server entry (Copilot CLI requirement) # - Mark generated MCPG entries as default/trusted servers for Copilot CLI # - Preserve all other fields (headers, type, etc.) @@ -429,6 +453,8 @@ jobs: echo "Generated MCP config at: /tmp/awf-tools/mcp-config.json" cat /tmp/awf-tools/mcp-config.json displayName: Start MCP Gateway (MCPG) + env: + SC_READ_TOKEN: $(SC_READ_TOKEN) - bash: | set -o pipefail @@ -436,28 +462,30 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging/logs" echo "=== Running AI agent with AWF network isolation ===" - echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" + echo "Allowed domains: *.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,api.npms.io,bun.sh,cdn.jsdelivr.net,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,deb.nodesource.com,deno.land,dev.azure.com,esm.sh,get.pnpm.io,github.com,googleapis.deno.dev,googlechromelabs.github.io,graph.microsoft.com,jsr.io,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,nodejs.org,npm.pkg.github.com,npmjs.com,npmjs.org,pkgs.dev.azure.com,registry.bower.io,registry.npmjs.com,registry.npmjs.org,registry.yarnpkg.com,repo.yarnpkg.com,rt.services.visualstudio.com,skimdb.npmjs.com,storage.googleapis.com,telemetry.vercel.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com,www.npmjs.com,www.npmjs.org,yarnpkg.com" - # AWF provides L7 domain whitelisting via Squid proxy + Docker containers. - # --enable-host-access allows the AWF container to reach host services - # (MCPG and SafeOutputs) via host.docker.internal. + # AWF provides L7 domain whitelisting via a rootless Docker topology. + # The named MCPG container is attached to AWF's internal network as a + # trusted endpoint; the agent has no route to the host. # AWF auto-mounts /tmp:/tmp:rw into the container, so copilot binary, # agent prompt, and MCP config are placed under /tmp/awf-tools/. # Stream agent output in real-time while filtering VSO commands. # sed -u = unbuffered (line-by-line) so output appears immediately. # tee writes to both stdout (ADO pipeline log) and the artifact file. # pipefail (set above) ensures AWF's exit code propagates through the pipe. - # shellcheck disable=SC2046 # $(AW_AZ_MOUNTS) is an ADO macro substituted before bash sees it, not bash command substitution; word-splitting the expanded value into separate --mount tokens is intentional - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2046,SC2016 # ADO macros are substituted before bash; the single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,api.npms.io,bun.sh,cdn.jsdelivr.net,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,deb.nodesource.com,deno.land,dev.azure.com,esm.sh,get.pnpm.io,github.com,googleapis.deno.dev,googlechromelabs.github.io,graph.microsoft.com,jsr.io,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,nodejs.org,npm.pkg.github.com,npmjs.com,npmjs.org,pkgs.dev.azure.com,registry.bower.io,registry.npmjs.com,registry.npmjs.org,registry.yarnpkg.com,repo.yarnpkg.com,rt.services.visualstudio.com,skimdb.npmjs.com,storage.googleapis.com,telemetry.vercel.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com,www.npmjs.com,www.npmjs.org,yarnpkg.com" \ + --network-isolation \ + --topology-attach "awmg-mcpg" \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ - --enable-host-access \ - $(AW_AZ_MOUNTS) \ + $(AW_AZ_MOUNTS) \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/staging/logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- 'export NO_PROXY="${NO_PROXY:+$NO_PROXY,}awmg-mcpg"; export no_proxy="$NO_PROXY"; /tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/agent-prompt.md)" --additional-mcp-config @/tmp/awf-tools/mcp-config.json --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-tool azure-devops --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$AGENT_OUTPUT_FILE" \ @@ -489,16 +517,9 @@ jobs: - bash: | # Stop MCPG container echo "Stopping MCPG..." - docker stop mcpg 2>/dev/null || true - echo "MCPG stopped" - - # Stop SafeOutputs HTTP server - if [ -n "$(SAFE_OUTPUTS_PID)" ]; then - echo "Stopping SafeOutputs (PID: $(SAFE_OUTPUTS_PID))..." - kill "$(SAFE_OUTPUTS_PID)" 2>/dev/null || true - echo "SafeOutputs stopped" - fi - displayName: Stop MCPG and SafeOutputs + docker stop awmg-mcpg 2>/dev/null || true + echo "MCPG and stdio child containers stopped" + displayName: Stop MCPG condition: always() - bash: | # Copy all logs to output directory for artifact upload @@ -524,12 +545,17 @@ jobs: - job: Detection displayName: Detection dependsOn: Agent + timeoutInMinutes: 20 pool: name: AZS-1ES-L-Playground-ubuntu-22.04 steps: - checkout: self - download: current artifact: agent_outputs_$(Build.BuildId) + - bash: | + mkdir -p "$(Build.SourcesDirectory)/safe_outputs" + cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" + displayName: Prepare safe outputs for analysis - bash: | set -euo pipefail TARBALL_NAME="copilot-linux-x64.tar.gz" @@ -578,7 +604,7 @@ jobs: displayName: Output copilot version - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -593,7 +619,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - task: DockerInstaller@0 inputs: dockerVersion: 26.1.4 @@ -601,7 +627,7 @@ jobs: - bash: | set -eo pipefail - AWF_VERSION="0.27.9" + AWF_VERSION="0.27.32" DOWNLOAD_DIR="$(Pipeline.Workspace)/awf" DOWNLOAD_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/awf-linux-x64" CHECKSUM_URL="https://github.com/github/gh-aw-firewall/releases/download/v${AWF_VERSION}/checksums.txt" @@ -618,19 +644,14 @@ jobs: chmod +x awf echo "##vso[task.prependpath]$(Pipeline.Workspace)/awf" ./awf --version - displayName: Download AWF (Agentic Workflow Firewall) v0.27.9 + displayName: Download AWF (Agentic Workflow Firewall) v0.27.32 - bash: | set -eo pipefail - docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.9 - docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.9 - docker tag ghcr.io/github/gh-aw-firewall/squid:0.27.9 ghcr.io/github/gh-aw-firewall/squid:latest - docker tag ghcr.io/github/gh-aw-firewall/agent:0.27.9 ghcr.io/github/gh-aw-firewall/agent:latest - displayName: Pre-pull AWF container images (v0.27.9) - - bash: | - mkdir -p "$(Build.SourcesDirectory)/safe_outputs" - cp -a "$(Pipeline.Workspace)/agent_outputs_$(Build.BuildId)/." "$(Build.SourcesDirectory)/safe_outputs" - displayName: Prepare safe outputs for analysis + docker pull ghcr.io/github/gh-aw-firewall/squid:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/agent:0.27.32 + docker pull ghcr.io/github/gh-aw-firewall/api-proxy:0.27.32 + displayName: Pre-pull AWF container images (v0.27.32) - bash: | # Write threat analysis prompt to /tmp (accessible inside AWF container) cat > "/tmp/awf-tools/threat-analysis-prompt.md" << 'THREAT_ANALYSIS_EOF_13f2a688652c' @@ -687,14 +708,17 @@ jobs: THREAT_OUTPUT_FILE="$(Agent.TempDirectory)/threat-analysis-output.txt" # Stream threat analysis output in real-time with VSO command filtering - sudo -E "$(Pipeline.Workspace)/awf/awf" \ - --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,dev.azure.com,github.com,graph.microsoft.com,host.docker.internal,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,pkgs.dev.azure.com,rt.services.visualstudio.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com" \ + # shellcheck disable=SC2016 # The single-quoted engine command is intentionally expanded by AWF inside the sandbox + "$(Pipeline.Workspace)/awf/awf" \ + --allow-domains "*.applicationinsights.azure.com,*.blob.core.windows.net,*.copilot.github.com,*.dev.azure.com,*.github.com,*.githubcopilot.com,*.githubusercontent.com,*.in.applicationinsights.azure.com,*.msauth.net,*.msauthimages.net,*.msftauth.net,*.pkgs.dev.azure.com,*.queue.core.windows.net,*.table.core.windows.net,*.visualstudio.com,*.vsassets.io,*.vsblob.visualstudio.com,*.vsrm.dev.azure.com,*.vssps.visualstudio.com,aex.dev.azure.com,aexus.dev.azure.com,aka.ms,api.github.com,api.npms.io,bun.sh,cdn.jsdelivr.net,config.edge.skype.com,copilot-proxy.githubusercontent.com,dc.services.visualstudio.com,deb.nodesource.com,deno.land,dev.azure.com,esm.sh,get.pnpm.io,github.com,googleapis.deno.dev,googlechromelabs.github.io,graph.microsoft.com,jsr.io,login.live.com,login.microsoftonline.com,login.windows.net,management.azure.com,nodejs.org,npm.pkg.github.com,npmjs.com,npmjs.org,pkgs.dev.azure.com,registry.bower.io,registry.npmjs.com,registry.npmjs.org,registry.yarnpkg.com,repo.yarnpkg.com,rt.services.visualstudio.com,skimdb.npmjs.com,storage.googleapis.com,telemetry.vercel.com,vsrm.dev.azure.com,vssps.dev.azure.com,vstoken.dev.azure.com,www.npmjs.com,www.npmjs.org,yarnpkg.com" \ + --network-isolation \ + --image-tag "0.27.32" \ --skip-pull \ --env-all \ --container-workdir "$(Build.SourcesDirectory)" \ --log-level info \ --proxy-logs-dir "$(Agent.TempDirectory)/threat-analysis-logs/firewall" \ - -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model gpt-5-mini --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-all-paths' \ + -- '/tmp/awf-tools/copilot --prompt "$(cat /tmp/awf-tools/threat-analysis-prompt.md)" --model claude-sonnet-4.6 --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-tool github --allow-tool safeoutputs --allow-tool azure-devops --allow-all-paths' \ 2>&1 \ | sed -u 's/##vso\[/[VSO-FILTERED] vso[/g; s/##\[/[VSO-FILTERED] [/g' \ | tee "$THREAT_OUTPUT_FILE" \ @@ -811,7 +835,7 @@ jobs: artifact: analyzed_outputs_$(Build.BuildId) - bash: | set -eo pipefail - COMPILER_VERSION="0.45.1" + COMPILER_VERSION="0.47.0" DOWNLOAD_DIR="$(Pipeline.Workspace)/agentic-pipeline-compiler" DOWNLOAD_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/ado-aw-linux-x64" CHECKSUM_URL="https://github.com/githubnext/ado-aw/releases/download/v${COMPILER_VERSION}/checksums.txt" @@ -826,7 +850,7 @@ jobs: grep "ado-aw-linux-x64" checksums.txt | sha256sum -c - mv ado-aw-linux-x64 ado-aw chmod +x ado-aw - displayName: Download agentic pipeline compiler (v0.45.1) + displayName: Download agentic pipeline compiler (v0.47.0) - bash: | ls -la "$(Pipeline.Workspace)/agentic-pipeline-compiler" chmod +x "$(Pipeline.Workspace)/agentic-pipeline-compiler/ado-aw" @@ -836,7 +860,11 @@ jobs: mkdir -p "$(Agent.TempDirectory)/staging" displayName: Prepare output directory - bash: | - ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/smoke-failure-reporter.md" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" + mkdir -p "$(Agent.TempDirectory)/ado-aw-custom" + printf '%s' 'ewogICJjYWNoZU1lbW9yeSI6IG51bGwsCiAgImNoZWNrb3V0IjogW10sCiAgImN1c3RvbVRvb2xzIjogW10sCiAgImRlYnVnQ3JlYXRlSXNzdWUiOiB7CiAgICAiYWxsb3dlZC1sYWJlbHMiOiBbCiAgICAgICJwaXBlbGluZS1mYWlsdXJlIiwKICAgICAgImFkby1hdy1zbW9rZSIKICAgIF0sCiAgICAiYXNzaWduZWVzIjogW10sCiAgICAibGFiZWxzIjogWwogICAgICAicGlwZWxpbmUtZmFpbHVyZSIsCiAgICAgICJhZG8tYXctc21va2UiCiAgICBdLAogICAgIm1heCI6IDUsCiAgICAidGFyZ2V0LXJlcG8iOiAiamFtZXNhZGV2aW5lL2Fkby1hdy1pc3N1ZXMiLAogICAgInRpdGxlLXByZWZpeCI6ICJbc21va2UtZmFpbHVyZV0gIgogIH0sCiAgIm5hbWUiOiAiYWRvLWF3IHNtb2tlIGZhaWx1cmUgcmVwb3J0ZXIiLAogICJyZXBvUmVmcyI6IHt9LAogICJyZXBvc2l0b3JpZXMiOiBbXSwKICAidG9vbENvbmZpZ3MiOiB7fQp9' | base64 --decode > "$(Agent.TempDirectory)/ado-aw-resolved-config.json" + displayName: Write custom job runtime config + - bash: | + ado-aw execute --source "$(Build.SourcesDirectory)/tests/safe-outputs/smoke-failure-reporter.md" --resolved-config "$(Agent.TempDirectory)/ado-aw-resolved-config.json" --safe-output-dir "$(Pipeline.Workspace)/analyzed_outputs_$(Build.BuildId)" --output-dir "$(Agent.TempDirectory)/staging" EXIT_CODE=$? if [ $EXIT_CODE -eq 2 ]; then echo "##vso[task.complete result=SucceededWithIssues;]Executor completed with warnings"