feat: enforce import provenance exposure policy (#2)
Merge BAT-017 / REQ-021 implementation after delivery-runner implementation, independent QC, and passing GitHub Actions CI.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
@@ -9,6 +8,8 @@ from typing import Any
|
||||
|
||||
import fitz
|
||||
|
||||
from .provenance_policy import allowlisted_json_payload
|
||||
|
||||
|
||||
DATETIME_RE = re.compile(r"^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$")
|
||||
AMOUNT_RE = re.compile(r"^[+-]?\d{1,3}(?:,\d{3})*$")
|
||||
@@ -32,7 +33,7 @@ class TossBankTransaction:
|
||||
return f"toss_bank_pdf:{source_hash}:{self.row_index}:{self.transaction_datetime}:{self.amount}"
|
||||
|
||||
def raw_payload(self) -> str:
|
||||
return json.dumps(
|
||||
return allowlisted_json_payload(
|
||||
{
|
||||
"row_index": self.row_index,
|
||||
"transaction_datetime": self.transaction_datetime,
|
||||
@@ -44,7 +45,7 @@ class TossBankTransaction:
|
||||
"raw_summary": self.raw_summary,
|
||||
"raw_lines": self.raw_lines,
|
||||
},
|
||||
ensure_ascii=False,
|
||||
allowed_keys=("row_index",),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user