Skip to content

Commit

Permalink
Update logo file references and Python version support
Browse files Browse the repository at this point in the history
Aligned logo references in README files to updated file name 'gixy.png'. Enlarged officially supported Python versions list in 'setup.py', listing versions 3.6 to 3.12. Improved Python >=3.6 support statement in 'README.RU.md'.
  • Loading branch information
dvershinin committed Jan 18, 2024
1 parent 5ab8bd7 commit ea9ae26
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 23 deletions.
21 changes: 11 additions & 10 deletions README.RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@ GIXY
[![GitHub pull requests](https://img.shields.io/github/issues-pr/dvershinin/gixy.svg?style=flat-square)](https://github.com/dvershinin/gixy/pulls)

# Overview
<img align="right" width="192" height="192" src="/docs/logo.png">
<img align="right" width="192" height="192" src="/docs/gixy.png">

Gixy — это утилита для анализа конфигурации Nginx.
Большей частью служит для обнаружения проблем безопасности, но может искать и иные ошибки.

Официально поддерживаются версии Python 2.7, 3.5, 3.6 и 3.7
Официально поддерживаются версии Python >= 3.6.

&nbsp;
# Что умеет
На текущий момент Gixy способна обнаружить:
* [[ssrf] Server Side Request Forgery](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/ssrf.md)
* [[http_splitting] HTTP Splitting](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/httpsplitting.md)
* [[origins] Проблемы валидации referrer/origin](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/origins.md)
* [[add_header_redefinition] Переопределение "вышестоящих" заголовков ответа директивой "add_header"](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/addheaderredefinition.md)
* [[host_spoofing] Подделка заголовка запроса Host](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/hostspoofing.md)
* [[valid_referers] none in valid_referers](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/validreferers.md)
* [[add_header_multiline] Многострочные заголовоки ответа](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/addheadermultiline.md)
* [[alias_traversal] Path traversal при использовании alias](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/aliastraversal.md)

* [[ssrf] Server Side Request Forgery](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/ssrf.md)
* [[http_splitting] HTTP Splitting](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/httpsplitting.md)
* [[origins] Проблемы валидации referrer/origin](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/origins.md)
* [[add_header_redefinition] Переопределение "вышестоящих" заголовков ответа директивой "add_header"](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/addheaderredefinition.md)
* [[host_spoofing] Подделка заголовка запроса Host](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/hostspoofing.md)
* [[valid_referers] none in valid_referers](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/validreferers.md)
* [[add_header_multiline] Многострочные заголовоки ответа](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/addheadermultiline.md)
* [[alias_traversal] Path traversal при использовании alias](https://github.com/dvershinin/gixy/blob/master/docs/ru/plugins/aliastraversal.md)

Проблемы, которым Gixy только учится можно найти в [Issues с меткой "new plugin"](https://github.com/dvershinin/gixy/issues?q=is%3Aissue+is%3Aopen+label%3A%22new+plugin%22)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GIXY
[![GitHub pull requests](https://img.shields.io/github/issues-pr/dvershinin/gixy.svg?style=flat-square)](https://github.com/dvershinin/gixy/pulls)

# Overview
<img align="right" width="192" height="192" src="/docs/logo.png">
<img align="right" width="192" height="192" src="docs/gixy.png">

Gixy is a tool to analyze Nginx configuration.
The main goal of Gixy is to prevent security misconfiguration and automate flaw detection.
Expand Down
Binary file added docs/gixy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GIXY
[![GitHub pull requests](https://img.shields.io/github/issues-pr/dvershinin/gixy.svg?style=flat-square)](https://github.com/dvershinin/gixy/pulls)

# Overview
<img align="right" width="192" height="192" src="logo.png">
<img align="right" width="192" height="192" src="gixy.png">

Gixy is a tool to analyze Nginx configuration.
The main goal of Gixy is to prevent security misconfiguration and automate flaw detection.
Expand Down
26 changes: 16 additions & 10 deletions gixy/directives/directive.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""This module contains all the classes for directives"""
from gixy.core.variable import Variable
from gixy.core.regexp import Regexp


def get_overrides():
"""Get a list of all directives that override the default behavior"""
result = {}
for klass in Directive.__subclasses__():
if not klass.nginx_name:
Expand All @@ -15,7 +17,8 @@ def get_overrides():
return result


class Directive(object):
class Directive:
"""Base class for all directives"""
nginx_name = None
is_block = False
provide_variables = False
Expand All @@ -27,6 +30,7 @@ def __init__(self, name, args, raw=None):
self._raw = raw

def set_parent(self, parent):
"""Set parent block for this directive"""
self.parent = parent

@property
Expand Down Expand Up @@ -75,7 +79,7 @@ class AuthRequestSetDirective(Directive):
provide_variables = True

def __init__(self, name, args):
super(AuthRequestSetDirective, self).__init__(name, args)
super().__init__(name, args)
self.variable = args[0].strip('$')
self.value = args[1]

Expand All @@ -85,11 +89,12 @@ def variables(self):


class PerlSetDirective(Directive):
"""The perl_set directive is used to set a value of a variable to a value"""
nginx_name = 'perl_set'
provide_variables = True

def __init__(self, name, args):
super(PerlSetDirective, self).__init__(name, args)
super().__init__(name, args)
self.variable = args[0].strip('$')
self.value = args[1]

Expand All @@ -103,7 +108,7 @@ class SetByLuaDirective(Directive):
provide_variables = True

def __init__(self, name, args):
super(SetByLuaDirective, self).__init__(name, args)
super().__init__(name, args)
self.variable = args[0].strip('$')
self.value = args[1]

Expand All @@ -118,7 +123,7 @@ class RewriteDirective(Directive):
boundary = Regexp(r'[^\s\r\n]')

def __init__(self, name, args):
super(RewriteDirective, self).__init__(name, args)
super().__init__(name, args)
self.pattern = args[0]
self.replace = args[1]
self.flag = None
Expand All @@ -135,11 +140,12 @@ def variables(self):


class RootDirective(Directive):
"""The root directive is used to define a directory that will hold the files."""
nginx_name = 'root'
provide_variables = True

def __init__(self, name, args):
super(RootDirective, self).__init__(name, args)
super().__init__(name, args)
self.path = args[0]

@property
Expand All @@ -151,14 +157,14 @@ class AliasDirective(Directive):
nginx_name = 'alias'

def __init__(self, name, args):
super(AliasDirective, self).__init__(name, args)
super().__init__(name, args)
self.path = args[0]


def is_local_ipv6(ip):
"""
Check if an IPv6 address is a local address
IP may include a port number, e.g. [::1]:80
IP may include a port number, e.g. `[::1]:80`
If port is not specified, IP can be specified without brackets, e.g. ::1
"""
# Remove brackets if present
Expand Down Expand Up @@ -200,7 +206,7 @@ class ResolverDirective(Directive):
nginx_name = 'resolver'

def __init__(self, name, args):
super(ResolverDirective, self).__init__(name, args)
super().__init__(name, args)
addresses = []
for arg in args:
if '=' in arg:
Expand All @@ -216,7 +222,7 @@ def get_external_nameservers(self):
if '.' in addr and is_local_ipv4(addr):
continue
# Check for IPv6 addresses
elif ':' in addr and is_local_ipv6(addr):
if ':' in addr and is_local_ipv6(addr):
continue

external_nameservers.append(addr)
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@
'Intended Audience :: Developers',
'Topic :: Security',
'Topic :: Software Development :: Quality Assurance',
'Topic :: Software Development :: Testing'
'Topic :: Software Development :: Testing',
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"
],
include_package_data=True
)

0 comments on commit ea9ae26

Please sign in to comment.