forked from yandex/gixy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First try to implement path traversal detection (via alias)
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import gixy | ||
from gixy.plugins.plugin import Plugin | ||
|
||
|
||
class alias_traversal(Plugin): | ||
""" | ||
Insecure example: | ||
location /files { | ||
alias /home/; | ||
} | ||
""" | ||
summary = 'Path traversal via misconfigured alias.' | ||
severity = gixy.severity.HIGH | ||
description = 'TODO' | ||
help_url = 'https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md' | ||
directives = ['alias'] | ||
|
||
def audit(self, directive): | ||
for location in directive.parents: | ||
if location.name != 'location': | ||
continue | ||
if not location.modifier or location.modifier == '^~': | ||
# We need non-strict prefixed locations | ||
if not location.path.endswith('/'): | ||
self.add_issue(directive=[directive, location]) | ||
break |