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

Make nginx-14 and nginx-16 disabled by default based on dev-sec/nginx-baseline#21 #26

Merged
merged 3 commits into from
Nov 21, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions controls/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
default: 'GET\|HEAD\|POST'
)

HTTP_METHODS_CHECK = attribute(
'http_methods_check',
description: 'Defines if http_methods should be checked in the nginx configuration',
default: false
)

NGINX_COOKIE_FLAG_MODULE = attribute(
'nginx_cookie_flag_module',
description: 'Defines if nginx has been compiled with nginx_cookie_flag_module',
default: false
)

only_if do
command('nginx').exist?
end
Expand Down Expand Up @@ -249,6 +261,7 @@
desc 'Disable insecure HTTP-methods and allow only necessary methods.'
ref 'OWASP HTTP Methods', url: 'https://www.owasp.org/index.php/Test_HTTP_Methods_(OTG-CONFIG-006)'

only_if { HTTP_METHODS_CHECK != false }
describe file(nginx_conf) do
its('content') { should match(/^\s*if\s+\(\$request_method\s+\!\~\s+\^\(#{HTTP_METHODS}\)\$\)\{?$/) }
end
Expand All @@ -267,6 +280,7 @@
impact 1.0
title 'Set cookie with HttpOnly and Secure flag'
desc 'You can mitigate most of the common Cross Site Scripting attack using HttpOnly and Secure flag in a cookie. Without having HttpOnly and Secure, it is possible to steal or manipulate web application session and cookies and it’s dangerous.'
only_if { NGINX_COOKIE_FLAG_MODULE != false }
describe parse_config_file(nginx_hardening, options_add_header) do
its('content') { should match(/^\s*set_cookie_flag * HttpOnly secure;$/) }
end
Expand Down