Awesome Reviewers

Apply defensive validation rules anywhere code derives security decisions from paths, filesystem objects, executables, or integrity metadata.

Guidelines 1) Path inclusion/exclusion must be precise

2) Treat special filesystem objects as unsafe

3) Executable boundary + identity safety

4) Enforce integrity on security-critical transitions

5) Never reinterpret security-critical metadata unless fully supported

Example pattern (illustrative)

from pathlib import Path

def safe_diff_path_allowed(repo: Path, rel: Path, status: str) -> bool:
    # 1) include security-relevant paths; narrow exclusions
    if rel.parts and rel.parts[0] == ".github":
        # allow security relevant subsets; avoid over-broad excludes
        pass

    # 2) reject unsafe filesystem object types (symlink/pipe)
    abs_path = repo / rel
    try:
        if abs_path.is_symlink() or abs_path.exists() and abs_path.is_fifo():
            return False  # force reject/defer to full review path
    except OSError:
        return False

    return status in {"M", "A", "C", "R" , "D" , "U"}  # as appropriate

# 4) integrity: exact digest required for current selections
def accept_selection(current_digest: str, selected_digest: str) -> bool:
    return current_digest == selected_digest

# 5) safe kind adoption: only if binding covers required coordinates
TARGET_REQUIRED_COORDINATE_FIELDS = {
    "git_revision": {"baseRevision","headRevision"},
    "git_worktree": {"requiredSnapshotDigest"},
    "git_diff": {"snapshotDigest"},
}

def maybe_adopt_kind(target: dict, allowed_kinds: list, binding: dict) -> None:
    if len(allowed_kinds) != 1:
        return
    registered_kind = allowed_kinds[0]
    if not isinstance(registered_kind, str):
        return
    if target.get("kind") == registered_kind:
        return
    required = TARGET_REQUIRED_COORDINATE_FIELDS.get(registered_kind, set())
    if not required <= binding.keys():
        return  # refuse reinterpretation
    target["kind"] = registered_kind

This prevents (a) security-relevant changes being filtered out, (b) unsafe reads/execution due to symlinks/pipes/shims, and (c) integrity breaks where security-critical metadata is silently reinterpreted or digests drift.