MCPcopy Index your code
hub / github.com/github/spec-kit / _validate_run_id

Method _validate_run_id

src/specify_cli/workflows/engine.py:381–395  ·  view source on GitHub ↗

Raise ``ValueError`` if ``run_id`` is not a safe path component. This is the single source of truth for what counts as a valid ``run_id``. ``__init__`` calls it to reject malformed IDs at construction time; ``load`` calls it *before* interpolating the ID into a path

(cls, run_id: str)

Source from the content-addressed store, hash-verified

379
380 @classmethod
381 def _validate_run_id(cls, run_id: str) -> None:
382 """Raise ``ValueError`` if ``run_id`` is not a safe path component.
383
384 This is the single source of truth for what counts as a valid
385 ``run_id``. ``__init__`` calls it to reject malformed IDs at
386 construction time; ``load`` calls it *before* interpolating the
387 ID into a path so a malicious value cannot probe or read files
388 outside ``.specify/workflows/runs/<run_id>/``.
389 """
390 if not isinstance(run_id, str) or not cls._RUN_ID_PATTERN.match(run_id):
391 raise ValueError(
392 f"Invalid run_id {run_id!r}: must be alphanumeric with "
393 "hyphens/underscores only (and must start with an "
394 "alphanumeric character)."
395 )
396
397 def __init__(
398 self,

Callers 3

__init__Method · 0.95
loadMethod · 0.80

Calls

no outgoing calls

Tested by 1