summaryrefslogtreecommitdiff
path: root/plugins/claude-security/scripts/lib/plugin.py
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-11-06 00:54:48 +0000
committerClaude <noreply@anthropic.com>2026-11-06 00:54:48 +0000
commit7aba3deae3ff17d032c37e07d2929d1426b34278 (patch)
tree9c482f9acda1599bd2f9bed95a6a46b75e634e80 /plugins/claude-security/scripts/lib/plugin.py
parent5472f5f56e0070feeeb464318b316714fe3e9105 (diff)
parentb8331dd69ab3e132bbf8cd6e89b5d8c1747e21b1 (diff)
Merge remote-tracking branch 'origin/main' into add-plugin/xcodeadd-plugin/xcode
Diffstat (limited to 'plugins/claude-security/scripts/lib/plugin.py')
-rw-r--r--plugins/claude-security/scripts/lib/plugin.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/claude-security/scripts/lib/plugin.py b/plugins/claude-security/scripts/lib/plugin.py
index 2d8321cd..c7f902a0 100644
--- a/plugins/claude-security/scripts/lib/plugin.py
+++ b/plugins/claude-security/scripts/lib/plugin.py
@@ -16,8 +16,26 @@ TARGET_FILES_NAME = "target-files.json"
VOTES_PROVENANCE = "workflows/scan.js"
MODES = ("scan", "changes", "commit")
REPORT_DIR_PREFIX = "CLAUDE-SECURITY-"
+# \Z, not $: `$` also matches before a trailing newline, and this is a fence.
+REPORT_DIR_RE = re.compile(rf"^{re.escape(REPORT_DIR_PREFIX)}[0-9][0-9-]*\Z")
+JSONL_NAME = "CLAUDE-SECURITY-RESULTS.jsonl"
+REVISION_PREFIX = "CLAUDE-SECURITY-REVISION-"
# \Z, not $: `$` also matches before a trailing newline, and this id names product files.
SHA_RE = re.compile(r"^[0-9a-fA-F]{7,64}\Z")
+SHORT_ID_CHARS = 12
+_RETIRED_MAX_NOTE = (
+ "The `max` effort tier has been retired, so I'm running this scan at `high`. "
+ "A future version will stop accepting `max` and return an error."
+)
+RETIRED_MAX_RELAY = (
+ "relay: say this to the user exactly as printed, to open your kickoff message and "
+ f"again to close your results message: {_RETIRED_MAX_NOTE}"
+)
+
+
+def is_revision_stamp(path: Path) -> bool:
+ """Whether `path` has a revision stamp's name, `CLAUDE-SECURITY-REVISION-<tag>.json`."""
+ return path.name.startswith(REVISION_PREFIX) and path.suffix == ".json"
def version() -> str | None: