MCPcopy Index your code
hub / github.com/openai/plugins / _validate_target

Function _validate_target

plugins/codex-security/scripts/finalize_scan_contract.py:469–487  ·  view source on GitHub ↗
(target: dict[str, Any])

Source from the content-addressed store, hash-verified

467
468
469def _validate_target(target: dict[str, Any]) -> None:
470 kind = _require_str(target, "kind", "scan.target")
471 if kind not in TARGET_KINDS:
472 raise ContractError(f"scan.target.kind: unsupported target kind: {kind}")
473 _require_str(target, "targetId", "scan.target")
474 _require_str(target, "displayName", "scan.target")
475 remote = target.get("remote")
476 if remote is not None:
477 if not isinstance(remote, str):
478 raise ContractError("scan.target.remote: expected a string")
479 _validate_remote(remote, "scan.target.remote")
480 if kind == "git_revision":
481 _require_str(target, "revision", "scan.target")
482 elif kind == "git_worktree":
483 _require_str(target, "snapshotDigest", "scan.target")
484 elif kind == "git_diff":
485 _require_str(target, "snapshotDigest", "scan.target")
486 elif kind == "directory_snapshot":
487 _require_str(target, "snapshotDigest", "scan.target")
488
489
490def _fingerprint(target_id: str, finding: dict[str, Any]) -> str:

Callers 2

_validate_manifestFunction · 0.85
finalize_scanFunction · 0.85

Calls 4

ContractErrorClass · 0.85
_validate_remoteFunction · 0.85
_require_strFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected