Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

panel: new unsafe-inline styles #11941

Closed
Splaktar opened this issue Jun 17, 2020 · 6 comments · Fixed by #11942
Closed

panel: new unsafe-inline styles #11941

Splaktar opened this issue Jun 17, 2020 · 6 comments · Fixed by #11942
Assignees
Labels
has: Pull Request A PR has been created to address this issue P1: urgent Urgent issues that should be addressed in the next minor or patch release. resolution: fixed severity: regression This issue is related to a regression type: bug
Milestone

Comments

@Splaktar
Copy link
Member

Splaktar commented Jun 17, 2020

Bug

Demo and steps to reproduce the issue

This blank StackBlitz demo can be used to create a reproduction that demonstrates your issue.

Demo URL (required)*: https://github.com/angular/material/pull/11390/files#diff-b71bb3e10759daf665e48e9bc558dc99R1324

Detailed Reproduction Steps

  1. Update a project using CSP to the latest HEAD:
  1. Load the project in a browser

Explain the expected behavior

  • No new CSP violations.

Explain the current behavior

  • New CSP violations due to unsafe-inline for style-src.

Discuss the use-case or motivation for changing the existing behavior

Support existing apps using a CSP for security.

List the affected versions of AngularJS, Material, OS, and browsers

  • AngularJS: 1..8.0
  • AngularJS Material: v1.1.22-master-08313be
  • OS: all
  • Browsers: Chrome

Add anything else we should know

This was introduced in PR #11390.

Related Chrome bug that can make the error a bit hard to understand:
https://bugs.chromium.org/p/chromium/issues/detail?id=546106

@Splaktar Splaktar self-assigned this Jun 17, 2020
@Splaktar Splaktar added the P1: urgent Urgent issues that should be addressed in the next minor or patch release. label Jun 17, 2020
@Splaktar Splaktar added this to the 1.1.23 milestone Jun 17, 2020
@Splaktar Splaktar added severity: regression This issue is related to a regression type: bug labels Jun 17, 2020
@oliversalzburg
Copy link
Contributor

Could we introduce a .md-panel-inner-wrapper-initial-offset class, which has the initial offset, is assigned to the node in the template and then remove that instead of adjusting the style?

@Splaktar
Copy link
Member Author

That sounds reasonable to me. Though we probably want to give it a more private looking name like ._md-panel-inner-wrapper-initial-offset.

@Splaktar
Copy link
Member Author

In fact, it looks like we already have this class

._md-panel-offscreen {
left: -9999px;
}

@Splaktar
Copy link
Member Author

And it's used very close to the code in question (in the child)

'<div class="md-panel-inner-wrapper" style="left: -9999px;">' +
'<div class="md-panel _md-panel-offscreen">' + template + '</div>' +

@Splaktar
Copy link
Member Author

Splaktar commented Jun 17, 2020

And removed in a very similar way

// Remove offscreen class and add hidden class.
self.panelEl.removeClass('_md-panel-offscreen');
// Remove left: -9999px and add hidden class.
self.innerWrapper.css('left', '');
self.panelContainer.addClass(MD_PANEL_HIDDEN);

Splaktar added a commit that referenced this issue Jun 18, 2020
…styles

- fix broken link to `setNonce()` docs in Theming Intro
- improve `setNonce()` documentation
- fix some invalid or inaccurate types, JSDoc, and comments
- improve type safety and IDE support by using `@types/angular` more
- fix dgeni complaining about dangling links
- fix typos

Fixes #11941
@Splaktar Splaktar added the has: Pull Request A PR has been created to address this issue label Jun 18, 2020
@Splaktar
Copy link
Member Author

I was able to remove these new inline styles, but I wasn't able to verify in a separate app that this solves the issue because I wasn't able to reproduce the problem (i.e. I got the same CSP violations with 1.1.22 as with v1.1.22-master-1bd1a97 and they were only related to not having set a nonce for theming).

Splaktar added a commit that referenced this issue Jun 18, 2020
…styles

- fix broken link to `setNonce()` docs in Theming Intro
- improve `setNonce()` documentation
- fix some invalid or inaccurate types, JSDoc, and comments
- improve type safety and IDE support by using `@types/angular` more
- fix dgeni complaining about dangling links
- fix typos

Fixes #11941
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue P1: urgent Urgent issues that should be addressed in the next minor or patch release. resolution: fixed severity: regression This issue is related to a regression type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants