Skip to content

Commit cbb5547

Browse files
committed
restrict valid github repo name in nginx config
1 parent fa4a132 commit cbb5547

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/k8s-io/configmap-nginx.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ data:
2727
return 200 'ok';
2828
}
2929
30-
location ~ ^/(?<repo>[^/]*)(?<subpath>/.*)?$ {
30+
location ~ ^/(?<repo>[A-Za-z0-9\-_\.]+)(?<subpath>/.*)?$ {
3131
# $https is set to 'on' when connecting to nginx via HTTPS directly.
3232
set $https_status $https;
3333
if ($http_x_forwarded_proto = 'https') {
@@ -106,7 +106,7 @@ data:
106106
listen 80;
107107
108108
# The ?! block is negative-lookahead to prevent `/repo/` from grouping into (`repo`, `/`) while `/repo/path` will still group as (`repo`, `/path`).
109-
location ~ ^/(?<sig_repo>.*?)(?!/+$)(?<repo_subpath>/.*)?$ {
109+
location ~ ^/(?<sig_repo>[A-Za-z0-9\-_\.]+)(?!/+$)(?<repo_subpath>/.*)?$ {
110110
# $https is set to 'on' when connecting to nginx via HTTPS directly.
111111
set $https_status $https;
112112
if ($http_x_forwarded_proto = 'https') {

0 commit comments

Comments
 (0)