Repository navigation
fix(security): メディアプロキシの SVG 配信停止と外部 fetch の SSRF 対策 - #291
Merged
Merged
Conversation
- Remove image/svg+xml from the proxy allowlist; re-validate cached content types; add sandboxed CSP, nosniff and Content-Disposition to every proxy response; stop echoing upstream status/content-type - /proxy/avatar now calls the proxy logic directly instead of self-fetching via the request Host - securityHeaders no longer overwrites a route-specific CSP - Add lib/safeFetch (isPrivateAddress, assertPublicUrl, safeFetch) with DNS resolution checks and per-hop redirect re-validation; ALLOW_PRIVATE_NETWORK_FETCH=true escape hatch for development - Use safeFetch for ActivityPub object fetches, inbox delivery, WebPush, nodeinfo, instance icons, remote emoji import and Misskey API calls - RemoteFetchService rejects non-JSON (activity/ld/json) responses; WebFinger accepts jrd+json Claude-Session: https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
変更
lib/safeFetch.ts(新規):isPrivateAddress/assertPublicUrl/safeFetch。http(s) のみ許可、DNS 解決後の全アドレスをプライベート/ループバック/リンクローカル等で検査、リダイレクトは手動で各ホップ再検証。開発用にALLOW_PRIVATE_NETWORK_FETCH=trueで無効化可能(本番では使わない)routes/proxy.ts:image/svg+xmlを許可リストから削除(キャッシュヒット時も再検査)。全レスポンスにCSP: ...; sandbox・nosniff・Content-Disposition: inline。上流のステータスや Content-Type を返さない汎用エラーに。/proxy/avatarは自己 HTTP fetch をやめて内部関数呼び出しにmiddleware/securityHeaders.ts: ルートが CSP を設定済みなら上書きしないRemoteFetchService:safeFetch経由にし、AP オブジェクト取得では activity+json / ld+json / json 以外の Content-Type を拒否safeFetch経由に挙動の変化
ALLOW_PRIVATE_NETWORK_FETCH=trueが必要確認
https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv