Keep podcast URLs out of the personal-sync debug log

Podcast operations and playback commands with episodes carry feed and
audio URLs that may hold private tokens; the Logs tab shows this crate's
debug output. Log only their kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-19 21:39:19 +02:00
1 parent a79f0a0e95
commit 70df945ada
2 files changed
+88 -6

No files matched your search

+28 -6
View File
@@ -1705,12 +1705,23 @@ impl DeviceSync {
)
};
let _ = self.apply_op(&op)?;
tracing::debug!(
op_id = %op.op_id,
tombstone,
payload = %payload_json,
"recorded personal-sync op"
);
if payload_may_hold_private_urls(&op.payload) {
// Feed and audio URLs may carry private tokens, and the Logs tab
// keeps this crate's debug output: log the kind only.
tracing::debug!(
op_id = %op.op_id,
tombstone,
kind = payload_kind(&op.payload),
"recorded personal-sync op"
);
} else {
tracing::debug!(
op_id = %op.op_id,
tombstone,
payload = %payload_json,
"recorded personal-sync op"
);
}
if gc_after_record {
let _ = self.gc_tombstones();
}
@@ -3915,6 +3926,17 @@ fn coalesce_progress_ops(conn: &Connection, op: &SyncOpWire) -> Result<()> {
Ok(())
}
/// Podcast operations and playback commands with podcast items carry feed
/// and audio URLs, which may hold private tokens: never log their payload.
fn payload_may_hold_private_urls(payload: &SyncOpPayload) -> bool {
payload.is_podcast()
|| matches!(
payload,
SyncOpPayload::PlaybackCommand { command, .. }
if music_dht::device_sync::playback_command_has_podcasts(command)
)
}
fn payload_kind(payload: &SyncOpPayload) -> &'static str {
match payload {
SyncOpPayload::TrackLikeSet { .. } => "track_like_set",