Allow both versioned and unversioned packages api endpoints

This commit is contained in:
2026-04-24 09:38:58 +02:00
parent 405f6ee04f
commit 9b2012352b
@@ -45,7 +45,7 @@ SecRule &TX:restricted_extensions "@eq 0" \
phase:1,\
pass,\
nolog,\
ver:'gitea-proxy-rule-exclusions-plugin/1.5.0',\
ver:'gitea-proxy-rule-exclusions-plugin/1.6.0',\
setvar:'tx.restricted_extensions=.backup/ .bak/ .cdx/ .cer/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .printer/ .rdb/ .swp/ .sys/'"
# Copy of CRS rule 901160.
@@ -83,12 +83,12 @@ SecRule REQUEST_URI "@beginsWith /v2" \
SecRule REQUEST_URI "@strmatch /blobs/uploads/" "t:none"
# Modify CRS rule 911100 and 920420. CURL package uploads
SecRule REQUEST_URI "@beginsWith /api/packages" \
SecRule REQUEST_URI "@rx ^\/api\/(v\d+\/)?packages" \
"id:92012,\
phase:1,\
pass,\
t:none,\
ver:'gitea-proxy-rule-exclusions-plugin/1.3.0',\
ver:'gitea-proxy-rule-exclusions-plugin/1.8.0',\
nolog,\
setvar:'tx.allowed_request_content_type=%{TX.allowed_request_content_type} |application/octet-stream|',\
setvar:'tx.allowed_methods=%{tx.allowed_methods} PUT DELETE',\
@@ -100,6 +100,8 @@ SecRule REQUEST_URI "@streq /repo/create" \
phase:1,\
t:none,\
pass,\
nolog,\
ver:'gitea-proxy-rule-exclusions-plugin/1.7.0',\
ctl:ruleRemoveTargetById=932260;ARGS:repo_name"
# Disable UNIX command checking on the repo settings name ARGS
@@ -107,7 +109,9 @@ SecRule REQUEST_URI "@endsWith settings" \
"id:92014,\
phase:1,\
t:none,\
nolog,\
pass,\
ver:'gitea-proxy-rule-exclusions-plugin/1.7.0',\
ctl:ruleRemoveTargetById=932260;ARGS:repo_name"
# Provide a way to whitelist filenames that are in restricted-files.data