Agent Skillsnetdata/netdata › triage-codeql

triage-codeql

GitHub

用于审查和分类GitHub Code Scanning告警,包括CodeQL发现。支持列出、检查、审核及在授权下执行验证性关闭操作,不涉及查询编写或CI配置。

.agents/skills/triage-codeql/SKILL.md netdata/netdata

Trigger Scenarios

审查安全扫描告警 批量关闭已验证的漏洞

Install

npx skills add netdata/netdata --skill triage-codeql -g -y
More Options

Non-standard path

npx skills add https://github.com/netdata/netdata/tree/master/.agents/skills/triage-codeql -g -y

Use without installing

npx skills use netdata/netdata@triage-codeql

指定 Agent (Claude Code)

npx skills add netdata/netdata --skill triage-codeql -a claude-code -g -y

安装 repo 全部 skill

npx skills add netdata/netdata --all -g -y

预览 repo 内 skill

npx skills add netdata/netdata --list

SKILL.md

Frontmatter
{
    "name": "triage-codeql",
    "description": "Inspect, review or triage GitHub Code Scanning alerts, including CodeQL findings; apply verified dismissals when authorized. Not for CodeQL query authoring, CI configuration, Dependabot, or secret scanning."
}

GitHub Code Scanning Triage

Use the shipped helpers for GitHub REST alert operations. Run commands below from the repository root. Owner references starting with ./ are relative to this skill directory.

Pick The Task

Task Read
List, inspect or review findings Setup, Inspect, Triage Decisions
Apply an authorized dismissal or batch Setup, Inspect, Triage Decisions, Apply Verified Decisions
Diagnose a failed request Troubleshooting and the linked API/CLI reference
Change queries, suites or CI The workflow and config owners below; this is not an operational triage task

Authorization and read-only scope follow AGENTS.md#when-a-sow-is-required; findings and evidence follow AGENTS.md#review. Inspection stops at the verified report. Applying remote state changes requires authorization covering those actions; preserve permission already granted for the current scope.

Owners

  • Helpers: ./scripts/codeql-list.sh, ./scripts/codeql-dismiss.sh, and ./scripts/_lib.sh own their arguments, output and repository resolution. Use list-helper --help for its flags.
  • CI suites and upload filters: .github/workflows/codeql.yml and its referenced .github/codeql/ configs. Do not infer every language uses the C/C++ security-extended configuration.
  • API permissions, alert states and operations: GitHub REST code scanning.
  • Authentication: gh environment.
  • Discovery capture: AGENTS.md#knowledge-capture.

Setup

  • The helpers need Bash, Git, gh and jq; summary output also uses awk, sort, head and column.
  • Authentication belongs to gh, through its configured credentials or supported exported environment variables. The helpers do not source .env. Use gh auth status to diagnose missing authentication; use gh auth login only when setup is needed. Do not request credential values in conversation.
  • Check the endpoint's token permissions and the account's repository access separately. A successful listing does not establish permission to dismiss.
  • Confirm the target: the helpers prefer upstream, falling back to origin when that remote lookup is absent. They are intended for github.com remotes; a fork checkout can therefore operate on upstream alerts.

Resolve the same target used by both helpers; this reads Git configuration without displaying the remote URL. Keep Setup and subsequent examples in the same shell session so they share codeql_repo:

source .agents/skills/triage-codeql/scripts/_lib.sh
codeql_repo="$(gh_require_slug)"
printf '%s\n' "$codeql_repo"

Inspect

The default is open alerts across tools. The compact summary shows only the most frequent rule/severity groups; use --raw for the complete array merged across pages. For a CodeQL-only investigation:

bash .agents/skills/triage-codeql/scripts/codeql-list.sh --tool=CodeQL
bash .agents/skills/triage-codeql/scripts/codeql-list.sh --tool=CodeQL --raw \
  | jq -r '.[] | [.number, .rule.id, .most_recent_instance.location.path, .html_url] | @tsv'

The list helper also supports --state= and --severity=; choose filters from the requested investigation. A candidate list is not a dismissal list.

Set codeql_alert to a listed alert number, then inspect the alert with the target resolved in Setup:

gh api "/repos/${codeql_repo:?resolve the repository in Setup}/code-scanning/alerts/${codeql_alert:?set the alert number}"

Open the returned html_url for available traces. Verify the rule, affected code, reachability and relevant instances before deciding; a matching rule ID, directory or filename alone does not establish a false positive.

Triage Decisions

The dismissal helper supports the following reasons; this is its supported subset, not the complete GitHub API enum.

Helper reason Evidence needed
false positive The reported defect is incorrect: establish the relevant guard, type or unreachable path.
won't fix The defect is real and the user accepts leaving the risk unresolved.
used in tests The flagged path is confined to test code or fixtures, rather than reachable production behavior.

Fixing code and having analysis report fixed is different from dismissing a finding. Reopening a dismissed alert is also possible through GitHub or the update endpoint with state=open; the dismissal helper does not implement it. Consult GitHub's alert history when investigating a reopened finding.

Apply Verified Decisions

Use ./scripts/codeql-dismiss.sh only for the verified alert number, reason and comment covered by authorization. Set codeql_reason and codeql_comment from that decision. Comments SHOULD be short, factual and ASCII; the helper passes the quoted comment as one API string argument.

bash .agents/skills/triage-codeql/scripts/codeql-dismiss.sh \
  "${codeql_alert:?set the verified alert number}" \
  "${codeql_reason:?set the verified reason}" \
  "${codeql_comment:?set the supporting explanation}"

For a batch, you MUST record the exact verified alert numbers with their reasons and supporting evidence before applying the single-alert helper to each. You MUST NOT pipe a rule-only search directly into dismissal commands. Re-check the target and decision if the code or alert has changed since inspection; inspect the returned state after each request.

Apply writes sequentially and stop on errors. Handle throttling according to the response and GitHub's rate-limit guidance; there is no fixed safe request rate, and the helpers do not implement retries.

Troubleshooting

Symptom Check
Missing executable Install the missing Setup dependency through the environment's normal setup.
Authentication or access error Check gh authentication, endpoint token permissions and repository access.
Alert endpoint returns 404 Confirm resolved repository, alert number, visibility/access and Code Scanning availability.
Empty successful output Inspect --raw, the selected tool/state/severity and the command's exit status.
Suspected missing pages The list helper already uses --paginate; inspect raw output rather than the bounded summary.
Missing C/C++ findings under build/ Inspect the workflow's SARIF upload filter; config paths-ignore alone does not explain built analysis.

For direct calls beyond the helpers, use the linked REST reference and gh api manual. Dependabot's GraphQL vulnerabilityAlerts is a different data source; it does not retrieve CodeQL findings.

Version History

  • 1e97a0f Current 2026-09-23 11:24

Same Skill Collection

.agents/skills/collectors-authoring/SKILL.md
.agents/skills/collectors-go-design/SKILL.md
.agents/skills/collectors-go-framework-v2/SKILL.md
.agents/skills/collectors-metadata-yaml/SKILL.md
.agents/skills/collectors-prometheus-profiles/SKILL.md
.agents/skills/collectors-snmp-profiles/SKILL.md
.agents/skills/collectors-snmp-trap-profiles/SKILL.md
.agents/skills/coverity-audit/SKILL.md
.agents/skills/docs-learn-pr-preview/SKILL.md
.agents/skills/docs-learn-site-structure/SKILL.md
.agents/skills/graphql-audit/SKILL.md
.agents/skills/health-alert-authoring/SKILL.md
.agents/skills/integrations-lifecycle/SKILL.md
.agents/skills/learn-pr-preview/SKILL.md
.agents/skills/packaging-static-installer/SKILL.md
.agents/skills/project-create-topology/SKILL.md
.agents/skills/project-health-alert-authoring/SKILL.md
.agents/skills/project-prometheus-profiles/SKILL.md
.agents/skills/project-query-corpus/SKILL.md
.agents/skills/project-snmp-profiles-authoring/SKILL.md
.agents/skills/project-snmp-trap-profiles-authoring/SKILL.md
.agents/skills/project-writing-go-modules-framework-v2/SKILL.md
.agents/skills/repo-mirror-sources/SKILL.md
.agents/skills/repo-pr-reviews/SKILL.md
.agents/skills/repo-skill-authoring/SKILL.md
.agents/skills/sonarqube-audit/SKILL.md
.agents/skills/tests-query-corpus/SKILL.md
.agents/skills/topology-authoring/SKILL.md
.agents/skills/triage-agent-events/SKILL.md
.agents/skills/triage-codacy/SKILL.md
.agents/skills/triage-coverity/SKILL.md
.agents/skills/triage-snmp-diagnostics/SKILL.md
.agents/skills/triage-sonarqube/SKILL.md
docs/netdata-ai/skills/query-netdata-agents/SKILL.md
docs/netdata-ai/skills/query-netdata-cloud/SKILL.md
docs/netdata-ai/skills/query-snmp-traps/SKILL.md
.agents/skills/codacy-audit/SKILL.md
.agents/skills/learn-site-structure/SKILL.md
.agents/skills/mirror-netdata-repos/SKILL.md
.agents/skills/pr-reviews/SKILL.md
.agents/skills/project-build-static-binary/SKILL.md
.agents/skills/project-writing-collectors/SKILL.md
.agents/skills/query-agent-events/SKILL.md
.agents/skills/triage-support-bundle/SKILL.md

Metadata

Files
0
Version
1e97a0f
Hash
4941d06e
Indexed
2026-09-23 11:24

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-23 12:50
浙ICP备14020137号-1