Skip to content

CSP compatibility #506

Closed as not planned
Closed as not planned

Description

@cjcenizal

AFAICT, we just need to remove inline style attributes. @epixa @bevacqua Is there anything else we need to do to make EUI CSP-compatible?

Activity

  1. bevacqua commented on Mar 13, 2018

    @bevacqua
    Contributor

    Well, that boils down to the rules set by the consumers of EUI. No inline style, no eval is about the baseline. Note that no inline style ends up being pretty hard to enforce, for example: the code editor in EUI has no built-in support for CSP unless the consumer enables 'unsafe-inline', which as the name may have you guess, is not ideal. Nevertheless, we have that rule turned on for now in Cloud. Though I'm hoping that can change at some point, not really holding my breath.

    • When it comes to images, for instance, Cloud only accepts data: urls or 'self' (same-origin)
    • We accept no external fonts atm, but EUI doesn't have any.
    • Requests: for the most part, we don't allow external requests, so any and all requests should be configurable by the consumer, same for script source
  2. epixa commented on Mar 13, 2018

    @epixa

    I think EUI needs to be as conservative in its CSP tolerances as our most restrictive CSP in Elastic products, which right now is Cloud and will soon be Kibana.

    @cjcenizal I recommend figuring out the most restrictive CSP possible on EUI today by adding the CSP header to the EUI docs. The current target in Kibana is elastic/kibana#2873 (comment), though we're a ways off from that. However, our goal is to disable inline scripts as soon as humanly possible, so that's probably the most critical thing to sort out in EUI.

  3. cjcenizal commented on Mar 13, 2018

    @cjcenizal
    ContributorAuthor

    Thanks you two! Very helpful.

  4. snide commented on Mar 13, 2018

    @snide
    Contributor

    I don't know much about CSP, but I know there's a couple places where we need to set styles through JS and I can't think of a way to do it through pure css classes alone.

    • Tooltips and similar "where am i in the window" components require it for positioning
    • Accordions, mobile nav and others have height/width calculations that apply matching styles
    • Applying a background image onto something is pretty common.

    Is there some place you all recommend I can read up on some of these rules. Meeting 100% no-style tags will be pretty hard to do with our feature-set.

    I was curious how this kind of stuff would effect CSS-IN-JS libs like styled components. Looks like they set webpack_nonce to pass a crypto along with the style tags? Is something like that an option for when we absolutely need it? Again, I have very little knowledge of this stuff, so just asking questions.

    styled-components/styled-components#887

  5. bevacqua commented on Mar 13, 2018

    @bevacqua
    Contributor
  6. alexbrasetvik commented on Apr 19, 2018

    @alexbrasetvik

    sha256-[digest] would be preferable to nonce, if possible :)

  7. github-actions commented on Mar 11, 2021

    @github-actions

    👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

  8. added
    stale-issue
    on Mar 11, 2021
  9. chandlerprall commented on Mar 11, 2021

    @chandlerprall
    Contributor

    We still want to track this.

  10. removed
    stale-issue
    on Mar 12, 2021
  11. github-actions commented on Sep 8, 2021

    @github-actions

    👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

  12. added
    stale-issue
    on Sep 8, 2021
  13. github-actions commented on Sep 15, 2021

    @github-actions

    ❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error.

  14. added
    stale-issue-closed
    on Sep 15, 2021
  15. removed
    stale-issue
    stale-issue-closed
    on Sep 15, 2021
  16. github-actions commented on Mar 15, 2022

    @github-actions

    👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

  17. added
    stale-issue
    on Mar 15, 2022
  18. added and removed
    stale-issue
    on Mar 15, 2022
  19. cee-chen commented on Apr 3, 2023

    @cee-chen
    Contributor

    Hi all - I'm closing this issue due to age and Kibana apparently no longer pursuing the removal of inline styles (elastic/kibana#135469 (comment)).

    Our reasoning is much the same as the above linked comment - inline styles are absolutely necessary for things like virtualization and dynamic positioning, as well as wildcard consumer content like dynamic colors. Using Emotion/CSS-in-JS is not a valid replacement as Emotion generates a new stylesheet/class name for each permutation of each CSS value, which leads to potentially infinite styles/class names generated on the page and has massive performance implications.

    If you disagree, feel free to re-open this issue or leave an additional comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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