-
Notifications
You must be signed in to change notification settings - Fork 191
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
feat: add CSP and other security related headers in the oCIS proxy service #8777
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
55a29eb
to
669fd12
Compare
We need to be very thorough with regresssions here. @wkloucek Tested that via the reverse proxy and this broke all web client, app provider and web office features. |
I like this elegant approach. 😍 |
This is just a starting point.... Needs a lot of testing and finally adjustments in web and integrated systems.... |
We might want to consider to add CSP only on the front end service... |
web assets (js and config) are coming from the What about the apis? |
CSP is only relevant for web hosting endpoints. |
669fd12
to
e3226d3
Compare
@micbar where can I get following information
|
e3226d3
to
24b62a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like it 👍 some questions and please comment exported funcs
5c92314
to
9ae23ee
Compare
63040a7
to
92a1eec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a tiny error message text suggestion.
19ac7bb
to
7148f1c
Compare
878515b
to
3f3aadb
Compare
Oh come on ...... |
169a807
to
c62d75b
Compare
c62d75b
to
eeecd5d
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Sorry to intervene, but now we have different env var parsers, the ocis yaml files parse with gookit, the csp yaml with the new lib. We should align. |
Use gookit for csp.yaml:Have two different syntax in the docker compose setup? Use os.ExpandEnvhttps://pkg.go.dev/os#ExpandEnv Question on gookit usageWhich syntax for car substitution is used in ocis? |
I think we should use your new lib (envsubst) in ocis for the ocis yaml config. There is one |
Here https://github.com/owncloud/ocis/blob/master/ocis-pkg/config/helpers.go#L21 We should be able to pass the config as |
Any example config files at hand which hold env vars? |
All ocis config vars can also be set by yaml files. A rendered version is located in the dev docs in every service. |
…rvice (#8777) * feat: add CSP and other security related headers in the oCIS proxy service * fix: consolidate security related headers - drop middleware.Secure * fix: use github.com/DeepDiver1975/secure * fix: acceptance tests * feat: support env var replacements in csp.yaml
@@ -88,8 +88,10 @@ services: | |||
MICRO_REGISTRY_ADDRESS: 127.0.0.1:9233 | |||
NATS_NATS_HOST: 0.0.0.0 | |||
NATS_NATS_PORT: 9233 | |||
PROXY_CSP_CONFIG_FILE_LOCATION: /etc/ocis/csp.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DeepDiver1975
Shouldn't ONLYOFFICE_DOMAIN
and COLLABORA_DOMAIN
be set here as well in order for the substitution in etc/ocis/csp.yaml
to take effect?
ONLYOFFICE_DOMAIN: ${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
COLLABORA_DOMAIN: ${COLLABORA_DOMAIN:-collabora.owncloud.test}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DeepDiver1975 Yes, I mean the csp.yaml
is being loaded inside the containers environment, so if the ONLYOFFICE_DOMAIN
and COLLABORA_DOMAIN
are not set in the docker-compose.yml
file they will be empty during runtime and the default values are used. (This is at least what happened when I tried it.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I see your point now.let me have a look .....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two variables need to be set in the .env
file.
https://github.com/owncloud/ocis/blob/master/deployments/examples/ocis_wopi/.env#L46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes - but the env vars are not forwarded into the ocis container and will always be set to the default.
pr coming ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THX a lot @kjeldahl for bringing this to our attention! 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DeepDiver1975 You are most welcome. And thanks a lot for solving the CSP issue 4 hours before I ran into it 👍
Description
CSP headers and other security related headers are now added to http responses in the proxy service.
The default settings are loaded from https://github.com/owncloud/ocis/pull/8777/files#diff-106b7ab6229528e8a62323d217f101db7000e6918aefb124cea4c845d6b9d1c8
This default yaml config file can be overwritten by specifying an alternative yaml file path in the env var
PROXY_CSP_CONFIG_FILE_LOCATION
The ocis_wopi example deployment shows how to do this - refs https://github.com/owncloud/ocis/pull/8777/files#diff-bfedf12f7818c318b754f308bff1d6139afd701f2fc7bb43f07fd865a0d85039
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: