Skip to content

Commit

Permalink
Merge pull request #55 from dolevf/feat/stabilize-docker
Browse files Browse the repository at this point in the history
Stabilize Dockerfile, adjust test query
  • Loading branch information
nicholasaleks authored Jul 7, 2022
2 parents 06666ba + e39bc51 commit 1f92c3f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
31 changes: 19 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,34 @@ FROM python:3.7-alpine

LABEL description="Damn Vulnerable GraphQL Application"
LABEL github="https://github.com/dolevf/Damn-Vulnerable-GraphQL-Application"
LABEL maintainers="Dolev Farhi & Connor McKinnon"
LABEL maintainers="Dolev Farhi & Connor McKinnon & Nick Aleks"

ARG TARGET_FOLDER=/opt/dvga
WORKDIR $TARGET_FOLDER/

RUN apk add --update curl

COPY requirements.txt /opt/dvga/
RUN pip install -r requirements.txt
RUN adduser -D dvga
RUN chown dvga. $TARGET_FOLDER/
USER dvga

ADD core /opt/dvga/core
ADD db /opt/dvga/db
ADD static /opt/dvga/static
ADD templates /opt/dvga/templates
RUN python -m venv venv
RUN source venv/bin/activate
RUN pip3 install --upgrade pip --no-warn-script-location --disable-pip-version-check

COPY app.py /opt/dvga
COPY config.py /opt/dvga
COPY setup.py /opt/dvga/
COPY version.py /opt/dvga/
ADD --chown=dvga:dvga core /opt/dvga/core
ADD --chown=dvga:dvga db /opt/dvga/db
ADD --chown=dvga:dvga static /opt/dvga/static
ADD --chown=dvga:dvga templates /opt/dvga/templates

COPY --chown=dvga:dvga app.py /opt/dvga
COPY --chown=dvga:dvga config.py /opt/dvga
COPY --chown=dvga:dvga setup.py /opt/dvga/
COPY --chown=dvga:dvga version.py /opt/dvga/
COPY --chown=dvga:dvga requirements.txt /opt/dvga/

RUN pip3 install -r requirements.txt --user --no-warn-script-location
RUN python setup.py

EXPOSE 5013/tcp
CMD ["python3", "app.py"]
CMD ["python", "app.py"]
6 changes: 4 additions & 2 deletions tests/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_query_pastes():
r = graph_query(GRAPHQL_URL, query)

assert r.json()['data']['pastes'][0]['id']
assert r.json()['data']['pastes'][0]['ipAddr'] == '127.0.0.1'
assert r.json()['data']['pastes'][0]['ipAddr']
assert r.json()['data']['pastes'][0]['ownerId'] == 1
assert r.json()['data']['pastes'][0]['burn'] == False
assert r.json()['data']['pastes'][0]['owner']['id'] == '1'
Expand Down Expand Up @@ -83,7 +83,9 @@ def test_query_systemDebug():
'''
r = graph_query(GRAPHQL_URL, query)
assert r.status_code == 200
assert 'tty' in r.json()['data']['systemDebug'].lower()

systemdebug_indicators = ['TTY', 'COMMAND']
assert any(substring in r.json()['data']['systemDebug'] for substring in systemdebug_indicators)

def test_query_users():
query = '''
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '2.1.1'
VERSION = '2.1.2'

0 comments on commit 1f92c3f

Please sign in to comment.