Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade readme #106

Merged
merged 3 commits into from
Aug 8, 2019
Merged

Conversation

jelhan
Copy link
Collaborator

@jelhan jelhan commented Aug 6, 2019

As suggested in #104.

Please have a close look at TypeScript definition as I'm not that used to write TypeScript yet.

'media-src': ["'self'"],
}
```
To clear a directive from the default policy, set it to `null`.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since the configuration is not merged anymore, there isn't any need to set a directive to null. Missed to delete that sentence in #101.

README.md Outdated
// }
// Please refer to CSP specification for details on valid CSP directives:
// https://w3c.github.io/webappsec-csp/#framework-directives
policy?: { [key: string]: string[]; },
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

May provide a list of allowed keys but that would quickly get outdated as new keys might be added by CSP3, which is still an editor's draft or even by other specs (§6.5 Directives Defined in Other Documents).

Copy link
Member

Choose a reason for hiding this comment

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

TS interfaces allow additional keys, so I think we can list the ones we expect at the moment (AFAIK new keys are still somewhat uncommon)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the directive names as a type referenced as key. I hope that was the correct way. It's a very long list. But it's maybe helpful to explicitly state that all directives are supported and not only that one used in default config.

README.md Show resolved Hide resolved
README.md Outdated
// }
// Please refer to CSP specification for details on valid CSP directives:
// https://w3c.github.io/webappsec-csp/#framework-directives
policy?: { [key: string]: string[]; },
Copy link
Member

Choose a reason for hiding this comment

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

TS interfaces allow additional keys, so I think we can list the ones we expect at the moment (AFAIK new keys are still somewhat uncommon)

jelhan and others added 2 commits August 7, 2019 12:17
Co-Authored-By: Robert Jackson <me@rwjblue.com>
@jelhan
Copy link
Collaborator Author

jelhan commented Aug 7, 2019

@rwjblue Thanks for quick review! Addressed the feedback.

@jelhan
Copy link
Collaborator Author

jelhan commented Aug 7, 2019

Is there any way we could expose that type information to be used by consumers? Would provide helpful auto-completion and prevent typos in directive names.

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

This is great! Thank you!!!

@rwjblue
Copy link
Member

rwjblue commented Aug 8, 2019

Is there any way we could expose that type information to be used by consumers? Would provide helpful auto-completion and prevent typos in directive names.

Honestly, I'm not 100% sure but I think we could publish a .d.ts file so folks that wanted to use .ts could type their config/content-security-policy.ts:

module.exports = function(environment: string): import('ember-cli-content-security-policy').PolicyConfiguration {
  // return stuff....
}

@jelhan
Copy link
Collaborator Author

jelhan commented Aug 8, 2019

Honestly, I'm not 100% sure but I think we could publish a .d.ts file so folks that wanted to use .ts could type their config/content-security-policy.ts:

module.exports = function(environment: string): import('ember-cli-content-security-policy').PolicyConfiguration {
  // return stuff....
}

I will have a look into that one. Maybe some other addon is already doing it. Will have a look through possible candidates.

This PR is ready to be merged from my side.

@rwjblue rwjblue merged commit 0065c0f into adopted-ember-addons:master Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants