Skip to content

OWASP says nonce solution shouldn't be middleware #61

@s6mike

Description

@s6mike

This is a very handy solution, but I read this while learning about CSPs:

"Don't create a middleware that replaces all script tags with "script nonce=..." because attacker-injected scripts will then get the nonces as well. You need an actual HTML templating engine to use nonces." (from https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html)

My understanding is that this package uses edge functions as a form of middleware to add the nonces, so presumably is open to this vulnerability.

Do OWASP's concerns apply in this case? If not, can you explain why not?

Does netlify have any alternative solutions which might mitigate the above issue? e.g. one which uses hashes?

Thanks for your attention!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions