From 4af3eb47d9cd8340e1702a0c84f387ee59f6b991 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 00:02:12 +0000 Subject: [PATCH 1/2] chore: remove dead branches in validate.py and tidy CI checkout - validate.py: drop an if block whose body was only pass, a shell-name set fully covered by the basename check next to it, and a loop over a one-element tuple; move the shutil import to the top. - build.sh: drop IGNORECASE=0, which is awk's default. - validate workflow: the validate job never pushes, so its checkout no longer keeps the token in the git config. No behaviour change. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Claude --- .github/workflows/validate.yml | 2 ++ build.sh | 2 +- validate.py | 26 ++++++++++---------------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7fc465e..85d6e9c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -28,6 +28,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-python@v5 with: diff --git a/build.sh b/build.sh index a9c251d..fa1d0fd 100755 --- a/build.sh +++ b/build.sh @@ -119,7 +119,7 @@ MODULES_DIR="$(cd "$(dirname "$0")" && pwd)" # colons in the fields we read). ymv() { local file="$1" key="$2" - awk -v k="^$key:" 'BEGIN{IGNORECASE=0} $0 ~ k {sub(/^[^:]+:[ \t]*/, ""); gsub(/^["'"'"']|["'"'"']$/, ""); print; exit}' "$file" + awk -v k="^$key:" '$0 ~ k {sub(/^[^:]+:[ \t]*/, ""); gsub(/^["'"'"']|["'"'"']$/, ""); print; exit}' "$file" } push_one() { diff --git a/validate.py b/validate.py index 885325d..9a2f9d6 100644 --- a/validate.py +++ b/validate.py @@ -94,6 +94,7 @@ import json import os import re +import shutil import subprocess import sys from dataclasses import dataclass @@ -567,10 +568,8 @@ def _steamcmd_shaped(cfg: dict) -> bool: key = e.split("=", 1)[0].upper() if "STEAM" in key: return True - for field in ("WorkingDir",): - v = (cfg.get(field) or "").lower() - if "steamcmd" in v: - return True + if "steamcmd" in (cfg.get("WorkingDir") or "").lower(): + return True for lst in (cfg.get("Entrypoint") or [], cfg.get("Cmd") or []): for tok in lst: if "steamcmd" in (tok or "").lower(): @@ -600,10 +599,8 @@ def rule_no_entrypoint_shell_cmd(spec: dict, cfg: dict, image_ref: str) -> list[ cmd = cfg.get("Cmd") or [] if entrypoint or not cmd: return [] - shell_names = {"bash", "sh", "/bin/bash", "/bin/sh"} - base = cmd[0] or "" - basename = base.rsplit("/", 1)[-1] - if len(cmd) == 1 and (base in shell_names or basename in ("bash", "sh")): + basename = (cmd[0] or "").rsplit("/", 1)[-1] + if len(cmd) == 1 and basename in ("bash", "sh"): if not spec.get("command"): return [ Finding( @@ -651,13 +648,11 @@ def rule_nonroot_requires_runasuser(spec: dict, cfg: dict, image_ref: str) -> li "Project Zomboid uid-1000-vs-10000 bug).", ) ] - if img_uid is None: - # A bare name (e.g. "steam") — we cannot resolve the real numeric uid - # without reading /etc/passwd out of the image's filesystem layers, - # which this validator deliberately does not do (too expensive for a - # preflight check). Presence of *some* runAsUser is verified above; - # the exact value can't be cross-checked statically here. - pass + # img_uid is None for a bare name (e.g. "steam"): the real numeric uid + # cannot be resolved without reading /etc/passwd out of the image's + # filesystem layers, which this validator deliberately does not do (too + # expensive for a preflight check). Presence of *some* runAsUser is + # verified above; the exact value can't be cross-checked statically here. return [] @@ -1357,7 +1352,6 @@ def discover_modules(root: Path, names: list[str] | None) -> list[Path]: def find_gp_module_bin(root: Path) -> str | None: - import shutil gp_bin = shutil.which("gp-module") if gp_bin: return gp_bin From 6d18fbe7ef5628d0463678ae19f30dabfdee0fb6 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 12:22:02 +0000 Subject: [PATCH 2/2] chore: drop the unused --json, --strict and --skip-offline validator flags No caller passes them: CI runs plain validate.py, the Gameplane Makefile runs validate.py --pin and calls gp-module validate directly, and none of the three is in the -h text. --offline and --pin stay. Like any unknown option, the removed flags are now ignored. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- validate.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/validate.py b/validate.py index 9a2f9d6..eb17204 100644 --- a/validate.py +++ b/validate.py @@ -1400,16 +1400,10 @@ def main(argv: list[str]) -> int: if not gp_bin: sys.stderr.write("error: gp-module binary not found; required for --offline validation\n") return 2 - cmd = [gp_bin, "validate"] - if "--json" in args: - cmd.append("--json") - if "--strict" in args: - cmd.append("--strict") - cmd.extend([str(d) for d in module_dirs]) - return subprocess.run(cmd).returncode + return subprocess.run([gp_bin, "validate"] + [str(d) for d in module_dirs]).returncode offline_findings: dict[str, list[Finding]] = {} - if gp_bin and "--skip-offline" not in args: + if gp_bin: try: res = subprocess.run( [gp_bin, "validate", "--json"] + [str(d) for d in module_dirs],