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

Added web security headers for nginx configuration #5183

Merged
merged 12 commits into from
Mar 12, 2021

Conversation

ashwini-orchestral
Copy link
Contributor

Added a few web security headers in the Nginx configuration.
For example - X-Frame-Options Header, Cache-control.
Disable server version information.

@pull-request-size pull-request-size bot added the size/XS PR that changes 0-9 lines. Quick fix/merge. label Mar 8, 2021
conf/nginx/st2.conf Outdated Show resolved Hide resolved
conf/nginx/st2.conf Outdated Show resolved Hide resolved
@arm4b arm4b added this to the 3.5.0 milestone Mar 9, 2021
@pull-request-size pull-request-size bot added size/S PR that changes 10-29 lines. Very easy to review. and removed size/XS PR that changes 0-9 lines. Quick fix/merge. labels Mar 10, 2021
@@ -40,6 +40,10 @@ server {

add_header Front-End-Https on;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY always;
add_header Strict-Transport-Security "max-age=3153600;includeSubDomains";
add_header Cache-Control "no-store; no-cache; max-age=0; must-revalidate;";
Copy link
Member

@arm4b arm4b Mar 10, 2021

Choose a reason for hiding this comment

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

While the security-focused headers are all good, I'm wondering what would be the user impact for the Cache-Control changes here and totally disabling the caching? @ashwini-orchestral what are the specific reasons behind hardening cache-control this way?

WDYT @StackStorm/maintainers @StackStorm/contributors? Any downsides, any behavior/UX changes you could think of?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, +1, I don't see much benefit security wise from cache control headers, it would just slow things down if we need to re-fetch all the static resources on each page (re)load...

But others (iframe, stric transport security, etc.) are indeed a good idea 👍

On that note, I believe we need to sync up multiple places (if they don't contain those headers already) - Docker, installer, etc. Or do those places use config from this repo?

Copy link
Member

@arm4b arm4b Mar 10, 2021

Choose a reason for hiding this comment

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

Right, we're pulling in all the places nginx config from the st2 repo (this file).

I think only Puppet is different with the templating @nmaludy ? I guess you'll need to update that

@Kami
Copy link
Member

Kami commented Mar 10, 2021

On a somewhat related note:

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

TLS v1.0 and v1.1 are also both past it's prime time now so it would probably be a good idea to just support TLS v1.2 going forward.

I don't think it should negatively affect any installations (most everything supports TLS v1.2 these days), but we can document it in ugprade notes and on how to add support for TLS v1.1 back, if needed.

@arm4b
Copy link
Member

arm4b commented Mar 10, 2021

@Kami Good point.
@nmaludy raised this before in Proposal: Tighten up SSL protocols and ciphers in nginx config #44 and feels it's a good time to do it?

Only support TLS v1.2 which is the recommended and safe choice at this point.
@Kami
Copy link
Member

Kami commented Mar 10, 2021

@armab Yeah, I think now is the right time.

I will also open docs and upgrade notes entry with that in case it affects someone, but I think that would be quite unlikely.

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_protocols TLSv1.2;
Copy link
Member

Choose a reason for hiding this comment

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

@arm4b arm4b requested review from nmaludy, punkrokk and a team March 10, 2021 20:19
arm4b
arm4b previously requested changes Mar 10, 2021
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

@ashwini-orchestral Left one change request per team feedback and please also provide a Changelog record for this PR.

conf/nginx/st2.conf Outdated Show resolved Hide resolved
@arm4b arm4b requested a review from a team March 10, 2021 21:28
@shital-orchestral
Copy link

Added web header settings for possible security issues, X-Frame-Options, Strict-Transport-Security, X-XSS-Protection and server-tokens.
Thanks,
shital-orchestral

Copy link
Contributor

@m4dcoder m4dcoder left a comment

Choose a reason for hiding this comment

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

Per @ashwini-orchestral, she has tested this nginx configuration change on an st2 install and there's no obvious issue as a result. This change is required to harden st2 deployment.

@m4dcoder
Copy link
Contributor

@ashwini-orchestral Can you add an entry in the CHANGELOG?

CHANGELOG.rst Outdated Show resolved Hide resolved
@Kami Kami merged commit 9e9334e into StackStorm:master Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement security size/S PR that changes 10-29 lines. Very easy to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants