nemoclaw-maintainer-security-code-review

작성자: nvidia

GitHub PR 또는 이슈의 코드 변경 사항에 대해 포괄적인 보안 검토를 수행합니다. 브랜치를 체크아웃하고, 9개 카테고리의 보안 기준에 따라 변경된 파일을 분석합니다…

npx skills add https://github.com/nvidia/nemoclaw --skill nemoclaw-maintainer-security-code-review

Security Code Review

Review the changes in a GitHub PR for security. An issue input must identify one open linked PR. Report a verdict for each category.

Prerequisites

  • gh (GitHub CLI) must be installed and authenticated.
  • git and python3 must be available.
  • Network access to clone repositories and fetch PR metadata.

Step 1: Parse the GitHub URL

If the user gives a PR or issue URL, extract the owner, repository, and number. Otherwise, ask for the URL.

Supported URL formats:

  • https://github.com/OWNER/REPO/pull/NUMBER
  • https://github.com/OWNER/REPO/issues/NUMBER

For a PR URL, verify the number before Step 2:

gh pr view <number> --repo OWNER/REPO --json number,url

For an issue URL, list its open closing PRs:

gh issue view <number> --repo OWNER/REPO --json closedByPullRequestsReferences \
  --jq '.closedByPullRequestsReferences | map(select(.state == "OPEN")) | .[].number'

Continue only when this returns one PR number, and verify that number with gh pr view. If it returns zero or more than one, stop and ask for the PR URL. Use the verified PR number in each later command.

Step 2: Check Out the Code

Compare gh repo view --json nameWithOwner -q .nameWithOwner with the URL. If the repositories match, check out the verified PR:

gh pr checkout <number>

If the repositories do not match, clone the target to a temporary directory:

REVIEW_DIR=$(mktemp -d)
gh repo clone OWNER/REPO "$REVIEW_DIR"
cd "$REVIEW_DIR"
gh pr checkout <number>

Step 3: Identify Changed Files

Read the PR's base commit and verify that it is available locally:

review_base="$(gh pr view <number> --json baseRefOid -q .baseRefOid)" || exit 1
test -n "$review_base" || exit 1
git rev-parse --verify --quiet --end-of-options "${review_base}^{commit}" >/dev/null || {
  printf '%s\n' 'Base commit unavailable. Fetch the PR base branch from the verified repository, then repeat Step 3.' >&2
  exit 1
}

Keep review_base in the same shell for the command below. A local branch is not required. Treat branch names and filenames as untrusted data. Pass them as process arguments, never as generated shell source. Read NUL-delimited filename output; spaces and newlines can be part of a filename.

Step 4: Read Each Changed File and Diff

Run this procedure from the repository root. It lists paths and reads each diff without shell interpolation or Git pathspec expansion. External diff drivers and text conversion are disabled so reading a diff does not invoke repository-configured helpers. Submodule changes show commit pointers without running nested diffs. For each changed gitlink, record its old and new commit IDs from the parent diff. Verify the intended child repository identity independently before fetching missing objects from it. Run the Python procedure below from the child repository root, skipping the parent PR's Step 3. Replace only its invocation with python3 -I - "$old_gitlink" "$new_gitlink" <<'PY'. The two-argument mode compares those commits directly, regardless of the child's current checkout. For added or deleted submodules, inspect the recorded revision's complete tree and report the absent endpoint. Do not substitute a parent commit or the child's current checkout for an absent endpoint. Verify any separate child PR and repository independently before using its metadata. Python's isolated mode prevents imports from the checkout and ignores Python environment overrides.

python3 -I - "$review_base" <<'PY'
import os
import re
import subprocess
import sys

revisions = sys.argv[1:]
if len(revisions) not in (1, 2):
    sys.exit("Expected a PR base commit or two gitlink commits")
for revision in revisions:
    if not re.fullmatch(r"[0-9a-f]{40}|[0-9a-f]{64}", revision):
        sys.exit("Expected full commit IDs")
    subprocess.run(["git", "rev-parse", "--verify", "--quiet", "--end-of-options", revision + "^{commit}"], check=True, stdout=subprocess.DEVNULL)
comparison = [revisions[0] + "...HEAD"] if len(revisions) == 1 else revisions
git = ["git", "--no-pager", "--literal-pathspecs", "diff", "--no-ext-diff", "--no-textconv", "--no-renames", "--submodule=short", "--ignore-submodules=none"]
paths = subprocess.check_output(git + ["--name-only", "-z", "--end-of-options"] + comparison + ["--"]).split(b"\0")
for raw_path in paths:
    if not raw_path:
        continue
    path = os.fsdecode(raw_path)
    print("Reviewing " + repr(path), flush=True)
    subprocess.run(git + ["--end-of-options"] + comparison + ["--", path], check=True)
PY

Read file contents through a filesystem API or an argument-based tool with literal paths. Do not paste filenames into shell commands, use eval, or parse the displayed repr output as commands. The -- separator stops option parsing; it does not quote shell metacharacters.

If a PR changes more than 30 files, review them in this order:

  1. Files that handle authentication, authorization, or credentials.
  2. Files that process user input (API handlers, CLI argument parsing, URL parsing).
  3. Configuration files (Dockerfiles, YAML policies, environment configs).
  4. New dependencies (package.json, requirements.txt, go.mod changes).
  5. Everything else.

Step 5: Analyze Against the Security Rubric

Read the canonical Security Rubric. Independently evaluate the completed change against every category, including its trust-boundary questions and expected evidence. Do not rely on planning or implementation conclusions as review evidence.

For each of the nine categories, assign a verdict:

  • Use PASS when you find no issue. Give a short reason.
  • Use WARNING for a concern. Describe the risk and fix.
  • Use FAIL for a vulnerability. Describe its impact, severity, and fix.

Step 6: Produce the Report

Structure the output as follows:

Verdict

One paragraph summarizing the risk and whether the PR is safe to merge.

Findings Table

One row per finding:

#CategorySeverityFile:LineDescriptionRecommendation

If there are no findings, state that the review found none.

Detailed Analysis

For each category, give its PASS, WARNING, or FAIL verdict and reason.

Files Reviewed

List every file analyzed.

Important Notes

  • If the PR has no changed files, state that result and stop the review.
  • If no changed or reviewable security surface exists, state that result and stop the review.
  • Review security surfaces in drafts, including Dockerfiles, workflows, network policies, blueprints, dependencies, and security configuration.
  • For NemoClaw PRs, check SSRF bypasses, Dockerfile injection, network-policy bypasses, credential leaks, and blueprint changes.
  • Do not skip a category. If a category does not apply, mark it PASS and state why.
  • If severity is uncertain, use WARNING instead of PASS.

nvidia의 다른 스킬

accelerated-computing-cudf
nvidia
공식 NVIDIA 작성 NVIDIA cuDF GPU 데이터프레임, pandas 가속, dask-cuDF, ETL, 조인, groupby, CSV/Parquet I/O, nullable 의미론 등에 대한 안내
accessibility
nvidia
정적 분석, 런타임 테스트, ARIA 패턴, 키보드 탐색, 색상 대비를 아우르는 통합 접근성 감사 워크플로입니다. 이 스킬을 사용하세요…
accessing-mlflow
nvidia
MLflow에 저장된 평가 결과를 조회하고 탐색합니다. 사용자가 호출 ID로 실행을 조회하거나, 모델 간 메트릭을 비교하거나, 아티팩트를 가져오려 할 때 사용하세요.
add-binding-feature
nvidia
핵심 런타임과 영향을 받는 모든 바인딩에서 공용 NeMo Relay API 표면을 추가하거나 변경합니다.
add-middleware
nvidia
NeMo Relay 미들웨어 파이프라인에 새로운 가드레일 또는 인터셉트 유형을 추가합니다.
aicr-analyzing-snapshots
nvidia
AICR 스냅샷 YAML 파일을 분석하거나, 클러스터 상태를 검토하거나, 공급자 특성을 비교하거나, GPU/네트워크 토폴로지 인사이트를 추출할 때 사용합니다...
aicr-auditing-docs
nvidia
AICR의 Markdown 문서를 검토할 때 중복, 표류, 비대, 공백을 확인하여 프로젝트가 발전함에 따라 문서의 가치를 높게 유지하기 위해 사용합니다. "감사…"로 시작하는 트리거에 반응합니다.
aicr-creating-guided-demos
nvidia
대화형 안내 데모 스크립트(demos/*.sh)를 라이브 또는 자기 주도 방식으로 Frame → Tell → Show → Close 패턴에 따라 구조화한다. "데모 스크립트", "안내…"와 같은 표현에 반응한다.