Skip to content

signalmeow/attachments: treat 403 from CDN 0 as not found - #737

Merged
Fizzadar merged 2 commits into
mainfrom
indent/signal-cdn-403-not-found
Nov 14, 2026
Merged

Fizzadar merged 2 commits into
mainfrom
indent/signal-cdn-403-not-found

Conversation

@indent

@indent indent Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Logs

Failed to handle attachment was logged 849 times in the 24 h ending Nov 14 06:00 UTC, against 232 the day before. In a sample of four 15-minute windows on separate clusters there were 341 lines from at least 4 accounts, all unexpected status code 403 (some wrapped as write callback failed: ...). They came from backward backfill and backup chat import of messages that are months to years old. The debug response bodies show that CDN 0 returns 403 with an S3 AccessDenied error for an expired attachment, while cdn2 and cdn3 return 404 for the same case.

Cause

DownloadAttachment returns ErrAttachmentNotFound only for 404. A missing object on CDN 0 therefore surfaces as a generic error. The user sees "Failed to handle attachment : unexpected status code 403" instead of "Attachment no longer available", and stickers skip the sticker-pack fallback. Signal Desktop also treats a CDN 0 403 as equivalent to a 404 (downloadAttachment.preload.ts).

Change

Return ErrAttachmentNotFound for a 403 from CDN 0/1 (same host), matching Signal Desktop. Also fix the CDN index bound check in GetAttachment, which indexed past CDNHosts for cdn_number 4.

Before / after

Note: not tested against a live account.

Case Base Head
Expired photo in backup import (CDN 0/2 returns 403) "Failed to handle attachment …: unexpected status code 403", error logged "Attachment no longer available …", no error log
Expired sticker with known pack (CDN 0/2 403) "Failed to handle sticker" notice Sticker downloaded from its pack
CDN 3 returns 403 (unchanged) "Failed to handle attachment …: 403" Same

View in Indent
Tag @indent to continue the conversation here.

@indent indent Bot changed the title signalmeow/attachments: treat 403 from transit CDNs 0 and 2 as not found signalmeow/attachments: treat 403 from CDN 0 as not found Nov 14, 2026
@Fizzadar
Fizzadar merged commit 4ecda7f into main Nov 14, 2026
14 checks passed
@Fizzadar
Fizzadar deleted the indent/signal-cdn-403-not-found branch November 14, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants