Skip to content

Commit

Permalink
Restrict content security policy to load data only from current origin
Browse files Browse the repository at this point in the history
Remove frame-acestors completely because it isn't included into an
iframe anymore. If this is still required the CSP settings can be
adjusted via a command line parameter.

More important don't allow executing javascript from inline html. Only
from references javascript files.

But allow to load CSS from inline <style> elements via style-src-elem
(not supported by firefox yet) and style-src CSP settings.

Fixes AP-1507
  • Loading branch information
bjoernricks committed Jul 20, 2021
1 parent edc594b commit 9c6bd5b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gsad/src/gsad.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@
* @brief Default value for HTTP header "Content-Security-Policy"
*/
#define DEFAULT_GSAD_CONTENT_SECURITY_POLICY \
"default-src 'self' 'unsafe-inline';" \
" img-src 'self' blob:;" \
" frame-ancestors 'self'"
"default-src 'self'; " \
"script-src 'self'; " \
"style-src-elem 'self' 'unsafe-inline'; " \
"style-src 'self' 'unsafe-inline'; " \
"img-src 'self' blob:;"

/**
* @brief Default "max-age" for HTTP header "Strict-Transport-Security"
Expand Down

0 comments on commit 9c6bd5b

Please sign in to comment.