Skip to content

Commit a23b568

Browse files
authored
Merge pull request #26 from woneill/optional_tests
Make nginx-14 and nginx-16 disabled by default based on #21
2 parents 591c291 + fc43237 commit a23b568

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

controls/nginx_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@
7575
default: 'GET\|HEAD\|POST'
7676
)
7777

78+
HTTP_METHODS_CHECK = attribute(
79+
'http_methods_check',
80+
description: 'Defines if http_methods should be checked in the nginx configuration',
81+
default: false
82+
)
83+
84+
NGINX_COOKIE_FLAG_MODULE = attribute(
85+
'nginx_cookie_flag_module',
86+
description: 'Defines if nginx has been compiled with nginx_cookie_flag_module',
87+
default: false
88+
)
89+
7890
only_if do
7991
command('nginx').exist?
8092
end
@@ -241,6 +253,7 @@
241253
desc 'Disable insecure HTTP-methods and allow only necessary methods.'
242254
ref 'OWASP HTTP Methods', url: 'https://www.owasp.org/index.php/Test_HTTP_Methods_(OTG-CONFIG-006)'
243255

256+
only_if { HTTP_METHODS_CHECK != false }
244257
describe file(nginx_conf) do
245258
its('content') { should match(/^\s*if\s+\(\$request_method\s+\!\~\s+\^\(#{HTTP_METHODS}\)\$\)\{?$/) }
246259
end
@@ -259,6 +272,7 @@
259272
impact 1.0
260273
title 'Set cookie with HttpOnly and Secure flag'
261274
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.'
275+
only_if { NGINX_COOKIE_FLAG_MODULE != false }
262276
describe parse_config(nginx_parsed_config, options_add_header) do
263277
its('set_cookie_flag') { should include '* HttpOnly secure' }
264278
end

0 commit comments

Comments
 (0)