Commit Graph

948 Commits

Author SHA1 Message Date
Kevin Chung
8b6e91f76c Scoreboard optimizations (#1476)
* Add speed improvements for /api/v1/scoreboard/top/<count>

* Update CHANGELOG

* Fix typo

* Switch back to processing solves and awards seperately

* Fix typo
2.5.0
2020-06-04 16:54:45 -04:00
Kevin Chung
56d7b6d6d0 Scoreboard optimizations (#1475)
* The top scoreboard endpoint `/api/v1/scoreboard/top/<count>` is now more performant (3x) due to better response generation

In local testing I went from 3.5s to 1.2s.
2020-06-04 14:46:36 -04:00
Kevin Chung
409473acc0 Python 2 has been removed from Alpine so install Python 3 deps in Alpine (#1473)
* Closes #1472 

```
docker build --no-cache -t ctfd .
docker run -p 8000:8000 -it ctfd
```
works for me
2020-06-04 10:17:57 -04:00
Kevin Chung
98bf240cc1 Improve response times of /api/v1/scoreboard significantly (#1470)
* Improve response times of `/api/v1/scoreboard` significantly by avoiding hitting the database to get every team member's score
* Fix issue where a hidden/banned user's score could be revealed as a member of a team

From tests I was able to cut this down from 11s to 0.5s. This endpoint also will still be heavily cached which should improve performance for a lot of users.
2020-06-04 02:37:10 -04:00
Kevin Chung
7cf6d2b43a 2.5.0 dev (#1453)
2.5.0 / 2020-06-02
==================

**General**
* Use a session invalidation strategy inspired by Django. Newly generated user sessions will now include a HMAC of the user's password. When the user's password is changed by someone other than the user the previous HMACs will no longer be valid and the user will be logged out when they next attempt to perform an action.
* A user and team's place, and score are now cached and invalidated on score changes.

**API**
* Add `/api/v1/challenges?view=admin` to allow admin users to see all challenges regardless of their visibility state
* Add `/api/v1/users?view=admin` to allow admin users to see all users regardless of their hidden/banned state
* Add `/api/v1/teams?view=admin` to allow admin users to see all teams regardless of their hidden/banned state
* The scoreboard endpoints `/api/v1/scoreboard` & `/api/v1/scoreboard/top/[count]` should now be more performant because score and place for Users/Teams are now cached

**Deployment**
* `docker-compose` now provides a basic nginx configuration and deploys nginx on port 80

**Miscellaneous**
* The `get_config` and `get_page` config utilities now use SQLAlchemy Core instead of SQLAlchemy ORM for slight speedups
* Update Flask-Migrate to 2.5.3 and regenerate the migration environment. Fixes using `%` signs in database passwords.
2020-06-02 11:22:01 -04:00
fjh1997
1a85658678 Update docker-compose.yml (#1443)
* Pin MariaDB to 10.4.12 in `docker-compose.yml`
2020-05-25 11:37:01 -04:00
Kevin Chung
d9a0d78b75 Mark 2.4.3 (#1440)
2.4.3 / 2020-05-24
==================

**Miscellaneous**
* Notifications/Events endpoint will now immediately send a ping instead of waiting a few seconds.
* Upgrade `gunicorn` dependency to `19.10.0`
* Upgrade `boto3` dependency to `1.13.9`
* Improve `import_ctf()` reliability by closing all connections before dropping & recreating database
* Close database session in IP tracking code in failure situations to avoid potential dangling database connections
* Don't allow backups to be imported if they do not have a `db` folder
* Change `import_ctf()` process slightly to import built-in tables first and then plugin tables
* Handle exception where a regex Flag is invalid

**API**
* File deletion endpoint (`DELETE /api/v1/files/[file_id]`) will now correctly delete the associated file

**Plugins**
* Add `CTFd.plugins.get_plugin_names()` to get a list of available plugins
* Add `CTFd.plugins.migrations.current()` to get the current revision of a plugin migration
* Improve `CTFd.plugins.migrations.upgrade()` to be able to upgrade to a specific plugin migration
* Run plugin migrations during import process

**Themes**
* Update jQuery to v3.5.1 to fix mobile hamburger menu
* Upgrade some dependencies in yarn lockfile
* Fix invalid team link being generated in `scoreboard.js`

**Admin Panel**
* Fix sending of user creation notification email
* Fix button to remove users from teams
2.4.3
2020-05-24 20:59:17 -04:00
Nomuken
a9bcaeffc7 fixed incorrect generating team link (#1439) 2020-05-24 16:18:13 -04:00
Kevin Chung
e643834a0c Fix button to remove users from teams in Admin Panel (#1437)
* Fix admin panel button to remove users from teams. 
* Add the data-href attribute to td as well as tr. 
* Closes #1435
2020-05-24 02:06:02 -04:00
Kevin Chung
80df88f25d Revert "Use a ThreadPoolExecutor to concurrently store files dut string import (#1427)" (#1428)
This reverts commit 2245df85f4.
2020-05-21 02:15:16 -04:00
Kevin Chung
2245df85f4 Use a ThreadPoolExecutor to concurrently store files during import (#1427)
* Use a `ThreadPoolExecutor` to concurrently store files during import
2020-05-20 22:03:35 -04:00
Kevin Chung
d3f8441993 Catch situation where Regex flag fails (#1426)
* Catch an exception where a user supplied regex Flag can fail to parse
* Starts on #1425
2020-05-20 19:24:58 -04:00
Kevin Chung
ba887e8952 1422 block imports without db folder (#1424)
* Don't allow backups to be imported if they do not have a `db` folder
* Closes #1422
2020-05-20 15:52:09 -04:00
Kevin Chung
5618f0d04c 1406 plugin migrations improvements (#1420)
* Handle plugin migrations during CTF import
* Closes #1406
2020-05-19 21:21:31 -04:00
Kevin Chung
148bdccf26 Improve import_ctf reliability (#1419)
* Improve `import_ctf()` reliability by closing all connections before dropping & recreating database
* Close database session in IP tracking code in failure situations
2020-05-18 11:46:15 -04:00
Kevin Chung
ac24b83a86 Update deps in yarn.lock to appease Github security alerts (#1417)
* Update deps in yarn.lock to appease Github security alerts
2020-05-18 03:02:21 -04:00
Kevin Chung
b3987f7ead Bump boto3 version to 1.13.9 and install pipdeptree for development (#1415)
* Bump boto3 version to 1.13.9
2020-05-14 15:01:02 -04:00
socketz
a8a7a983e3 fix: requirements.txt to reduce vulnerabilities (#1412)
* Upgrade gunicorn to version 19.10.0
2020-05-14 13:29:38 -04:00
Kevin Chung
03051e8d99 Fix user creation email notification (#1408)
* Fixes user creation email notification
* Closes #1398
2020-05-14 12:20:59 -04:00
Kevin Chung
7a3028857c Update jquery and rebuild assets (#1409)
* Update jQuery to v3.5.1 to fix mobile menu bar
* Closes #1401
2020-05-14 10:46:00 -04:00
Ernesto Serrano
912016f6f8 Fix file deletion. Related to #1393 (#1396)
* Delete files when the database reference is also deleted Related to #1393
2020-05-13 21:35:46 -04:00
Kevin Chung
2769dc6367 Have EventManagers yield before timer code to force SSE response head… (#1400)
* EventManagers should send an initial ping event to force `text/event-steam` header to be set
2020-05-13 19:33:01 -04:00
Kevin Chung
1a57a33fe7 Merge pull request #1391 from CTFd/mark-2.4.2
2.4.2 / 2020-05-08
==================

**Admin Panel**
* Fix Challenge Reset in Admin Panel where Dynamic Challenges prevented resetting Challenges

**Plugins**
* Add the `CTFd.plugins.migrations` module to allow plugins to handle migrations. Plugins should now call `CTFd.plugins.migrations.upgrade` instead of `app.db.create_all` which will allow the plugin to have database migrations.
* Make Dynamic Challenges have a cascading deletion constraint against their respective Challenge row

**Miscellaneous**
* Add `app.plugins_dir` object to refer to the directory where plugins are installed
2.4.2
2020-05-08 17:44:12 -04:00
Kevin Chung
b9fa46e411 Set right CHANGELOG date 2020-05-08 16:30:42 -04:00
Kevin Chung
ee28d33027 Add note about upgrade vs db.create_all 2020-05-08 16:30:18 -04:00
Kevin Chung
a987160cfb Mark v2.4.2 2020-05-08 16:27:14 -04:00
Kevin Chung
0ea25476dc Merge pull request #1388 from CTFd/1386-proper-deletion-constraint-for-dynamics
* Add cascading delete constraint to `DynamicChallenge` to help with Reset functionality
* Add a system for running migrations from within plugins
* Closes #1386
2020-05-08 16:19:27 -04:00
Kevin Chung
6f0c0b1a52 Add test for dynamic challenge reset 2020-05-07 12:27:04 -04:00
Kevin Chung
52d0c2719a Update migration 2020-05-07 11:23:48 -04:00
Kevin Chung
c04235a5d1 Fix some code and lints 2020-05-07 10:53:45 -04:00
Kevin Chung
b5fe079922 Create a migrations system for plugins 2020-05-06 22:23:22 -04:00
Kevin Chung
930da02231 Run formatter 2020-05-06 16:43:56 -04:00
Kevin Chung
364273f1f1 Add cascading delete constraint to DynamicChallenge 2020-05-06 12:46:51 -04:00
Kevin Chung
818a4568a3 Merge pull request #1385 from CTFd/mark-2.4.1
2.4.1 / 2020-05-06
==================

**Admin Panel**
* Fix issue where admins couldn't update the "Account Creation" email
* Fix issue where the Submissions page in the Admin Panel could not be paginated correctly

**Miscellaneous**
* Add `SQLALCHEMY_ENGINE_OPTIONS` to `config.py` with a slightly higher default `max_overflow` setting for `SQLALCHEMY_MAX_OVERFLOW`. This can be overridden with the `SQLALCHEMY_MAX_OVERFLOW` envvar
* Add `node_modules/` to `.dockerignore`
2.4.1
2020-05-06 01:00:23 -04:00
Kevin Chung
1d28016424 Mark v2.4.1 2020-05-05 23:33:06 -04:00
Kevin Chung
2cfc89d4c2 Merge pull request #1384 from ilanarbi/admin-theme-successful-email-fix
* Fix issue where admins couldn't update the Account Confirmation email
2020-05-05 23:26:44 -04:00
ilanarbi
77afae2a4a Merge branch 'master' into admin-theme-successful-email-fix 2020-05-06 05:22:35 +03:00
Kevin Chung
6a785f1095 Merge pull request #1383 from CTFd/fix-invalid-session-situation
* Fix an issue where session id no longer exists but the server thinks the user is still authed
2020-05-05 22:18:31 -04:00
Ilan
2c563a7b84 admin theme successful confirmation email fix 2020-05-06 04:46:48 +03:00
Kevin Chung
ecec8592dc Merge branch 'master' into fix-invalid-session-situation 2020-05-05 21:20:03 -04:00
Kevin Chung
05da93b4f6 Merge pull request #1380 from CTFd/add-sqlalchemy-engine-options
* Add `SQLALCHEMY_ENGINE_OPTIONS` to `config.py` to specify a slightly higher default `max_overflow`
2020-05-05 21:19:46 -04:00
Kevin Chung
97a221aa24 Fix an issue where session id no longer exists 2020-05-05 19:41:45 -04:00
Kevin Chung
2f6ee65f33 Only add SQLALCHEMY_ENGINE_OPTIONS under production databases 2020-05-05 19:39:36 -04:00
Kevin Chung
4b54789c14 Merge branch 'master' into add-sqlalchemy-engine-options 2020-05-05 19:28:02 -04:00
Kevin Chung
287cb2f263 Merge pull request #1382 from CTFd/node-modules-docker-ignore
* Add `node_modules/` to `.dockerignore`
2020-05-05 19:14:43 -04:00
Kevin Chung
9e158749f0 Merge branch 'master' into node-modules-docker-ignore 2020-05-05 18:31:07 -04:00
Kevin Chung
55d96b1c1d Merge pull request #1381 from CTFd/fix-submission-type-pagination
* Fix `url_for` call for Admin Panel submission pagination
2020-05-05 17:44:25 -04:00
Kevin Chung
f1008a812e Add node_modules/ to .dockerignore 2020-05-05 16:46:16 -04:00
Kevin Chung
565b218ebc Run format 2020-05-05 16:45:22 -04:00
Kevin Chung
197cfc3cf2 Run formatter 2020-05-05 16:44:31 -04:00