From 6f15e5b102f2a7685ef5405f1446e665cf0ba6a4 Mon Sep 17 00:00:00 2001 From: Safi Date: Thu, 7 May 2026 10:39:26 +0100 Subject: [PATCH] pseudonymize Google account email with SHA256 hash in sidecar frontmatter Co-Authored-By: Claude Sonnet 4.6 --- graphify/google_workspace.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graphify/google_workspace.py b/graphify/google_workspace.py index 86dd0f9de..e80b082fa 100644 --- a/graphify/google_workspace.py +++ b/graphify/google_workspace.py @@ -124,6 +124,10 @@ def _sidecar_path(path: Path, out_dir: Path) -> Path: def _with_frontmatter(path: Path, shortcut: dict[str, str | None], body: str, exported_mime_type: str) -> str: source_url = shortcut.get("url") or "" account = shortcut.get("account") or "" + account_line = "" + if account: + account_hash = hashlib.sha256(account.encode()).hexdigest()[:12] + account_line = f'google_account_hash: "{account_hash}"\n' return ( "---\n" f'source_file: "{_safe_yaml_str(str(path))}"\n' @@ -131,7 +135,7 @@ def _with_frontmatter(path: Path, shortcut: dict[str, str | None], body: str, ex f'google_file_id: "{_safe_yaml_str(shortcut["file_id"] or "")}"\n' f'google_export_mime_type: "{_safe_yaml_str(exported_mime_type)}"\n' f'source_url: "{_safe_yaml_str(source_url)}"\n' - f'google_account: "{_safe_yaml_str(account)}"\n' + f"{account_line}" "---\n\n" f"\n\n" f"{body.strip()}\n"