mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
Reapply "nginx check regex in location field"
This reverts commit 8fb78d904b
.
Original commit from Kayou
This commit is contained in:
parent
6d02162945
commit
377f425d17
1 changed files with 21 additions and 0 deletions
|
@ -1432,6 +1432,27 @@ class Configurations(TestSuite):
|
||||||
f"\nOffending line(s) [{lines}]"
|
f"\nOffending line(s) [{lines}]"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@test()
|
||||||
|
def misc_nginx_check_regex_in_location(self):
|
||||||
|
app = self.app
|
||||||
|
for filename in (
|
||||||
|
os.listdir(app.path + "/conf") if os.path.exists(app.path + "/conf") else []
|
||||||
|
):
|
||||||
|
# Ignore subdirs or filename not containing nginx in the name
|
||||||
|
if (
|
||||||
|
not os.path.isfile(app.path + "/conf/" + filename)
|
||||||
|
or "nginx" not in filename
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
|
||||||
|
cmd = 'grep -q -IhEro "location ~ __PATH__" %s' % filename
|
||||||
|
|
||||||
|
if os.system(cmd) != 0:
|
||||||
|
yield Warning(
|
||||||
|
"When using regexp in the nignx location field (location ~ __PATH__), start the path with ^ (location ~ ^__PATH__)."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@test()
|
@test()
|
||||||
def misc_nginx_path_traversal(self):
|
def misc_nginx_path_traversal(self):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue