Git Product home page Git Product logo

Comments (5)

rtfeldman avatar rtfeldman commented on August 22, 2024

Cool, makes sense! 👍

I'd be happy to accept a PR for this. I think calling the function toNonceUnstyled would make sense.

from elm-css.

rtfeldman avatar rtfeldman commented on August 22, 2024

Published as 17.1.0

from elm-css.

mostlyobvious avatar mostlyobvious commented on August 22, 2024

@jonathanmoregard Have you perhaps figured out how to best pass a nonce?

Any attempt to pass server-generated nonce seem futile to me when the style tag is not rendered on server too. The reason for that is nonce should be hidden and browser does a lot to not reveal it: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce#accessing_nonces_and_nonce_hiding

With a nonce passed from server to Elm app via flags, we'd make it visible to the attacker. And thus defeat the purpose of CSP with nonce in first place: https://content-security-policy.com/nonce/. Is there any other option? Am I'm missing something obvious here?

from elm-css.

JohanWinther avatar JohanWinther commented on August 22, 2024

@pawelpacana
With a nonce passed from server to Elm app via flags, we'd make it visible to the attacker. And thus defeat the purpose of CSP with nonce in first place: https://content-security-policy.com/nonce/. Is there any other option? Am I'm missing something obvious here?

I'd like to know in which way the attacker can access the nonce when it's passed via Elm app flags. Do you have a scenario in mind?

My proposal for securely passing nonces:
I'm thinking, start the Elm app inside of an anonymous function and let the server write the nonce directly into the flags argument. Would this hide the nonce? Perhaps I'm also missing something

from elm-css.

mostlyobvious avatar mostlyobvious commented on August 22, 2024

I'm thinking, start the Elm app inside of an anonymous function and let the server write the nonce directly into the flags argument. Would this hide the nonce? Perhaps I'm also missing something

My bad. I've conflated passing nonce via flags with passing nonce via visible element attributes so that flags could read it.

from elm-css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.