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

DOCUMENTATION????????????? #18

Closed
strider72 opened this issue Nov 7, 2017 · 9 comments
Closed

DOCUMENTATION????????????? #18

strider72 opened this issue Nov 7, 2017 · 9 comments

Comments

@strider72
Copy link

strider72 commented Nov 7, 2017

For the love of God people, could you please document this?

I've spent an hour trying to figure out how to set report-uri and simply nothing works. CSPBuilder.php on line 107 thinks "/csp_reporting.php" is an array. Or something. I don't know, because I have no $#%*)^% idea how it's intended to work. AddDirective()? AddSource()? SacrificeFirstBornAtMidnight()?

@paragonie-scott
Copy link
Member

I agree that better documentation would be nice.

To resolve your immediate problem:

$cspBuilder->addDirective('report-uri', 'https://foo.example.com/csp_reporting.php');

@paragonie-scott
Copy link
Member

I've added an explicit, dedicated API method and included it in the README, for the next minor release: c214593

@strider72
Copy link
Author

strider72 commented Jan 16, 2018

I might write up a bit of documentation and send it your way. There are a few gotchas here and there. One followup question: How do I programmatically set "default-src" to 'none'?

I've tried addDirective( 'default-src', 'none' ) but that sets it to blank (literally default-src ;). Blank appears to have the same effect, but it's non-standard and non-standard makes me antsy.

EDIT:
I figured out how to explicitly set default-src to 'none'. Use false.

$csp->addDirective( 'default-src', false );

@strider72
Copy link
Author

How do I best contribute improved documentation? Just fork and do a pull request on readme.md ?

@paragonie-scott
Copy link
Member

That would be the best way, but if you don't have the time to fiddle with it, just share a list of things you find frustrating, difficult, confusing, etc. and I'll make a checklist.

@strider72
Copy link
Author

How do you install via composer. Is there a line I can add to my main Composer file?

@paragonie-scott
Copy link
Member

799291e

@strider72
Copy link
Author

Installing with Composer gives a message suggesting I install psr/http-message. You might want to add a bit in the docs saying why this is suggested.

@paragonie-security
Copy link
Contributor

I've moved this to a dependency. PSR dependencies are low risk, and this makes static analysis easier.

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

No branches or pull requests

3 participants