Skip to content

Community agent and starter-kit security scans and PR gates - #132

Draft
yousefi-msft wants to merge 13 commits into
mainfrom
users/yousefi-msft/community-review-pipeline
Draft

Community agent and starter-kit security scans and PR gates#132
yousefi-msft wants to merge 13 commits into
mainfrom
users/yousefi-msft/community-review-pipeline

Conversation

@yousefi-msft

Copy link
Copy Markdown
Contributor

Harden catalog contribution validation & site-wide security automation

Refactors the PR validator into a modular, content-inspecting rule engine and
adds layered, full-site security scanning. New analyzers and the weekly scan are
report-only during rollout so they do not block internal catalog contributions.

Validation engine — refactor & new architecture

  • Split the 1,187-line validate_pr.py monolith into a modular package
    (.github/scripts/catalog_validation/): runner.py (orchestrator),
    contribution.py (1p/3p + docs-only/image classification),
    contributor_scope.py (POL-021 trusted-path gate), structural.py,
    schema_checks.py, policy_checks.py, documentation.py, schemas.py,
    findings.py. validate_pr.py is now a thin CLI wrapper.
  • Pluggable rule engine (.github/scripts/rules/): base.py
    (Rule/Finding/Severity/Scope), registry.py (rule discovery + run +
    waiver/baseline handling), and individual rule modules pol_008,
    pol_014pol_020, tag_001, tag_002.
  • New content-based security rules (replace extension denylists):
    • POL-008 — content/libmagic binary detection (catches binaries disguised
      with text extensions) via new content_sniffer.py.
    • POL-014–POL-020 — new policy rules (unsafe-Unicode / UTF-8 validation,
      source-allowlist, tag taxonomy, etc.).
    • POL-021 — trusted-path contributor scoping (only maintainers may touch
      .github, schemas, .auto-registry, .vscode, utilities, root config).

New security / analysis scripts

  • contact_network_validator.py + .github/policy/contact-network.json
    validates publisher contact domains.
  • url_reputation_audit.py — URLhaus / PhishTank reputation lookups.
  • image_inspector.py, dockerfile_parser.py, list_base_images.py +
    .github/policy/base-images.yaml — base-image allowlist & inspection.
  • spellcheck_prose.py — non-blocking prose spellcheck (SPELL-001).
  • compute_tags.py + .github/policy/tag-taxonomy.yaml — tag
    computation / taxonomy.
  • generate_baseline.py + .github/policy/baseline.json — ratchet baseline
    for existing-catalog drift.
  • generate_rule_docs.py, render_ci_summary.py, run_validation_workflow.py,
    source_locations.py.
  • Policy config added: source-allowlist.yaml, waivers.yaml,
    codespell-ignore.txt, .github/codeql/codeql-config.yml,
    .github/requirements-ci.txt, .config/dotnet-tools.json.

Workflows

  • New: code-scan.yml (CodeQL + DevSkim + ApplicationInspector),
    weekly-deep-scan.yml (every-rule × every-file + base-image CVE + URL
    reputation, report-only), dependency-review.yml.
  • Reworked: pr-review.yml (author-permission resolution, dual-checkout,
    spellcheck, TruffleHog verified + audit, render summary),
    validate-everything.yml (full-repo + optional PR inspection),
    unit-tests.yml, validate-agent-schemas.yml,
    validate-starter-kit-schema.yml, validate-starter-kits.yml,
    update-registry.yml, auto-merge-on-approval.yml,
    check-agent-removal-impact.yml.
  • Expanded dependabot.yml (pip + actions ecosystems) and CODEOWNERS.

Schemas & docs

  • Schema hardening across all 7 files in docs/schemas/ (agent-schema-v2,
    tool-definition, metadata, registry, starter-kit + starter-kit-registry, new
    common-schema.json).
  • New docs: validation-rules.md, validation-rules.csv,
    validation-workflow-testing.md; updates to CONTRIBUTING.md,
    SECURITY.md, README.md, agent-authoring-guide.md.
  • Minor catalog fixes: tool.yaml base-image updates for opensta,
    rtl-ivlg-linter, rtl-yosys-syn, xyce; kit.json fix for
    chip-synthesis-timing.

Tests added (~30 files; 439 passing / 3 skipped on Linux CI)

  • Per-rule suites (.github/tests/rules/): conftest.py (seeds real
    .github/policy/), test_pol_008, test_pol_014test_pol_020,
    test_tag_001, test_tag_002, test_registry, test_compute_tags,
    test_content_sniffer.
  • Security / automation suites: test_security_automation.py,
    test_schema_security.py, test_url_reputation_audit.py,
    test_contact_network_validator.py, test_validate_pr_pol021.py
    (maintainer-exemption / trusted-path).
  • Generator / infra suites: test_generators.py,
    test_render_ci_summary.py, test_run_validation_workflow.py,
    test_source_locations.py, test_spellcheck_prose.py,
    test_validation_inventory.py.
  • Existing-behavior suites: test_check_agent_removal_impact.py,
    test_validate_starter_kits.py.

Net effect

Moves from a single extension-based validator to a modular, content-inspecting
rule engine with full-site (report-only) scanning, maintainer-scoped trusted
paths, and broad test coverage — while keeping new analyzers non-blocking so
internal catalog contributions are not gated.

Note: POL-008 / POL-020 tests depend on the Linux file / libmagic utility
and are verified on ubuntu-latest (they fail locally on Windows where
file is absent — an environment artifact, not a code defect).

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-actions github-actions Bot added 1p-contribution Authored by Microsoft (party='1p' in metadata) pr-validation-failed The pr-review workflow's validator failed; see inline comments. labels Aug 27, 2026
Comment thread .github/workflows/validate-everything.yml
Comment thread .github/workflows/validate-everything.yml
Comment thread .github/workflows/validate-everything.yml
Comment on lines +335 to +348
- name: Run starter-kit validation against PR data
id: starter_kits
if: steps.integration.outcome == 'success'
continue-on-error: true
run: |
mapfile -t added_kits < "$RUNNER_TEMP/added-kits.txt"
args=(--repo-root "$GITHUB_WORKSPACE/evaluation" --added-kits)
if (( ${#added_kits[@]} )); then
args+=("${added_kits[@]}")
fi
python trusted/.github/scripts/validate_starter_kits.py "${args[@]}" \
| tee "$RUNNER_TEMP/shadow-validation/starter-kits.txt"

- name: Run removal-impact validation without write access
Comment on lines +348 to +369
- name: Run removal-impact validation without write access
id: removal_impact
if: steps.integration.outcome == 'success'
continue-on-error: true
env:
BASE_SHA: ${{ steps.target.outputs.base-sha }}
IS_FORK: ${{ steps.target.outputs.is-fork }}
PR_NUMBER: ${{ steps.target.outputs.number }}
run: |
args=(
--repo-root "$GITHUB_WORKSPACE/evaluation"
--base-sha "$BASE_SHA"
--pr-number "$PR_NUMBER"
--repo "$GITHUB_REPOSITORY"
)
if [[ "$IS_FORK" == "true" ]]; then
args+=(--is-fork)
fi
python trusted/.github/scripts/check_agent_removal_impact.py "${args[@]}" \
| tee "$RUNNER_TEMP/shadow-validation/removal-impact.txt"

- name: Summarize report-only results
Comment on lines +369 to +407
- name: Summarize report-only results
if: always()
env:
PR_NUMBER: ${{ steps.target.outputs.number }}
PR_URL: ${{ steps.target.outputs.url }}
PR_TITLE: ${{ steps.target.outputs.title }}
HEAD_REPOSITORY: ${{ steps.target.outputs.head-repository }}
IS_FORK: ${{ steps.target.outputs.is-fork }}
CHANGED_COUNT: ${{ steps.target.outputs.changed-count }}
INTEGRATION_OUTCOME: ${{ steps.integration.outcome }}
CATALOG_OUTCOME: ${{ steps.catalog.outcome }}
SCHEMA_OUTCOME: ${{ steps.schemas.outcome }}
STARTER_KIT_OUTCOME: ${{ steps.starter_kits.outcome }}
REMOVAL_OUTCOME: ${{ steps.removal_impact.outcome }}
REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }}
VALIDATOR_REVISION: ${{ github.sha }}
run: |
python .github/scripts/validate_starter_kits.py --repo-root .
# Report only: this workflow did not change or publish a check to the target PR.
python trusted/.github/scripts/render_ci_summary.py shadow \
--pr-number "$PR_NUMBER" \
--pr-url "$PR_URL" \
--pr-title "$PR_TITLE" \
--head-repository "$HEAD_REPOSITORY" \
--is-fork "$IS_FORK" \
--changed-count "$CHANGED_COUNT" \
--integration-outcome "$INTEGRATION_OUTCOME" \
--integration-log "$RUNNER_TEMP/shadow-validation/integration.txt" \
--catalog-outcome "$CATALOG_OUTCOME" \
--catalog-report "$RUNNER_TEMP/shadow-validation/catalog.json" \
--schema-outcome "$SCHEMA_OUTCOME" \
--schema-log "$RUNNER_TEMP/shadow-validation/schema-tests.txt" \
--starter-kit-outcome "$STARTER_KIT_OUTCOME" \
--starter-kit-log "$RUNNER_TEMP/shadow-validation/starter-kits.txt" \
--removal-outcome "$REMOVAL_OUTCOME" \
--removal-log "$RUNNER_TEMP/shadow-validation/removal-impact.txt" \
--repository-url "$REPOSITORY_URL" \
--revision "$VALIDATOR_REVISION"

- name: Upload shadow validation evidence
@github-actions

Copy link
Copy Markdown

❌ Automated Check Results — 8 issue(s) found

All issues are listed below. Please address all of them before requesting human review.

Rule ID File Issue
SCH-001 agents/rtl-yosys-syn/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/rtl-yosys-syn/tools/yosys/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/xyce/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/xyce/tools/xyce/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/opensta/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/opensta/tools/opensta/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/rtl-ivlg-linter/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/rtl-ivlg-linter/tools/iverilog-tool/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion

Once all issues are resolved, push a new commit to re-trigger this check.
When the pr-review validator passes, the pr-validation-passed label will be applied and the maintainers will be auto-requested for review. Note: other status checks (unit-tests, schema regression, etc.) report separately — see the full status rollup at the bottom of this PR.

See the authoring guides for end-to-end walkthroughs.

@yousefi-msft
yousefi-msft marked this pull request as draft September 1, 2026 04:03
@yousefi-msft
yousefi-msft force-pushed the users/yousefi-msft/community-review-pipeline branch from 008ba6f to 8b57982 Compare September 2, 2026 14:26
@github-actions github-actions Bot removed 1p-contribution Authored by Microsoft (party='1p' in metadata) pr-validation-failed The pr-review workflow's validator failed; see inline comments. labels Sep 2, 2026
@github-actions github-actions Bot added 1p-contribution Authored by Microsoft (party='1p' in metadata) pr-validation-failed The pr-review workflow's validator failed; see inline comments. labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

❌ Automated Check Results — 8 issue(s) found

All issues are listed below. Please address all of them before requesting human review.

Rule ID File Issue
SCH-001 agents/rtl-ivlg-linter/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/rtl-ivlg-linter/tools/iverilog-tool/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/opensta/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/opensta/tools/opensta/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/xyce/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/xyce/tools/xyce/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/rtl-yosys-syn/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/rtl-yosys-syn/tools/yosys/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion

Once all issues are resolved, push a new commit to re-trigger this check.
When the pr-review validator passes, the pr-validation-passed label will be applied and the maintainers will be auto-requested for review. Note: other status checks (unit-tests, schema regression, etc.) report separately — see the full status rollup at the bottom of this PR.

See the authoring guides for end-to-end walkthroughs.

@github-actions github-actions Bot added 1p-contribution Authored by Microsoft (party='1p' in metadata) pr-validation-failed The pr-review workflow's validator failed; see inline comments. and removed 1p-contribution Authored by Microsoft (party='1p' in metadata) pr-validation-failed The pr-review workflow's validator failed; see inline comments. labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

❌ Automated Check Results — 9 issue(s) found

All issues are listed below. Please address all of them before requesting human review.

Rule ID File Issue
SEC-SCAN (repository) Secret scan failed — potential credentials detected. Check the TruffleHog job for details.
SCH-001 agents/xyce/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/xyce/tools/xyce/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/rtl-ivlg-linter/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/rtl-ivlg-linter/tools/iverilog-tool/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/rtl-yosys-syn/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/rtl-yosys-syn/tools/yosys/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion
SCH-001 agents/opensta/metadata.yaml metadata.yaml does not conform to docs/schemas/metadata-schema.json: Unresolvable: common-schema.json#/definitions/kebabCaseString
SCH-014 agents/opensta/tools/opensta/tool.yaml tool.yaml failed schema validation against docs/schemas/tool-definition-schema.json: Unresolvable: common-schema.json#/definitions/semanticVersion

Once all issues are resolved, push a new commit to re-trigger this check.
When the pr-review validator passes, the pr-validation-passed label will be applied and the maintainers will be auto-requested for review. Note: other status checks (unit-tests, schema regression, etc.) report separately — see the full status rollup at the bottom of this PR.

See the authoring guides for end-to-end walkthroughs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1p-contribution Authored by Microsoft (party='1p' in metadata) needs-human-review Awaiting human approval pr-validation-failed The pr-review workflow's validator failed; see inline comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants