Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(ngCsp): allow CSP to be configurable#12346

Merged
petebacondarwin merged 2 commits into
angular:masterfrom
petebacondarwin:csp-config
Jul 16, 2015
Merged

fix(ngCsp): allow CSP to be configurable#12346
petebacondarwin merged 2 commits into
angular:masterfrom
petebacondarwin:csp-config

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

There are two different features in Angular that can break CSP rules:
use of eval to execute a string as JavaScript and dynamic injection of
CSS style rules into the DOM.

This change allows us to configure which of these features should be turned
off to allow a more fine grained set of CSP rules to be supported.

Closes #11933
Closes #8459

@petebacondarwin
Copy link
Copy Markdown
Contributor Author

@jdalton, @realityking, @lgalfaso and @btford - can you take a look?

Comment thread src/Angular.js
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the ngCspAttribute.indexOf checks be looking for > -1 as if they're declared then they're true?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for !== -1 has the same effect, so this is fine.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for !== -1 has the same effect, so this is fine.

Doh! I blame it on all the double negatives 😸

@realityking
Copy link
Copy Markdown
Contributor

@petebacondarwin I like it (a lot)!

Comment thread test/AngularSpec.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(spy) for consistency ? 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!

There are two different features in Angular that can break CSP rules:
use of `eval` to execute a string as JavaScript and dynamic injection of
CSS style rules into the DOM.

This change allows us to configure which of these features should be turned
off to allow a more fine grained set of CSP rules to be supported.

Closes angular#11933
Closes angular#8459
There are two different features in Angular that can break CSP rules:
use of `eval` to execute a string as JavaScript and dynamic injection of
CSS style rules into the DOM.

This change allows us to configure which of these features should be turned
off to allow a more fine grained set of CSP rules to be supported.

Closes angular#11933
Closes angular#8459
@petebacondarwin
Copy link
Copy Markdown
Contributor Author

I have added a commit with changes thanks to the feedback.

@gkalpak
Copy link
Copy Markdown
Member

gkalpak commented Jul 15, 2015

LGTM 👍

@petebacondarwin petebacondarwin modified the milestones: 1.4.3, 1.4.4 Jul 16, 2015
@petebacondarwin petebacondarwin merged commit e1fd333 into angular:master Jul 16, 2015
petebacondarwin added a commit that referenced this pull request Jul 16, 2015
There are two different features in Angular that can break CSP rules:
use of `eval` to execute a string as JavaScript and dynamic injection of
CSS style rules into the DOM.

This change allows us to configure which of these features should be turned
off to allow a more fine grained set of CSP rules to be supported.

Closes #11933
Closes #8459
Closes #12346
@btford
Copy link
Copy Markdown
Contributor

btford commented Jul 16, 2015

👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants