Skip to content

Commit 22303ee

Browse files
fix(security): comprehensive security audit remediation (22 findings, 37 files) (#684)
* fix(security): eliminate CI injection vectors and pin actions (#1) - Move all github.event.* expressions from run: to env: blocks (CWE-94) - spell-check.yml: changed_files via env var - markdown-link-check.yml: changed_files via temp file input - ai-spec-drafter.yml: issue.number via env var - ai-test-generator.yml: pull_request.number via env var - ai-release-notes.yml: release.tag_name via env var - sbom.yml: release.tag_name via env var - Redact secret scanner output to prevent secret leaks to CI logs (CWE-200) - SHA-pin dtolnay/rust-toolchain (the only unpinned action) (CWE-829) - Add missing permissions: block to markdown-link-check.yml (CWE-250) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(security): supply chain hardening — dep confusion, lockfiles, Dockerfile digest (#2) - Fix dependency confusion: replace agent-primitives==0.1.0 with local file references in scak and iatp requirements.txt (CWE-427) - Pin root Dockerfile base image to SHA digest (CWE-829) - Generate missing package-lock.json for 4 npm packages (CWE-829): mcp-proxy, api, chrome extension, mastra-agentmesh - Remove unsafe npm ci || npm install fallback in ESRP pipeline (CWE-829) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(security): Docker/infra hardening — CORS, Grafana, .dockerignore, CODEOWNERS (#3) - Replace hardcoded Grafana admin passwords with env var refs in 7 docker-compose files (CWE-798) - Replace wildcard CORS allow_origins=[*] with env-driven origins in 6 production services (CWE-942) - Add secret exclusion patterns (.env, *.key, *.pem, *.p12) to root and caas .dockerignore files (CWE-532) - Add security contact, supported versions, and 90-day disclosure policy to SECURITY.md (CWE-693) - Add CODEOWNERS rules for scripts/, Dockerfile, docker-compose*, .dockerignore, .clusterfuzzlite/ (CWE-862) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(security): code quality — XSS, Rust panics, example warnings (#4) - Replace innerHTML with safe DOM APIs (textContent, createElement) in PolicyEditorPanel.ts and MetricsDashboardPanel.ts (CWE-79) - Add HTML entity escaping for violation names in metrics dashboard - Replace .unwrap() with .expect() on production RwLock/Mutex calls in policy.rs for clearer panic messages (CWE-252) - Add INTENTIONALLY INSECURE warnings to test fixture code in github-reviewer example to prevent copy-paste propagation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e2592fc commit 22303ee

File tree

37 files changed

+20870
-43
lines changed

37 files changed

+20870
-43
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,13 @@
1717
.vscode
1818
coverage.xml
1919
node_modules
20+
21+
# Security: exclude secrets from build context
22+
.env
23+
.env.*
24+
*.key
25+
*.pem
26+
*.p12
27+
*.crt
28+
secrets/
29+
*.token

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
/packages/*/src/**/identity* @microsoft/agent-governance-toolkit
2828
/packages/*/src/**/crypto* @microsoft/agent-governance-toolkit
2929

30+
# Infrastructure & container security — require maintainer review
31+
/scripts/ @microsoft/agent-governance-toolkit
32+
**/Dockerfile @microsoft/agent-governance-toolkit
33+
**/docker-compose* @microsoft/agent-governance-toolkit
34+
/.dockerignore @microsoft/agent-governance-toolkit
35+
/.clusterfuzzlite/ @microsoft/agent-governance-toolkit
36+
3037
# Documentation
3138
/docs/ @microsoft/agent-governance-toolkit
3239
*.md @microsoft/agent-governance-toolkit

.github/workflows/ai-release-notes.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ jobs:
3232
id: prs
3333
env:
3434
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
EVENT_TAG: ${{ github.event.release.tag_name }}
36+
INPUT_TAG: ${{ inputs.tag }}
3537
run: |
36-
TAG="${{ github.event.release.tag_name || inputs.tag }}"
38+
TAG="${EVENT_TAG:-$INPUT_TAG}"
3739
if [ -z "$TAG" ]; then
3840
TAG=$(gh release list --limit 1 --json tagName -q '.[0].tagName' 2>/dev/null || echo "")
3941
fi

.github/workflows/ai-spec-drafter.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ jobs:
125125
- name: Comment on issue
126126
env:
127127
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
ISSUE_NUMBER: ${{ github.event.issue.number }}
128129
run: |
129-
gh issue comment ${{ github.event.issue.number }} \
130+
gh issue comment "$ISSUE_NUMBER" \
130131
--body "🤖 An engineering spec has been drafted and a PR created. Please review the PR for the full specification." \
131132
|| true

.github/workflows/ai-test-generator.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ jobs:
4444
id: changes
4545
env:
4646
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
PR_NUMBER: ${{ github.event.pull_request.number }}
4748
run: |
48-
FILES=$(gh pr diff ${{ github.event.pull_request.number }} --name-only \
49+
FILES=$(gh pr diff "$PR_NUMBER" --name-only \
4950
| grep -E '^packages/[^/]+/src/.*\.py$' || true)
5051
if [ -z "$FILES" ]; then
5152
echo "skip=true" >> "$GITHUB_OUTPUT"

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ jobs:
403403
runs-on: ubuntu-latest
404404
steps:
405405
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
406-
- uses: dtolnay/rust-toolchain@stable
406+
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
407407
- name: Build
408408
working-directory: packages/agent-mesh/sdks/rust/agentmesh
409409
run: cargo build --release

.github/workflows/markdown-link-check.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- '**/*.md'
77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
link-check:
1114
runs-on: ubuntu-latest
@@ -20,12 +23,15 @@ jobs:
2023
files: |
2124
**/*.md
2225
26+
- name: Write changed files list
27+
if: steps.changed-files.outputs.any_changed == 'true'
28+
env:
29+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
30+
run: printf '%s\n' $CHANGED_FILES > "$RUNNER_TEMP/changed-md-files.txt"
31+
2332
- name: Run Link Checker
2433
if: steps.changed-files.outputs.any_changed == 'true'
2534
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
2635
with:
27-
# Configuration is defined here directly in YAML (no JSON file needed)
28-
# --exclude-loopback: ignores localhost/127.0.0.1
29-
# --verbose: shows details in the logs
30-
args: --verbose --no-progress --exclude-loopback ${{ steps.changed-files.outputs.all_changed_files }}
36+
args: --verbose --no-progress --exclude-loopback --input "${{ runner.temp }}/changed-md-files.txt"
3137
fail: true

.github/workflows/sbom.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ jobs:
4949
if: github.event_name == 'release'
5050
env:
5151
GH_TOKEN: ${{ github.token }}
52+
RELEASE_TAG: ${{ github.event.release.tag_name }}
5253
run: |
53-
gh release upload "${{ github.event.release.tag_name }}" \
54+
gh release upload "$RELEASE_TAG" \
5455
sbom.spdx.json \
5556
sbom.cdx.json \
5657
--clobber

.github/workflows/secret-scanning.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
2>/dev/null || true)
5656
if [ -n "$MATCHES" ]; then
5757
echo "::warning::Potential secrets found matching pattern: $pattern"
58-
echo "$MATCHES" | head -5
58+
echo "$MATCHES" | head -5 | sed 's/:.*/:***REDACTED***/'
5959
FOUND=1
6060
fi
6161
done

.github/workflows/spell-check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ jobs:
3333

3434
- name: Check spelling
3535
if: steps.changed-markdown.outputs.any_changed == 'true'
36-
run: cspell --config .cspell.json --no-progress ${{ steps.changed-markdown.outputs.all_changed_files }}
36+
env:
37+
CHANGED_FILES: ${{ steps.changed-markdown.outputs.all_changed_files }}
38+
run: cspell --config .cspell.json --no-progress $CHANGED_FILES

0 commit comments

Comments
 (0)