INNER CODE UNIT · Python
_rehydrate_report
ASCIT31/Dark-Moon · mcp/src/server.py:265
def _rehydrate_report(text: Optional[str], session_id: Optional[str] = None) -> Optional[str]:
"""Restore real values into a finished report/summary before it is written to
disk. The model only ever sees and emits placeholders, so a saved report would
otherwise read "Target: IP_PRIVATE_001" instead of the real address, and every
finding would reference tokens instead of the hosts/domains/credentials the
pentester needs. The report is local and CONFIDENTIAL, so secrets are restored
too. Uses the same per-session vault the launch prompt and tool calls shared.
"""
if not text or not PRIVACY_ENABLED:
return text
try:
with _vault_lock:
vault = _get_vault(session_id)
if vault is None:
return text
def _sub(m: "re.Match") -> str:
ph = m.group("ph")