Skip to content

next.config.ts enables dangerouslyAllowSVG without the companion contentSecurityPolicy/contentDispositionType hardening Next.js recommends for it #266

Closed

Description

@chonilius

src/app/next.config.ts (next.config.ts) sets:

images: {
  dangerouslyAllowSVG: true,
  remotePatterns: [
    { protocol: "https", hostname: "avatars.githubusercontent.com" },
    { protocol: "https", hostname: "api.dicebear.com" },
  ],
},

dangerouslyAllowSVG is named the way it is because an SVG served through Next's image
optimizer can contain embedded <script>/event-handler content, which is a real XSS
vector if that SVG is ever served with a content type or disposition that lets a browser
execute it as an active document rather than a passive image. Next.js's own documentation
for this exact flag recommends pairing it with two other config fields specifically built
for this: images.contentSecurityPolicy (a CSP applied to the optimizer's own image
responses, e.g. "default-src 'self'; script-src 'none'; sandbox;") and
images.contentDispositionType (set to "attachment" so a browser navigated directly to
the optimized image URL downloads it rather than rendering it inline).

Neither field is set here. This app already allowlists exactly two trusted SVG sources
via remotePatterns (api.dicebear.com's generated identicons), which meaningfully
narrows the risk, but the two Next-provided hardening options that specifically exist to
mitigate dangerouslyAllowSVG's namesake danger are both left at their permissive
defaults regardless.

Suggested fix: add images.contentSecurityPolicy and
images.contentDispositionType: "attachment" to the images config, matching Next.js's
own documented recommendation for any app that enables dangerouslyAllowSVG.

Activity

  1. added
    security
    documentation
    very hard
    help wanted
    on Aug 21, 2026
  2. added
    Stellar Wave
    on Aug 25, 2026
  3. SMOGZ6783 commented on Aug 25, 2026

    @SMOGZ6783

    @SMOGZ6783 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    please assign to me

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @SMOGZ6783 to this issue.

  4. Gonness-Codes commented on Aug 25, 2026

    @Gonness-Codes

    @Gonness-Codes has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hello, this issue aligns well with my skill set and I’m confident I can resolve it properly. Please assign it to me.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Gonness-Codes to this issue.

  5. KingDavid9999 commented on Aug 25, 2026

    @KingDavid9999

    @KingDavid9999 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi maintainer, I'd very much appreciate the opportunity to work on this issue.
    Having reviewed the acceptance criteria, I'm confident that I'd be able to have a PR up shortly after being assigned.
    Kindly assign this issue to me.
    Thank you!

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @KingDavid9999 to this issue.

  6. DatboiCaleb commented on Aug 25, 2026

    @DatboiCaleb

    @DatboiCaleb has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi Good day Maintainer

    I’m a smart contract and full-stack developer who turns complex ideas into secure, production-ready blockchain code. With strong skills in Rust and Solidity, I build systems that are fast, safe, and built to last.
    My experience with the Stellar SDK and Soroban lets me ship real-world Web3 solutions that actually move value.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @DatboiCaleb to this issue.

  7. boys-cyberhub commented on Aug 25, 2026

    @boys-cyberhub
    Contributor

    @boys-cyberhub has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    hello can i work on this issue please

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @boys-cyberhub to this issue.

  8. drips-wave commented on Aug 25, 2026

    @drips-wave

    Congratulations, @boys-cyberhub! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @boys-cyberhub: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  9. grantfox-oss commented on Aug 25, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!

    @boys-cyberhub's PR #326 was approved and merged by @chonilius.

    🏆 @boys-cyberhub: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (818 total points). Track your full progress on GrantFox.

    👏 Great work, @boys-cyberhub! Keep contributing to MergeFi.

  10. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @boys-cyberhub as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @boys-cyberhub: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  11. removed
    Stellar Wave
    on Oct 15, 2026
  12. added
    Stellar Wave
    on Oct 15, 2026
  13. removed
    Stellar Wave
    on Oct 15, 2026
  14. added
    Stellar Wave
    on Oct 15, 2026
  15. removed
    Stellar Wave
    on Oct 15, 2026
  16. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar Wavedocumentationhelp wantedsecurityvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions