fix(secrets): redact provider failure details

This commit is contained in:
2026-07-21 15:47:50 +02:00
parent 7843fe88e5
commit d64de50802
2 changed files with 18 additions and 6 deletions

View File

@@ -1512,14 +1512,14 @@ def store_caldav_credential(
value=secret,
)
).strip()
except Exception as exc:
raise CalendarError("Stored sync credential could not be written to its secret provider") from exc
except Exception:
raise CalendarError("Stored sync credential could not be written to its secret provider") from None
if not provider_ref:
raise CalendarError("Secret provider returned an empty credential reference")
if old_provider_ref and old_provider_ref != provider_ref:
try:
provider.delete_secret(old_provider_ref)
except Exception as exc:
except Exception:
if not _provider_secret_is_absent(provider, old_provider_ref):
compensation_failed = False
try:
@@ -1534,7 +1534,7 @@ def store_caldav_credential(
raise CalendarError(
"Previous sync credential could not be deleted from its secret provider; "
f"the replacement was not activated{compensation_detail}"
) from exc
) from None
existing.secret_encrypted = None
existing.metadata_ = {"source_id": source.id, "provider_ref": provider_ref}
else:
@@ -1619,12 +1619,12 @@ def _delete_calendar_owned_credential(
)
try:
provider.delete_secret(provider_ref)
except Exception as exc:
except Exception:
if not _provider_secret_is_absent(provider, provider_ref):
raise CalendarError(
"Stored sync credential could not be deleted from its secret provider; "
"the requested deletion was not completed"
) from exc
) from None
storage_backend = "external_secret_provider"
credential.secret_encrypted = None
credential.metadata_ = {"source_id": source_id} if source_id else {}