Skip to content

Commit 6754ca0

Browse files
authored
Merge pull request #88 from dolevf/dvga-py3-10
3.10
2 parents 124b436 + 442f4fa commit 6754ca0

File tree

9 files changed

+96
-130
lines changed

9 files changed

+96
-130
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
- '3.7'
2525
- '3.8'
2626
- '3.9'
27+
- '3.10'
2728
exclude:
2829
- os: ubuntu-22.04
2930
pyver: 3.6

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
FROM python:3.7-alpine
1+
FROM python:3.10
22

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

77
ARG TARGET_FOLDER=/opt/dvga
88
WORKDIR $TARGET_FOLDER/
99

10-
RUN apk add --update curl
10+
RUN apt install curl git
1111

12-
RUN adduser -D dvga
12+
RUN useradd dvga -m
1313
RUN chown dvga. $TARGET_FOLDER/
1414
USER dvga
1515

1616
RUN python -m venv venv
17-
RUN source venv/bin/activate
18-
RUN pip3 install --upgrade pip --no-warn-script-location --disable-pip-version-check
17+
RUN . venv/bin/activate
18+
RUN pip3 install --user --upgrade pip --no-warn-script-location --disable-pip-version-check
1919

2020
ADD --chown=dvga:dvga core /opt/dvga/core
2121
ADD --chown=dvga:dvga db /opt/dvga/db

Dockerfile.arm64

Lines changed: 0 additions & 35 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ DVGA supports Beginner and Expert level game modes, which will change the exploi
7777

7878
The following Python3 libraries are required:
7979

80-
* Python3 (3.6 - 3.9) (3.10 is not supported)
80+
* Python3 (3.6 - 3.10)
8181
* Flask
8282
* Flask-SQLAlchemy
8383
* Flask-Sockets
@@ -101,10 +101,6 @@ See [requirements.txt](requirements.txt) for dependencies.
101101

102102
`docker build -t dvga .`
103103

104-
**Note:** If you are using an ARM-based Mac, use the dedicated Dockerfile.arm64 file:
105-
106-
`docker build -t dvga -f Dockerfile.arm64 .`
107-
108104
### Create a container from the image
109105

110106
`docker run -d -t -p 5013:5013 -e WEB_HOST=0.0.0.0 --name dvga dvga`

app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from flask import Flask
66
from flask_sqlalchemy import SQLAlchemy
7-
from flask_sockets import Sockets
87
from flask_graphql_auth import GraphQLAuth
98

109
app = Flask(__name__, static_folder="static/")
@@ -18,7 +17,6 @@
1817
app.config["JWT_REFRESH_TOKEN_EXPIRES"] = 30
1918

2019
auth = GraphQLAuth(app)
21-
sockets = Sockets(app)
2220

2321
app.app_protocol = lambda environ_path_info: 'graphql-ws'
2422

core/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Owner(db.Model):
8585
__tablename__ = 'owners'
8686
id = db.Column(db.Integer, primary_key=True)
8787
name = db.Column(db.String)
88-
paste = db.relationship('Paste', lazy='dynamic')
88+
paste = db.relationship('Paste', lazy='dynamic', overlaps="pastes")
8989

9090

9191
class Paste(db.Model):
@@ -99,7 +99,8 @@ class Paste(db.Model):
9999
owner_id = db.Column(db.Integer, db.ForeignKey(Owner.id))
100100
owner = db.relationship(
101101
Owner,
102-
backref='pastes'
102+
backref='pastes',
103+
overlaps="paste"
103104
)
104105
burn = db.Column(db.Boolean, default=False)
105106

requirements.txt

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,47 @@
11
aniso8601==7.0.0
2-
attrs==21.4.0
3-
certifi==2020.12.5
4-
chardet==4.0.0
5-
click==7.1.2
6-
Flask==1.1.2
7-
Flask-Cors==3.0.10
2+
attrs==22.1.0
3+
bidict==0.22.0
4+
certifi==2022.12.7
5+
charset-normalizer==2.1.1
6+
click==8.1.3
7+
exceptiongroup==1.0.4
8+
Flask==2.2.2
89
Flask-GraphQL==2.0.1
9-
Flask-GraphQL-Auth==1.3.2
10-
Flask-Sockets==0.2.1
11-
Flask-SQLAlchemy==2.4.4
12-
gevent==21.12.0
10+
Flask-GraphQL-Auth==1.3.3
11+
Flask-SocketIO==5.3.2
12+
Flask-SQLAlchemy==3.0.2
13+
gevent==22.10.2
1314
gevent-websocket==0.10.1
14-
graphene==2.1.8
15+
graphene==2.1.9
1516
graphene-sqlalchemy==2.3.0
1617
graphql-core==2.3.2
1718
graphql-relay==2.0.1
1819
graphql-server-core==1.2.0
1920
graphql-ws==0.4.4
20-
greenlet==1.1.2
21-
idna==2.10
21+
greenlet==2.0.1
22+
h11==0.14.0
23+
idna==3.4
2224
iniconfig==1.1.1
23-
itsdangerous==1.1.0
24-
Jinja2==2.11.2
25-
MarkupSafe==1.1.1
26-
packaging==21.3
25+
itsdangerous==2.1.2
26+
Jinja2==3.1.2
27+
MarkupSafe==2.1.1
28+
packaging==22.0
2729
pluggy==1.0.0
2830
promise==2.3
29-
py==1.11.0
30-
PyJWT==1.7.1
31-
pyparsing==3.0.9
32-
Pypubsub==4.0.3
33-
pytest==7.0.1
34-
pytest-flask==1.2.0
35-
requests==2.25.1
31+
PyJWT==2.0.1
32+
pytest==7.2.0
33+
python-engineio==4.3.4
34+
python-socketio==5.7.2
35+
requests==2.28.1
3636
Rx==1.6.1
37-
singledispatch==3.4.0.3
38-
six==1.15.0
39-
SQLAlchemy==1.3.22
40-
tomli==1.2.3
41-
urllib3==1.26.3
42-
Werkzeug==1.0.1
37+
simple-websocket==0.9.0
38+
singledispatch==3.7.0
39+
six==1.16.0
40+
SQLAlchemy==1.4.44
41+
tomli==2.0.1
42+
urllib3==1.26.13
43+
Werkzeug==2.2.2
44+
wsproto==1.2.0
4345
zope.event==4.5.0
44-
zope.interface==5.4.0
46+
zope.interface==5.5.2
47+
git+https://github.com/dolevf/flask-sockets@master

setup.py

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
from ipaddress import IPv4Network
88

9-
from app import db
9+
from app import db, app
10+
1011
from core.models import Paste, Owner, User, ServerMode
1112

1213
from db.agents import agents
@@ -56,61 +57,62 @@ def random_useragent():
5657

5758
def pump_db():
5859
print('Populating Database')
59-
db.create_all()
60-
61-
admin = User(username="admin", email="admin@blackhatgraphql.com", password=random_password())
62-
operator = User(username="operator", email="operator@blackhatgraphql.com", password="password123")
63-
# create tokens for admin & operator
64-
65-
db.session.add(admin)
66-
db.session.add(operator)
67-
68-
owner = Owner(name='DVGAUser')
69-
db.session.add(owner)
70-
71-
paste = Paste()
72-
paste.title = 'Testing Testing'
73-
paste.content = "My First Paste"
74-
paste.public = False
75-
paste.owner_id = owner.id
76-
paste.owner = owner
77-
paste.ip_addr = '127.0.0.1'
78-
paste.user_agent = 'User-Agent not set'
79-
db.session.add(paste)
80-
81-
paste = Paste()
82-
paste.title = '555-555-1337'
83-
paste.content = "My Phone Number"
84-
paste.public = False
85-
paste.owner_id = owner.id
86-
paste.owner = owner
87-
paste.ip_addr = '127.0.0.1'
88-
paste.user_agent = 'User-Agent not set'
89-
db.session.add(paste)
90-
91-
db.session.commit()
92-
93-
for _ in range(0, 10):
94-
owner = Owner(name=random_owner())
60+
with app.app_context():
61+
db.create_all()
62+
63+
admin = User(username="admin", email="admin@blackhatgraphql.com", password=random_password())
64+
operator = User(username="operator", email="operator@blackhatgraphql.com", password="password123")
65+
# create tokens for admin & operator
66+
67+
db.session.add(admin)
68+
db.session.add(operator)
69+
70+
owner = Owner(name='DVGAUser')
71+
db.session.add(owner)
72+
9573
paste = Paste()
96-
paste.title = random_title()
97-
paste.content = random_content()
98-
paste.public = True
74+
paste.title = 'Testing Testing'
75+
paste.content = "My First Paste"
76+
paste.public = False
9977
paste.owner_id = owner.id
10078
paste.owner = owner
101-
paste.ip_addr = random_address()
102-
paste.user_agent = random_useragent()
79+
paste.ip_addr = '127.0.0.1'
80+
paste.user_agent = 'User-Agent not set'
81+
db.session.add(paste)
10382

104-
db.session.add(owner)
83+
paste = Paste()
84+
paste.title = '555-555-1337'
85+
paste.content = "My Phone Number"
86+
paste.public = False
87+
paste.owner_id = owner.id
88+
paste.owner = owner
89+
paste.ip_addr = '127.0.0.1'
90+
paste.user_agent = 'User-Agent not set'
10591
db.session.add(paste)
10692

107-
mode = ServerMode()
108-
mode.hardened = False
109-
db.session.add(mode)
93+
db.session.commit()
94+
95+
for _ in range(0, 10):
96+
owner = Owner(name=random_owner())
97+
paste = Paste()
98+
paste.title = random_title()
99+
paste.content = random_content()
100+
paste.public = True
101+
paste.owner_id = owner.id
102+
paste.owner = owner
103+
paste.ip_addr = random_address()
104+
paste.user_agent = random_useragent()
105+
106+
db.session.add(owner)
107+
db.session.add(paste)
108+
109+
mode = ServerMode()
110+
mode.hardened = False
111+
db.session.add(mode)
110112

111-
db.session.commit()
113+
db.session.commit()
112114

113-
print('done')
115+
print('done')
114116

115117
if __name__ == '__main__':
116118
clean_up()

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '2.1.2'
1+
VERSION = '2.2.0'

0 commit comments

Comments
 (0)