Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/channels/discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,9 @@ func (c *DiscordChannel) StartTyping(ctx context.Context, chatID string) (func()

func (c *DiscordChannel) downloadAttachment(url, filename string) string {
return utils.DownloadFile(url, filename, utils.DownloadOptions{
LoggerPrefix: "discord",
ProxyURL: c.config.Proxy,
LoggerPrefix: "discord",
ProxyURL: c.config.Proxy,
BlockPrivateTargets: true,
})
}

Expand Down
1 change: 1 addition & 0 deletions pkg/channels/line/line.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ func (c *LINEChannel) downloadContent(messageID, filename string) string {
ExtraHeaders: map[string]string{
"Authorization": "Bearer " + c.config.ChannelAccessToken.String(),
},
BlockPrivateTargets: true,
})
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/channels/qq/qq.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,9 @@ func (c *QQChannel) downloadAttachment(urlStr, filename string) string {
}

return utils.DownloadFile(urlStr, filename, utils.DownloadOptions{
LoggerPrefix: "qq",
ExtraHeaders: c.downloadHeaders(),
LoggerPrefix: "qq",
ExtraHeaders: c.downloadHeaders(),
BlockPrivateTargets: true,
})
}

Expand Down
1 change: 1 addition & 0 deletions pkg/channels/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ func (c *SlackChannel) downloadSlackFile(file slack.File) string {
ExtraHeaders: map[string]string{
"Authorization": "Bearer " + c.config.BotToken.String(),
},
BlockPrivateTargets: true,
})
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/channels/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,8 @@ func (c *TelegramChannel) downloadFileWithInfo(file *telego.File, ext string) st
// Use FilePath as filename for better identification
filename := file.FilePath + ext
return utils.DownloadFile(url, filename, utils.DownloadOptions{
LoggerPrefix: "telegram",
LoggerPrefix: "telegram",
BlockPrivateTargets: true,
})
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/utils/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ type DownloadOptions struct {
Timeout time.Duration
ExtraHeaders map[string]string
LoggerPrefix string
ProxyURL string
ProxyURL string
// BlockPrivateTargets enables SSRF hardening (scheme/host checks + safe dial
// + redirect re-check). Inbound channel attachment downloads should set this
// so a crafted media URL cannot reach loopback/link-local/RFC1918.
BlockPrivateTargets bool
}

Expand Down