Skip to content

Commit c2af511

Browse files
NLB-6875: update R34 Directives
1 parent adac193 commit c2af511

File tree

6 files changed

+122
-51
lines changed

6 files changed

+122
-51
lines changed

analyze.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,23 @@ const (
8282
ngxConfTake1234 = ngxConfTake123 | ngxConfTake4
8383

8484
// bit masks for different directive locations.
85-
ngxDirectConf = 0x00010000 // main file (not used)
86-
ngxMgmtMainConf = 0x00020000 // mgmt // unique bitmask that may not match NGINX source
87-
ngxMainConf = 0x00040000 // main context
88-
ngxEventConf = 0x00080000 // events
89-
ngxMailMainConf = 0x00100000 // mail
90-
ngxMailSrvConf = 0x00200000 // mail > server
91-
ngxStreamMainConf = 0x00400000 // stream
92-
ngxStreamSrvConf = 0x00800000 // stream > server
93-
ngxStreamUpsConf = 0x01000000 // stream > upstream
94-
ngxHTTPMainConf = 0x02000000 // http
95-
ngxHTTPSrvConf = 0x04000000 // http > server
96-
ngxHTTPLocConf = 0x08000000 // http > location
97-
ngxHTTPUpsConf = 0x10000000 // http > upstream
98-
ngxHTTPSifConf = 0x20000000 // http > server > if
99-
ngxHTTPLifConf = 0x40000000 // http > location > if
100-
ngxHTTPLmtConf = 0x80000000 // http > location > limit_except
85+
ngxDirectConf = 0x000010000 // main file (not used)
86+
ngxMgmtMainConf = 0x000020000 // mgmt // unique bitmask that may not match NGINX source
87+
ngxMainConf = 0x000040000 // main context
88+
ngxEventConf = 0x000080000 // events
89+
ngxMailMainConf = 0x000100000 // mail
90+
ngxMailSrvConf = 0x000200000 // mail > server
91+
ngxStreamMainConf = 0x000400000 // stream
92+
ngxStreamSrvConf = 0x000800000 // stream > server
93+
ngxStreamUpsConf = 0x001000000 // stream > upstream
94+
ngxHTTPMainConf = 0x002000000 // http
95+
ngxHTTPSrvConf = 0x004000000 // http > server
96+
ngxHTTPLocConf = 0x008000000 // http > location
97+
ngxHTTPUpsConf = 0x010000000 // http > upstream
98+
ngxHTTPSifConf = 0x020000000 // http > server > if
99+
ngxHTTPLifConf = 0x040000000 // http > location > if
100+
ngxHTTPLmtConf = 0x080000000 // http > location > limit_except
101+
ngxHTTPOIDCConf = 0x100000000 // http > oidc_provider
101102
)
102103

103104
// helpful directive location alias describing "any" context
@@ -126,6 +127,7 @@ var contexts = map[string]uint{
126127
blockCtx{"http", "location", "if"}.key(): ngxHTTPLifConf,
127128
blockCtx{"http", "location", "limit_except"}.key(): ngxHTTPLmtConf,
128129
blockCtx{"mgmt"}.key(): ngxMgmtMainConf,
130+
blockCtx{"http", "oidc_provider"}.key(): ngxHTTPOIDCConf,
129131
}
130132

131133
func enterBlockCtx(stmt *Directive, ctx blockCtx) blockCtx {

analyze_nplus_R34_directives.gen.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analyze_nplus_latest_directives.gen.go

Lines changed: 18 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analyze_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,6 +2894,42 @@ func TestAnalyze_oidc(t *testing.T) {
28942894
blockCtx{"stream"},
28952895
true,
28962896
},
2897+
"client_id args not ok": {
2898+
&Directive{
2899+
Directive: "client_id",
2900+
Args: []string{},
2901+
Line: 5,
2902+
},
2903+
blockCtx{"http", "oidc_provider"},
2904+
true,
2905+
},
2906+
"client_id args ok": {
2907+
&Directive{
2908+
Directive: "client_id",
2909+
Args: []string{"unique_id"},
2910+
Line: 5,
2911+
},
2912+
blockCtx{"http", "oidc_provider"},
2913+
false,
2914+
},
2915+
"client_id context not ok": {
2916+
&Directive{
2917+
Directive: "client_id",
2918+
Args: []string{"unique_id"},
2919+
Line: 5,
2920+
},
2921+
blockCtx{"http"},
2922+
true,
2923+
},
2924+
"client_id context ok": {
2925+
&Directive{
2926+
Directive: "client_id",
2927+
Args: []string{"unique_id"},
2928+
Line: 5,
2929+
},
2930+
blockCtx{"http", "oidc_provider"},
2931+
false,
2932+
},
28972933
}
28982934

28992935
for name, tc := range testcases {

scripts/generate/configs/nplus_R34_config.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
["ngxMailMainConf", "ngxMailSrvConf", "ngxConfTake1"],
8787
["ngxMgmtMainConf", "ngxConfTake1"],
8888
["ngxStreamMainConf", "ngxStreamSrvConf", "ngxConfTake1"],
89-
["ngxConfTake1"]
89+
["ngxHTTPOIDCConf", "ngxConfTake1"]
9090
],
9191
"ssl_name": [["ngxMgmtMainConf", "ngxConfTake1"]],
9292
"ssl_password_file": [
@@ -107,7 +107,7 @@
107107
["ngxMailMainConf", "ngxMailSrvConf", "ngxConfTake1"],
108108
["ngxMgmtMainConf", "ngxConfTake1"],
109109
["ngxStreamMainConf", "ngxStreamSrvConf", "ngxConfTake1"],
110-
["ngxConfTake1"]
110+
["ngxHTTPOIDCConf", "ngxConfTake1"]
111111
],
112112
"ssl_verify": [["ngxMgmtMainConf", "ngxConfFlag"]],
113113
"ssl_verify_depth": [
@@ -127,7 +127,18 @@
127127
["ngxMgmtMainConf","ngxConfTake1"]
128128
],
129129
"proxy_username": [["ngxMgmtMainConf","ngxConfTake1"]],
130-
"proxy_password": [["ngxMgmtMainConf","ngxConfTake1"]]
130+
"proxy_password": [["ngxMgmtMainConf","ngxConfTake1"]],
131+
"client_id": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
132+
"client_secret": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
133+
"issuer": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
134+
"config_url": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
135+
"cookie_name": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
136+
"extra_auth_args": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
137+
"redirect_uri": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
138+
"scope": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
139+
"session_store": [["ngxHTTPOIDCConf", "ngxConfTake1"]],
140+
"session_timeout": [["ngxHTTPOIDCConf", "ngxConfTake1"]]
141+
131142
},
132143

133144
"matchFuncComment":"MatchNginxPlusR34 contains directives in Nginx Plus R34 source code(including GEOIP, Perl, and XSLT)"

0 commit comments

Comments
 (0)