38a347a82a
CI / detect-changes (push) Successful in 7s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / secret-scan (push) Has been skipped
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / build-sha-integrity (push) Successful in 9s
CI / validate-canonical-controls (push) Successful in 12s
CI / loc-budget (push) Successful in 24s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 3m11s
CI / test-go (push) Has been skipped
CI / iace-gt-coverage (push) Has been skipped
CI / test-python-backend (push) Successful in 24s
CI / test-python-document-crawler (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped
AGB v2 (decision_method routing, 71%FP->~0) + DSE v3 (4-layer, recovered from container) + Architektur-Tab into /sdk/agent live path. Incl CI robustness (detect-changes.sh + PR-head checkout) + security (hardcoded Qdrant key removed, gitleaks allowlist). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
"""REFERENCE-Pruefer (verification_method=REFERENCE, decision_method=LINK_RESOLVER).
|
|
|
|
Ist ein klarer Verweis auf ein anderes Pflichtdokument vorhanden (+ optional: loest
|
|
der Link auf)? Deterministisch. Bsp: 'Details in unserer Datenschutzerklaerung'.
|
|
KEIN LLM, kein juristisches Urteil. (Validiert an AGB data_protection: 7/7.)
|
|
|
|
Die tatsaechliche HTTP-Aufloesung des Links ist ein optionaler Runtime-Schritt
|
|
(online), nicht Teil dieser deterministischen Text-Pruefung — die URL wird hier
|
|
nur extrahiert und in `detail['link']` zurueckgegeben.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
from .base import CheckResult, ControlSpec, DocContext, VerificationMethod
|
|
|
|
_URL = re.compile(r"https?://[^\s)\]]+", re.I)
|
|
|
|
|
|
class ReferenceChecker:
|
|
verification_method = VerificationMethod.REFERENCE
|
|
|
|
async def check(self, ctrl: ControlSpec, doc: DocContext) -> CheckResult:
|
|
text = doc.text or ""
|
|
pats = ctrl.patterns or []
|
|
if not pats or not text:
|
|
return CheckResult(present=False, source="reference")
|
|
for p in pats:
|
|
m = re.search(p, text, re.I)
|
|
if m:
|
|
window = text[max(0, m.start() - 40): m.end() + 200]
|
|
url = _URL.search(window) or _URL.search(text)
|
|
link = url.group(0) if url else None
|
|
return CheckResult(
|
|
present=True,
|
|
evidence=" ".join(m.group(0).split())[:120],
|
|
confidence=1.0,
|
|
source="reference",
|
|
detail={"link": link},
|
|
)
|
|
return CheckResult(present=False, source="reference")
|