Open
Description
There seems to be a bunch of inline scripts or style rules such as this that don't play nice with CSP. These should be replaced by a CSS class.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
bkcsoft commentedon Dec 2, 2016
Yes, that should be a class, not inline style :)
Eriner commentedon Dec 11, 2016
As a note:
report-uri
is a CSP directive that informs the browser where to report violations. Something to consider is providing/setting this directive and ingesting it into gitea to make it available to administrators.denji commentedon Dec 17, 2016
https://github.com/unrolled/secure#content-security-policy
Bwko commentedon Dec 18, 2016
I'm currently implementing a Content-Security-Policy but we need style-src: unsafe-inline & script-src: unsafe-eval for semantic ui & jquery datetimepicker.
@bamboleeeero-bamboleeeero any advice on this?
tboerger commentedon Dec 18, 2016
We should get rid of all inline crap.
Bwko commentedon Dec 18, 2016
@tboerger I'm almost done with that (except for labels) but for tooltips semantic ui needs unsafe-inline 😕
tboerger commentedon Dec 18, 2016
Even tooltips can be perfectly done with data attributes and unobtrusive js.
hasufell commentedon Jun 6, 2018
any news?
clarfonthey commentedon Jun 23, 2018
Personally, I would appreciate at least adding a content-security-policy header to Gitea, slowly making it more strict as changes are made. At least things like
form-action
andframe-ancestors
would be nice, which are doable now.I'd be willing to work on this within the next few days if someone more-acquainted with the codebase isn't up to it!
toth-dev commentedon Jun 23, 2018
I'm adding this CSP with nginx:
Everything seems to work with this.
hasufell commentedon Jun 23, 2018
@totpet interesting, I tried that too and it seems to work so far, but afais mozilla observatory reports this as -20 score, so it seems to be too lax.
clarfonthey commentedon Jun 23, 2018
As I said, things like
frame-ancestors
andform-action
are really important parts of CSP that we could add for existing gitea. Addingunsafe-inline
andunsafe-eval
to JavaScript are really bad though, and that pretty much negates everything else.46 remaining items