Skip to content

Commit adc70fb

Browse files
authored
3.0.0a1 (CTFd#1523)
Alpha release of CTFd v3. # 3.0.0a1 / 2020-07-01 **General** - CTFd is now Python 3 only - Render markdown with the CommonMark spec provided by `cmarkgfm` - Render markdown stripped of any malicious JavaScript or HTML. - This is a significant change from previous versions of CTFd where any HTML content from an admin was considered safe. - Inject `Config`, `User`, `Team`, `Session`, and `Plugin` globals into Jinja - User sessions no longer store any user-specific attributes. - Sessions only store the user's ID, CSRF nonce, and an hmac of the user's password - This allows for session invalidation on password changes - The user facing side of CTFd now has user and team searching - GeoIP support now available for converting IP addresses to guessed countries **Admin Panel** - Use EasyMDE as an improved description/text editor for Markdown enabled fields. - Media Library button now integrated into EasyMDE enabled fields - VueJS now used as the underlying implementation for the Media Library - Fix setting theme color in Admin Panel - Green outline border has been removed from the Admin Panel **API** - Significant overhauls in API documentation provided by Swagger UI and Swagger json - Make almost all API endpoints provide filtering and searching capabilities - Change `GET /api/v1/config/<config_key>` to return structured data according to ConfigSchema **Themes** - Themes now have access to the `Configs` global which provides wrapped access to `get_config`. - For example, `{{ Configs.ctf_name }}` instead of `get_ctf_name()` or `get_config('ctf_name')` - Themes must now specify a `challenge.html` which control how a challenge should look. - The main library for charts has been changed from Plotly to Apache ECharts. - Forms have been moved into wtforms for easier form rendering inside of Jinja. - From Jinja you can access forms via the Forms global i.e. `{{ Forms }}` - This allows theme developers to more easily re-use a form without having to copy-paste HTML. - Themes can now provide a theme settings JSON blob which can be injected into the theme with `{{ Configs.theme_settings }}` - Core theme now includes the challenge ID in location hash identifiers to always refer the right challenge despite duplicate names **Plugins** - Challenge plugins have changed in structure to better allow integration with themes and prevent obtrusive Javascript/XSS. - Challenge rendering now uses `challenge.html` from the provided theme. - Accessing the challenge view content is now provided by `/api/v1/challenges/<challenge_id>` in the `view` section. This allows for HTML to be properly sanitized and rendered by the server allowing CTFd to remove client side Jinja rendering. - `challenge.html` now specifies what's required and what's rendered by the theme. This allows the challenge plugin to avoid having to deal with aspects of the challenge besides the description and input. - A more complete migration guide will be provided when CTFd v3 leaves beta - Display current attempt count in challenge view when max attempts is enabled - `get_standings()`, `get_team_stanadings()`, `get_user_standings()` now has a fields keyword argument that allows for specificying additional fields that SQLAlchemy should return when building the response set. - Useful for gathering additional data when building scoreboard pages - Flags can now control the message that is shown to the user by raising `FlagException` - Fix `override_template()` functionality **Deployment** - Enable SQLAlchemy's `pool_pre_ping` by default to reduce the likelihood of database connection issues - Mailgun email settings are now deprecated. Admins should move to SMTP email settings instead. - Postgres is now considered a second class citizen in CTFd. It is tested against but not a main database backend. If you use Postgres, you are entirely on your own with regards to supporting CTFd. - Docker image now uses Debian instead of Alpine. See CTFd#1215 for rationale. - `docker-compose.yml` now uses a non-root user to connect to MySQL/MariaDB - `config.py` should no longer be editting for configuration, instead edit `config.ini` or the environment variables in `docker-compose.yml`
1 parent 9ca6270 commit adc70fb

File tree

298 files changed

+8653
-4971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+8653
-4971
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ module.exports = {
1313
"sourceType": "module"
1414
},
1515
"rules": {
16+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
1617
}
1718
};

.github/ISSUE_TEMPLATE.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ If this is a feature request please describe the behavior that you'd like to see
66

77
**Environment**:
88

9-
- CTFd Version/Commit:
10-
- Operating System:
11-
- Web Browser and Version:
9+
- CTFd Version/Commit:
10+
- Operating System:
11+
- Web Browser and Version:
1212

1313
**What happened?**
1414

@@ -17,4 +17,3 @@ If this is a feature request please describe the behavior that you'd like to see
1717
**How to reproduce your issue**
1818

1919
**Any associated stack traces or error logs**
20-

.github/workflows/lint.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Linting
3+
4+
on: [push]
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
python-version: ['3.6']
14+
TESTING_DATABASE_URL: ['sqlite://']
15+
16+
name: Linting
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Setup python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
architecture: x64
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install -r development.txt
28+
sudo yarn install --non-interactive
29+
sudo yarn global add [email protected]
30+
31+
- name: Lint
32+
run: make lint
33+
34+
- name: Lint Dockerfile
35+
uses: brpaz/hadolint-action@master
36+
with:
37+
dockerfile: "Dockerfile"
38+
39+
- name: Lint docker-compose
40+
run: |
41+
python -m pip install docker-compose==1.26.0
42+
docker-compose -f docker-compose.yml config
43+

.github/workflows/mysql.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: CTFd MySQL CI
3+
4+
on: [pull_request]
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ubuntu-latest
10+
services:
11+
mysql:
12+
image: mysql
13+
ports:
14+
- 3306:3306
15+
redis:
16+
image: redis
17+
ports:
18+
- 6379:6379
19+
20+
strategy:
21+
matrix:
22+
python-version: ['3.6']
23+
TESTING_DATABASE_URL: ['mysql+pymysql://root@localhost/ctfd']
24+
25+
name: Python ${{ matrix.python-version }}
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Setup python
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
architecture: x64
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
python -m pip install -r development.txt
37+
sudo yarn install --non-interactive
38+
39+
- name: Test
40+
run: |
41+
sudo rm -f /etc/boto.cfg
42+
make test
43+
env:
44+
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
45+
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
46+
47+
- name: Coverage
48+
run: codecov
49+

.github/workflows/postgres.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: CTFd Postgres CI
3+
4+
on: [pull_request]
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ubuntu-latest
10+
services:
11+
postgres:
12+
image: postgres
13+
ports:
14+
- 5432:5432
15+
env:
16+
POSTGRES_HOST_AUTH_METHOD: trust
17+
POSTGRES_DB: ctfd
18+
# Set health checks to wait until postgres has started
19+
options: >-
20+
--health-cmd pg_isready
21+
--health-interval 10s
22+
--health-timeout 5s
23+
--health-retries 5
24+
redis:
25+
image: redis
26+
ports:
27+
- 6379:6379
28+
29+
strategy:
30+
matrix:
31+
python-version: ['3.6']
32+
TESTING_DATABASE_URL: ['postgres://postgres@localhost/ctfd']
33+
34+
name: Python ${{ matrix.python-version }}
35+
steps:
36+
- uses: actions/checkout@v2
37+
- name: Setup python
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
architecture: x64
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
python -m pip install -r development.txt
46+
sudo yarn install --non-interactive
47+
48+
- name: Test
49+
run: |
50+
sudo rm -f /etc/boto.cfg
51+
make test
52+
env:
53+
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
54+
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
55+
56+
- name: Coverage
57+
run: codecov
58+

.github/workflows/sqlite.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: CTFd SQLite CI
3+
4+
on: [pull_request]
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
python-version: ['3.6']
14+
TESTING_DATABASE_URL: ['sqlite://']
15+
16+
name: Python ${{ matrix.python-version }}
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Setup python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
architecture: x64
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install -r development.txt
28+
sudo yarn install --non-interactive
29+
sudo yarn global add [email protected]
30+
31+
- name: Test
32+
run: |
33+
sudo rm -f /etc/boto.cfg
34+
make test
35+
env:
36+
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
37+
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
38+
39+
- name: Coverage
40+
run: codecov
41+

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pip-delete-this-directory.txt
3636
htmlcov/
3737
.tox/
3838
.coverage
39+
.coverage.*
3940
.cache
4041
nosetests.xml
4142
coverage.xml
@@ -57,6 +58,7 @@ target/
5758

5859
*.db
5960
*.log
61+
*.log.*
6062
.idea/
6163
.vscode/
6264
CTFd/static/uploads

.isort.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[settings]
2+
multi_line_output=3
3+
include_trailing_comma=True
4+
force_grid_wrap=0
5+
use_parentheses=True
6+
line_length=88
7+
skip=migrations

.travis.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
language: python
2-
dist: xenial
2+
dist: bionic
33
cache:
44
- pip
55
- yarn
66
services:
77
- mysql
8-
- postgresql
98
- redis-server
109
addons:
1110
apt:
@@ -17,21 +16,16 @@ addons:
1716
env:
1817
- TESTING_DATABASE_URL='mysql+pymysql://root@localhost/ctfd'
1918
- TESTING_DATABASE_URL='sqlite://'
20-
- TESTING_DATABASE_URL='postgres://postgres@localhost/ctfd'
2119
python:
22-
- 2.7
2320
- 3.6
2421
before_install:
2522
- sudo rm -f /etc/boto.cfg
2623
- export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
2724
- export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
28-
- python3.6 -m pip install black==19.3b0
2925
install:
3026
- pip install -r development.txt
3127
- yarn install --non-interactive
3228
- yarn global add [email protected]
33-
before_script:
34-
- psql -c 'create database ctfd;' -U postgres
3529
script:
3630
- make lint
3731
- make test

0 commit comments

Comments
 (0)