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

Function _fingerprint

plugins/codex-security/scripts/finalize_scan_contract.py:490–504  ·  view source on GitHub ↗
(target_id: str, finding: dict[str, Any])

Source from the content-addressed store, hash-verified

488
489
490def _fingerprint(target_id: str, finding: dict[str, Any]) -> str:
491 identity = _require_dict(finding, "identity", "finding")
492 anchor = _require_str(identity, "anchor", "finding.identity")
493 if not SLUG_RE.fullmatch(anchor):
494 raise ContractError("finding.identity.anchor: expected a stable lowercase semantic slug")
495 instance = identity.get("instance", "")
496 if not isinstance(instance, str):
497 raise ContractError("finding.identity.instance: expected a string")
498 if instance and not SLUG_RE.fullmatch(instance):
499 raise ContractError("finding.identity.instance: expected a stable lowercase semantic slug")
500 rule_id = _require_str(finding, "ruleId", "finding")
501 if not SLUG_RE.fullmatch(rule_id):
502 raise ContractError("finding.ruleId: expected a stable lowercase rule slug")
503 material = "\0".join((FINGERPRINT_ALGORITHM, target_id, rule_id, anchor, instance))
504 return f"{FINGERPRINT_ALGORITHM}:sha256:{_sha256_text(material)}"
505
506
507def _stable_id(prefix: str, *parts: str) -> str:

Callers 1

_enrich_findingsFunction · 0.85

Calls 5

_require_dictFunction · 0.85
ContractErrorClass · 0.85
_sha256_textFunction · 0.85
_require_strFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected