diff options
Diffstat (limited to 'plugins/claude-security/scripts/lib/plugin.py')
| -rw-r--r-- | plugins/claude-security/scripts/lib/plugin.py | 18 |
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: |
