Skip to content

Commit 9956b1b

Browse files
committed
Merge remote-tracking branch 'origin' into scanner
2 parents 5a23f3d + 248dc71 commit 9956b1b

32 files changed

+15551
-2335
lines changed

analyze.go

Lines changed: 39 additions & 2255 deletions
Large diffs are not rendered by default.

analyze_appProtectWAFv4_directives.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package crossplane
2+
3+
// nginx app protect specific and global directives, inferred from
4+
// [https://docs.nginx.com/nginx-app-protect/configuration-guide/configuration/#directives]
5+
6+
//nolint:gochecknoglobals
7+
var appProtectWAFv4Directives = map[string][]uint{
8+
"app_protect_compressed_requests_action": {
9+
ngxHTTPMainConf | ngxConfTake1,
10+
},
11+
"app_protect_cookie_seed": {
12+
ngxHTTPMainConf | ngxConfTake1,
13+
},
14+
"app_protect_cpu_thresholds": {
15+
ngxHTTPMainConf | ngxConfTake2,
16+
},
17+
"app_protect_enable": {
18+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfFlag,
19+
},
20+
"app_protect_failure_mode_action": {
21+
ngxHTTPMainConf | ngxConfTake1,
22+
},
23+
"app_protect_physical_memory_util_thresholds": {
24+
ngxHTTPMainConf | ngxConfTake2,
25+
},
26+
"app_protect_policy_file": {
27+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
28+
},
29+
"app_protect_reconnect_period_seconds": {
30+
ngxHTTPMainConf | ngxConfTake1,
31+
},
32+
"app_protect_request_buffer_overflow_action": {
33+
ngxHTTPMainConf | ngxConfTake1,
34+
},
35+
"app_protect_security_log_enable": {
36+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfFlag,
37+
},
38+
"app_protect_security_log": {
39+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
40+
},
41+
"app_protect_user_defined_signatures": {
42+
ngxHTTPMainConf | ngxConfTake1,
43+
},
44+
}
45+
46+
// AppProtectWAFv4DirectivesMatchFn is a match function for parsing an NGINX config that contains the
47+
// App Protect v4 module.
48+
func AppProtectWAFv4DirectivesMatchFn(directive string) ([]uint, bool) {
49+
masks, matched := appProtectWAFv4Directives[directive]
50+
return masks, matched
51+
}

analyze_appProtectWAFv5_directives.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package crossplane
2+
3+
// nginx app protect specific and global directives, inferred from
4+
// [https://docs.nginx.com/nginx-app-protect/configuration-guide/configuration/#directives]
5+
6+
//nolint:gochecknoglobals
7+
var appProtectWAFv5Directives = map[string][]uint{
8+
"app_protect_physical_memory_util_thresholds": {
9+
ngxHTTPMainConf | ngxConfTake2,
10+
},
11+
"app_protect_cpu_thresholds": {
12+
ngxHTTPMainConf | ngxConfTake2,
13+
},
14+
"app_protect_failure_mode_action": {
15+
ngxHTTPMainConf | ngxConfTake1,
16+
},
17+
"app_protect_cookie_seed": {
18+
ngxHTTPMainConf | ngxConfTake1,
19+
},
20+
"app_protect_request_buffer_overflow_action": {
21+
ngxHTTPMainConf | ngxConfTake1,
22+
},
23+
"app_protect_reconnect_period_seconds": {
24+
ngxHTTPMainConf | ngxConfTake1,
25+
},
26+
"app_protect_enforcer_address": {
27+
ngxHTTPMainConf | ngxConfTake1,
28+
},
29+
"app_protect_enable": {
30+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfFlag,
31+
},
32+
"app_protect_policy_file": {
33+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
34+
},
35+
"app_protect_security_log_enable": {
36+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfFlag,
37+
},
38+
"app_protect_security_log": {
39+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
40+
},
41+
"app_protect_custom_log_attribute": {
42+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
43+
},
44+
}
45+
46+
// AppProtectWAFv5DirectivesMatchFn is a match function for parsing an NGINX config that contains the
47+
// App Protect v5 module.
48+
func AppProtectWAFv5DirectivesMatchFn(directive string) ([]uint, bool) {
49+
masks, matched := appProtectWAFv5Directives[directive]
50+
return masks, matched
51+
}

analyze_headersMore_directives.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright (c) F5, Inc.
3+
*
4+
* This source code is licensed under the Apache License, Version 2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// All the definitions are extracted from the source code
9+
// Each bit mask describes these behaviors:
10+
// - how many arguments the directive can take
11+
// - whether or not it is a block directive
12+
// - whether this is a flag (takes one argument that's either "on" or "off")
13+
// - which contexts it's allowed to be in
14+
15+
package crossplane
16+
17+
//nolint:gochecknoglobals
18+
var moduleHeadersMoreDirectives = map[string][]uint{
19+
"more_clear_headers": {
20+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConf1More,
21+
},
22+
"more_clear_input_headers": {
23+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConf1More,
24+
},
25+
"more_set_headers": {
26+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConf1More,
27+
},
28+
"more_set_input_headers": {
29+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxHTTPLifConf | ngxConf1More,
30+
},
31+
}
32+
33+
func HeadersMoreDirectivesMatchFn(directive string) ([]uint, bool) {
34+
masks, matched := moduleHeadersMoreDirectives[directive]
35+
return masks, matched
36+
}

0 commit comments

Comments
 (0)