mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Merge pull request #3111 from RasmusWL/python-fabric-command-injection
Approved by BekaValentine
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from .connection import Connection
|
||||
from .group import Group, SerialGroup, ThreadingGroup
|
||||
from .tasks import task
|
||||
25
python/ql/test/query-tests/Security/lib/fabric/api.py
Normal file
25
python/ql/test/query-tests/Security/lib/fabric/api.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# For the 1.x version
|
||||
|
||||
def needs_host(func):
|
||||
@wraps(func)
|
||||
def inner(*args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
return inner
|
||||
|
||||
|
||||
def local(command, capture=False, shell=None):
|
||||
pass
|
||||
|
||||
|
||||
@needs_host
|
||||
def run(command, shell=True, pty=True, combine_stderr=None, quiet=False,
|
||||
warn_only=False, stdout=None, stderr=None, timeout=None, shell_escape=None,
|
||||
capture_buffer_size=None):
|
||||
pass
|
||||
|
||||
|
||||
@needs_host
|
||||
def sudo(command, shell=True, pty=True, combine_stderr=None, user=None,
|
||||
quiet=False, warn_only=False, stdout=None, stderr=None, group=None,
|
||||
timeout=None, shell_escape=None, capture_buffer_size=None):
|
||||
pass
|
||||
15
python/ql/test/query-tests/Security/lib/fabric/connection.py
Normal file
15
python/ql/test/query-tests/Security/lib/fabric/connection.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from invoke import Context
|
||||
|
||||
@decorator
|
||||
def opens(method, self, *args, **kwargs):
|
||||
self.open()
|
||||
return method(self, *args, **kwargs)
|
||||
|
||||
class Connection(Context):
|
||||
|
||||
def open(self):
|
||||
pass
|
||||
|
||||
@opens
|
||||
def run(self, command, **kwargs):
|
||||
pass
|
||||
11
python/ql/test/query-tests/Security/lib/fabric/group.py
Normal file
11
python/ql/test/query-tests/Security/lib/fabric/group.py
Normal file
@@ -0,0 +1,11 @@
|
||||
class Group(list):
|
||||
def run(self, *args, **kwargs):
|
||||
raise NotImplementedError
|
||||
|
||||
class SerialGroup(Group):
|
||||
def run(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
class ThreadingGroup(Group):
|
||||
def run(self, *args, **kwargs):
|
||||
pass
|
||||
2
python/ql/test/query-tests/Security/lib/fabric/tasks.py
Normal file
2
python/ql/test/query-tests/Security/lib/fabric/tasks.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def task(*args, **kwargs):
|
||||
pass
|
||||
@@ -0,0 +1,8 @@
|
||||
from .context import Context
|
||||
from .tasks import task
|
||||
|
||||
def run(command, **kwargs):
|
||||
pass
|
||||
|
||||
def sudo(command, **kwargs):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
class Context(object):
|
||||
def run(self, command, **kwargs):
|
||||
pass
|
||||
2
python/ql/test/query-tests/Security/lib/invoke/tasks.py
Normal file
2
python/ql/test/query-tests/Security/lib/invoke/tasks.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def task(*args, **kwargs):
|
||||
pass
|
||||
Reference in New Issue
Block a user