Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Django fix #286

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 21 additions & 98 deletions .github/workflows/end2end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,22 @@ name: End-to-End tests
on: [pull_request]

jobs:
test:
end2end-test:
runs-on: ubuntu-latest
strategy:
matrix:
app:
- { name: "django-mysql", test_file: "django_mysql_test.py" }
- { name: "django-mysql-gunicorn", test_file: "django_mysql_gunicorn_test.py" }
- { name: "django-postgres-gunicorn", test_file: "django_postgres_gunicorn_test.py" }
- { name: "flask-mongo", test_file: "flask_mongo_test.py" }
- { name: "flask-mysql", test_file: "flask_mysql_test.py" }
- { name: "flask-mysql-uwsgi", test_file: "flask_mysql_uwsgi_test.py" }
- { name: "flask-postgres", test_file: "flask_postgres_test.py" }
- { name: "flask-postgres-xml", test_file: "flask_postgres_xml_test.py" }
- { name: "flask-postgres-xml", test_file: "flask_postgres_xml_lxml_test.py" }
- { name: "quart-postgres-uvicorn", test_file: "quart_postgres_uvicorn_test.py" }
- { name: "starlette-postgres-uvicorn", test_file: "starlette_postgres_uvicorn_test.py" }
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -25,104 +39,13 @@ jobs:
python -m pip install --upgrade pip
make install

# django-mysql
- name: Start django-mysql
working-directory: ./sample-apps/django-mysql
- name: Start application
working-directory: ./sample-apps/${{ matrix.app.name }}
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for django-mysql
run: sleep 5 && poetry run pytest ./end2end/django_mysql_test.py

# django-mysql-gunicorn
- name: Restart mock server
run: docker restart mock_core
- name: Start django-mysql-gunicorn
working-directory: ./sample-apps/django-mysql-gunicorn
- name: Run end2end tests
working-directory: ./sample-apps/${{ matrix.app.name }}
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for django-mysql-gunicorn
run: sleep 5 && poetry run pytest ./end2end/django_mysql_gunicorn_test.py

# django-postgres-gunicorn
- name: Restart mock server
run: docker restart mock_core
- name: Start django-postgres-gunicorn
working-directory: ./sample-apps/django-postgres-gunicorn
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for django-postgres-gunicorn
run: sleep 5 && poetry run pytest ./end2end/django_postgres_gunicorn_test.py

# flask-mongo
- name: Restart mock server
run: docker restart mock_core
- name: Start flask-mongo
working-directory: ./sample-apps/flask-mongo
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for flask-mongo
run: sleep 5 && poetry run pytest ./end2end/flask_mongo_test.py

# flask-mysql
- name: Restart mock server
run: docker restart mock_core
- name: Start flask-mysql
working-directory: ./sample-apps/flask-mysql
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for flask-mysql
run: sleep 5 && poetry run pytest ./end2end/flask_mysql_test.py

# flask-mysql-uwsgi
- name: Restart mock server
run: docker restart mock_core
- name: Start flask-mysql-uwsgi
working-directory: ./sample-apps/flask-mysql-uwsgi
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for flask-mysql-uwsgi
run: sleep 5 && poetry run pytest ./end2end/flask_mysql_uwsgi_test.py

# flask-postgres
- name: Restart mock server
run: docker restart mock_core
- name: Start flask-postgres
working-directory: ./sample-apps/flask-postgres
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for flask-postgres
run: sleep 5 && poetry run pytest ./end2end/flask_postgres_test.py

# flask-postgres-xml
- name: Restart mock server
run: docker restart mock_core
- name: Start flask-postgres-xml
working-directory: ./sample-apps/flask-postgres-xml
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for flask-postgres-xml
run: |
sleep 5
poetry run pytest ./end2end/flask_postgres_xml_test.py
docker restart mock_core
poetry run pytest ./end2end/flask_postgres_xml_lxml_test.py

# quart-postgres-uvicorn
- name: Restart mock server
run: docker restart mock_core
- name: Start quart-postgres-uvicorn
working-directory: ./sample-apps/quart-postgres-uvicorn
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for quart-postgres-uvicorn
run: sleep 5 && poetry run pytest ./end2end/quart_postgres_uvicorn_test.py

# starlette-postgres-uvicorn
- name: Restart mock server
run: docker restart mock_core
- name: Start starlette-postgres-uvicorn
working-directory: ./sample-apps/starlette-postgres-uvicorn
run: |
docker compose -f docker-compose.yml -f docker-compose.benchmark.yml up --build -d
- name: Run end2end tests for starlette-postgres-uvicorn
run: sleep 5 && poetry run pytest ./end2end/starlette_postgres_uvicorn_test.py
sleep 5 && docker compose logs -f & cd ../../
poetry run pytest ./end2end/${{ matrix.app.test_file }}
1 change: 0 additions & 1 deletion aikido_zen/vulnerabilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def run_vulnerability_scan(kind, op, args):
if not context and kind != "ssrf":
# Make a special exception for SSRF, which checks itself if context is set.
# This is because some scans/tests for SSRF do not require a context to be set.
logger.debug("Not running scans, context not found; %s : %s", kind, op)
return

if not thread_cache and kind != "ssrf":
Expand Down
2 changes: 1 addition & 1 deletion aikido_zen/vulnerabilities/sql_injection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

return bool(c_int_res)
except Exception as e:
logger.debug("Exception in SQL algo: %s", e)
logger.info("Exception in SQL algo: %s", e)

Check warning on line 39 in aikido_zen/vulnerabilities/sql_injection/__init__.py

View check run for this annotation

Codecov / codecov/patch

aikido_zen/vulnerabilities/sql_injection/__init__.py#L39

Added line #L39 was not covered by tests
return False


Expand Down
Loading