security: separate Campaign reader and operator data
This commit is contained in:
@@ -131,6 +131,12 @@ def test_invalid_legacy_snapshot_never_echoes_validation_details() -> None:
|
||||
assert delivery["load_error"] == "Execution snapshot is invalid; rebuild the selected version before delivery."
|
||||
assert "provider-secret" not in repr(delivery)
|
||||
assert "smtp.internal.example" not in repr(delivery)
|
||||
assert "background_workers_enabled" not in delivery
|
||||
assert "smtp_transport_revision" not in delivery
|
||||
|
||||
operator_delivery = _load_delivery_info(version, [], include_diagnostics=True)
|
||||
assert "background_workers_enabled" in operator_delivery
|
||||
assert "smtp_transport_revision" in operator_delivery
|
||||
|
||||
|
||||
def test_aggregate_report_omits_recipient_level_failures_by_default() -> None:
|
||||
|
||||
@@ -129,7 +129,11 @@ def test_version_response_omits_source_base_path_and_sanitizes_summaries() -> No
|
||||
created_at=_now(),
|
||||
updated_at=_now(),
|
||||
validation_summary={"campaign_file": "/tmp/campaign.json", "ok": True},
|
||||
build_summary={"messages": [{"eml_path": "/tmp/message.eml", "subject": "Public"}]},
|
||||
build_summary={
|
||||
"build_token": "internal-build-token",
|
||||
"smtp_transport_revision": "internal-smtp-revision",
|
||||
"messages": [{"eml_path": "/tmp/message.eml", "subject": "Public"}],
|
||||
},
|
||||
execution_snapshot_hash=None,
|
||||
execution_snapshot_at=None,
|
||||
)
|
||||
@@ -141,6 +145,13 @@ def test_version_response_omits_source_base_path_and_sanitizes_summaries() -> No
|
||||
assert payload["validation_summary"] == {"ok": True}
|
||||
assert payload["build_summary"] == {"messages": [{"subject": "Public"}]}
|
||||
|
||||
operator_payload = CampaignVersionResponse.model_validate(
|
||||
version,
|
||||
context={"include_diagnostics": True},
|
||||
).model_dump()
|
||||
assert operator_payload["build_summary"]["build_token"] == "internal-build-token"
|
||||
assert operator_payload["build_summary"]["smtp_transport_revision"] == "internal-smtp-revision"
|
||||
|
||||
detail = CampaignVersionDetailResponse.model_validate(
|
||||
SimpleNamespace(
|
||||
**version.__dict__,
|
||||
@@ -200,6 +211,8 @@ def test_ordinary_job_detail_and_attempts_do_not_expose_diagnostics() -> None:
|
||||
|
||||
assert "eml_local_path" not in job_payload
|
||||
assert "eml_storage_key" not in job_payload
|
||||
assert "claimed_at" not in job_payload
|
||||
assert "smtp_started_at" not in job_payload
|
||||
assert job_payload["attachments"] == [{"filename": "public.pdf"}]
|
||||
assert "claim_token" not in attempts["smtp"][0]
|
||||
assert "claim_token" not in attempts["imap"][0]
|
||||
|
||||
Reference in New Issue
Block a user