1264 Commits

Author SHA1 Message Date
Kevin Chung
4793d95338 Emit more theme init data using tojson (#2182)
* Emit more theme init data using tojson
* Add `teamId` and `teamName` into admin `base.html`
2022-09-07 14:40:42 -04:00
Kevin Chung
328b523b24 Fix issue with dynamic_challenges migration loading (#2179) 2022-08-31 11:52:20 -04:00
Kevin Chung
ae29dca881 Add mechanism for plugin migrations to get current tables and columns (#2175)
* Add mechanism for plugin migrations to get current tables and columns
2022-08-26 04:09:43 -04:00
Miłosz Skaza
aeee3db3be fix: checkboxes in theme config window (#2172)
* fix: checkboxes in theme config window
2022-08-24 17:00:53 -04:00
Kevin Chung
22ae3a8eb7 Don't error out if SAFE_MODE config doesn't exist (#2173) 2022-08-24 12:13:57 -04:00
Kevin Chung
541b3f5570 Specifically load a plugin's alembic_version from the database (#2170)
* Specifically load a plugin's alembic_version from the database
2022-08-23 16:05:51 -04:00
Kevin Chung
09f58705a3 Load SAFE_MODE config from envvar (#2169)
* Properly load `SAFE_MODE` config from environment variable
* Closes #2168
2022-08-23 15:24:52 -04:00
Kevin Chung
e0290cc67b Notifications improvements (#2166)
* Improve event `ping`s to actually include data so that they show up in devtools
* Improve Event publishers to take an `id` parameter that is sent to the browser
* Add a `since_id` parameter to `GET /api/v1/notifications` to get Notifications that have happened since a specific ID
* Add `HEAD /api/v1/notifications` to get a count of notifications that have happened. This also includes a `since_id` parameter to allow for a notification cursor.
2022-08-15 17:35:01 -04:00
Niklas Mollenhauer
d1e9ab45bb Use binaries in PATH in npm run scripts (#2163)
When running software installed via NPM, `node_modules/.bin` is in PATH, so we can just omit mos tof the path.

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-08-15 15:37:37 -04:00
Kevin Chung
2a8aa48a32 Remove the Assets.manifest_css method as manifest-css.json is no longer necessary (#2164)
* Remove the Assets.manifest_css method as manifest-css.json is no longer necessary
* Related to https://github.com/CTFd/core-beta/pull/22
2022-08-10 15:30:52 -04:00
Dustin Loring
11a18daf98 Made get_configurable_plugins work nicely with config.jsons that include multiple plugin entries as a list (#2161)
* Adds support for config.json to have multiple paths to add to the Plugins dropdown in the Admin Panel
* Closes #1370
2022-08-08 14:28:48 -04:00
Kevin Chung
471bd48f1c Add autocomplete='off' to admin pages to fix Firefox caching checkboxes (#2158)
* Add autocomplete='off' to admin pages to fix Firefox caching checkboxes
2022-07-31 22:18:58 -04:00
Anders Soh
4c0f98f078 validate value type is string before using strip (#2155)
* Fix issue where required custom fields could not be submitted for existing users

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-07-31 16:20:14 -04:00
Kevin Chung
8873417e0d Fix bandit lint (#2152) 2022-07-04 16:07:11 -04:00
Kevin Chung
3c3a33b893 Fix miscellaneous issues for importer (#2151)
* Fix issue where `field_entries` could not be imported under MariaDB
* Fix issue where `config` entries sometimes would be recreated for some reason causing an import to fail
2022-06-29 18:41:16 -04:00
Aides2593
3b39a9e679 Hidden admin team by default (#2150)
* When admins create teams in the normal creation flow, the team will be hidden by default
* Closes #2144
2022-06-29 14:03:05 -04:00
Joel Butler
a2c81cb03a Disable Imports on SQLite database provider (#2139)
* Disable Imports on SQLite database provider
* Closes #2131
2022-06-20 04:07:20 -04:00
Kevin Chung
c2ae1f0a8f Catch all exceptions in import process to report to user (#2143)
* Catch all exceptions in import process to report to admin
2022-06-19 22:01:04 -04:00
Frank
d966f15dec make require_team abort 404 when not in team mode (#2120)
* Closes #2119
2022-06-19 20:30:18 -04:00
Joel Butler
a1d9c12a91 Added info for challenges page Admins Only mode (#2138)
* Added info stating "Challenges are set to Admins Only mode" for admins in relevant case so they don't forget as per issue #2137
* Closes #2137

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-06-19 19:33:29 -04:00
Kevin Chung
f1cc09767f Add healthcheck endpoint and timed_lru_cache function (#2135)
* Add healthcheck endpoint and timed_lru_cache function
2022-06-16 14:39:47 -04:00
Kevin Chung
0ab5dd4dfc Add CSV export for teams+members+fields which is teams with fields and their team members with fields (#2147)
* Add CSV export for `teams+members+fields` which is teams with fields and their team members with fields
* Closes #2145
2022-06-16 13:53:01 -04:00
Joel Butler
3e71a2daa5 Add info to user scoreboard csv (#2136)
* Add info to user scoreboard csv

Added user id and user email fields to the user mode scoreboard csv export as per issue #2133.

* Run formatter

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-06-05 03:46:18 -04:00
Kevin Chung
e1e68b8e99 Bump dependencies for passlib, bcrypt, requests, gunicorn, gevent, python-geoacumen-city (#2134)
* Bump dependencies for passlib, bcrypt, requests, gunicorn, gevent, python-geoacumen-city
* Closes #2132
2022-06-02 15:27:12 -04:00
ゆめきち
2c32791c24 delete space (#2124)
Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-05-25 00:48:40 -04:00
Kevin Chung
6eb284e4e1 Update ping.py to only print the hostname of the target database (#2125)
* Update ping.py to only print the hostname of the target database
2022-05-22 10:50:01 -04:00
Kevin Chung
6d74c1c426 Set 3.5.0 release date (#2116)
# 3.5.0 / 2022-05-09

**General**

- Add a next challenge recommendation to challenges
- Add support for only viewing hints after unlocking another hint
- Add size checking and recommendation for images uploaded during setup

**Admin Panel**

- Imports now happen in the background so that admins can watch the status of the import
  - Add progress tracking to backup/export importing
  - Add `GET /admin/import` to see status of import
  - The public user facing portion of CTFd is now disabled during imports
- Fix issue where custom field entries for Users and Teams would be misaligned in the scoreboard CSV export
- Show admins the email server error message when email sending fails
- Fix issue where the current theme cannot be found in list of themes
- Fix page preview so that it accounts for the provided format
- Add links from User/Team Profile IP addresses to a User IP address search page
- Add city geolocation to Team Profile IP addresses

**API**

- Add the `count` meta field to the following endpoints:
  - `/api/v1/users/me/solves`
  - `/api/v1/users/me/fails`
  - `/api/v1/users/me/awards`
  - `/api/v1/teams/me/awards`
  - `/api/v1/users/[user_id]/solves`
  - `/api/v1/users/[user_id]/fails`
  - `/api/v1/users/[user_id]/awards`
  - `/api/v1/teams/[team_id]/solves`
  - `/api/v1/teams/[team_id]/awards`
- Improve speed of `/api/v1/teams/me/fails`
- Improve speed of `/api/v1/teams/[team_id]/fails`
- Improve speed of `/api/v1/users/me/fails`
- Improve speed of `/api/v1/users/[user_id]/fails`

**Deployment**

- Use Python 3.9 as the default Python version
- Prevent any possible usage of an already existing session ID by checking for duplicates during during session ID generation
- No longer install `python3-dev` in Dockerfile
- docker-compose.yml now uses `nginx:stable` as the image for nginx

**Plugins**

- `CTFd._internal.challenge.render` and `CTFd._internal.challenge.renderer` in the `view.js` Challenge type file has been deprecated. Instead Challenge plugins should refer to the `challenge.html` attribute provided by the API. Essentially CTFd is moving to having markdown & HTML rendered by the server instead of rendering on the client.

**Themes**

- Create the [`core-beta` theme](https://github.com/CTFd/core-beta) and begin documenting the creation of themes using Vite
- Add `userName` and `userEmail` to the CTFd init object in `base.html` for easier integration with other JavaScript code
- Add `teamId` and `teamName` to the CTFd init object in `base.html` for easier integration with other JavaScript code
- Adds the `Assets` constant to access front end assets from Jinja templates
- Adds a `views.themes_beta` route to avoid the `.dev`/`.min` extension being added automatically to frontend asset urls

**Miscellaneous**

- Fix double logging in `log()` function
- Add `--delete_import_on_finish` to `python manage.py import_ctf`
- Fix issue where `field_entries` table could not be imported when moving between MySQL and MariaDB
2022-05-09 00:42:05 -04:00
Cryptanalyse
f5e703c2fc [Admin] Add a link on the IP modal to search for a given IP address accross all users. (#2113)
- Add links from User/Team Profile IP addresses to a User IP address search page
- Add city geolocation to Team Profile IP addresses

Co-authored-by: J <>
Co-authored-by: Kevin Chung <kchung@nyu.edu>
Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-05-08 02:56:57 -04:00
Kevin Chung
1bdd30606f Improve reliability of test_previewing_page_with_format_works test (#2110) 2022-05-03 19:22:06 -04:00
Kevin Chung
7007cd2db1 Mark 3.5.0 (#2109)
# 3.5.0 / UNRELEASED

**General**

- Add a next challenge recommendation to challenges
- Add support for only viewing hints after unlocking another hint
- Add size checking and recommendation for images uploaded during setup

**Admin Panel**

- Imports now happen in the background so that admins can watch the status of the import
  - Add progress tracking to backup/export importing
  - Add `GET /admin/import` to see status of import
  - The public user facing portion of CTFd is now disabled during imports
- Fix issue where custom field entries for Users and Teams would be misaligned in the scoreboard CSV export
- Show admins the email server error message when email sending fails
- Fix issue where the current theme cannot be found in list of themes
- Fix page preview so that it accounts for the provided format

**API**

- Add the `count` meta field to the following endpoints:
  - `/api/v1/users/me/solves`
  - `/api/v1/users/me/fails`
  - `/api/v1/users/me/awards`
  - `/api/v1/teams/me/awards`
  - `/api/v1/users/[user_id]/solves`
  - `/api/v1/users/[user_id]/fails`
  - `/api/v1/users/[user_id]/awards`
  - `/api/v1/teams/[team_id]/solves`
  - `/api/v1/teams/[team_id]/awards`
- Improve speed of `/api/v1/teams/me/fails`
- Improve speed of `/api/v1/teams/[team_id]/fails`
- Improve speed of `/api/v1/users/me/fails`
- Improve speed of `/api/v1/users/[user_id]/fails`

**Deployment**

- Use Python 3.9 as the default Python version
- Prevent any possible usage of an already existing session ID by checking for duplicates during during session ID generation
- No longer install `python3-dev` in Dockerfile
- docker-compose.yml now uses `nginx:stable` as the image for nginx

**Plugins**

- `CTFd._internal.challenge.render` and `CTFd._internal.challenge.renderer` in the `view.js` Challenge type file has been deprecated. Instead Challenge plugins should refer to the `challenge.html` attribute provided by the API. Essentially CTFd is moving to having markdown & HTML rendered by the server instead of rendering on the client.

**Themes**

- Create the [`core-beta` theme](https://github.com/CTFd/core-beta) and begin documenting the creation of themes using Vite
- Add `userName` and `userEmail` to the CTFd init object in `base.html` for easier integration with other JavaScript code
- Add `teamId` and `teamName` to the CTFd init object in `base.html` for easier integration with other JavaScript code
- Adds the `Assets` constant to access front end assets from Jinja templates
- Adds a `views.themes_beta` route to avoid the `.dev`/`.min` extension being added automatically to frontend asset urls

**Miscellaneous**

- Fix double logging in `log()` function
- Add `--delete_import_on_finish` to `python manage.py import_ctf`
- Fix issue where `field_entries` table could not be imported when moving between MySQL and MariaDB
2022-05-03 17:13:42 -04:00
Kevin Chung
d2b2d7d880 Add teamId and teamName to base.html (#2106)
- Add `teamId` and `teamName` to the CTFd init object in `base.html` for easier integration with other JavaScript code
2022-05-03 05:00:28 -04:00
Kevin Chung
4369272c49 Fix issue where hint with a free requirement could not be unlocked (#2107)
* Fix issue where hint with a free requirement could not be unlocked

* Fix issue with referring to the right hint id
2022-05-03 04:37:03 -04:00
Kevin Chung
f3e43d97a6 Null out some functions in view.js (#2105)
* Remove some unused functions from the default provided standard & dynamic challenge `view.js` files
2022-04-30 22:05:16 -04:00
Miłosz Skaza
073d4b7cf9 backport core theme for comp with core-beta in plugins (#2103) (#2104)
Closes: #2103
2022-04-29 00:17:12 -04:00
Kevin Chung
b9b7de77bd Fix lints in Dockerfile (#2097)
* Fix lints in Dockerfile
2022-04-20 15:55:13 -04:00
Kevin Chung
2702d83975 Bump Python to 3.9 (#2096)
* Bump Python to 3.9
* Closes #2080
2022-04-20 15:32:26 -04:00
Kevin Chung
f01e2d9a40 Fix some ideas from import testing (#2093)
* Add some local changes that didn't make it into the previous PR
* Works on #2087
2022-04-20 05:13:48 -04:00
Kevin Chung
fce5ee418b Add meta and count field to teams awards endpoints (#2095)
* Add meta and count field to `/api/v1/teams/[team_id]/awards` and `/api/v1/teams/me/awards`
2022-04-20 04:21:25 -04:00
Kevin Chung
a626d4b4bf Add changelog for 3.5.0 (#2094)
* Add draft CHANGELOG for 3.5.0
2022-04-19 16:42:44 -04:00
Kevin Chung
9ac0bbba6c Fix issues with backup importing (#2092)
* Closes #2087 
* Use `python manage.py import_ctf` instead of a new Process to import backups from the Admin Panel. 
    * This avoids a number of issues with gevent and webserver forking/threading models. 
* Add `--delete_import_on_finish` to `python manage.py import_ctf`
* Fix issue where `field_entries` table could not be imported when moving between MySQL and MariaDB
2022-04-17 18:28:30 -04:00
Kevin Chung
90e81d7298 Fix page preview so that it accounts for the provided format (#2091)
* Fix page preview so that it accounts for the provided format
* Closes #2089
2022-04-15 15:17:33 -04:00
Kevin Chung
4efccfc39f Disable caching of get_asset_json if debug mode (#2090)
* Disable caching of get_asset_json if debug mode
2022-04-13 18:44:57 -04:00
Isaac
ab4dd902c4 Docker-compose now always uses stable nginx (#2088)
Fixes #2086
2022-04-12 17:50:58 -04:00
Kevin Chung
afc55bff75 Add next recommended challenge after solve (#2081)
* Add a next challenge recommendation to challenges
* Closes #1668
2022-04-08 23:02:56 -04:00
Kevin Chung
c95591aa16 Speed improvements (#2084)
* Improve speed of `/api/v1/teams/me/fails`
* Improve speed of `/api/v1/teams/[team_id]/fails`
* Improve speed of `/api/v1/users/me/fails`
* Improve speed of `/api/v1/users/[user_id]/fails`
2022-04-08 21:21:42 -04:00
Khiem Doan
281ae12a7c Slim down the size of docker image (#2032)
`python3-dev` is already included in `python:3.7-slim-buster`. So we don't need to install it again.
This helps us reduce more than 100MB.
2022-04-08 18:34:53 -04:00
Kevin Chung
f24f2a18bb Import backup improvements (#2078)
* Add progress tracking to import_ctf
* Make imports happen in the background so that we can see status
* Add GET /admin/import to see status of import
* Disable the public interface during imports
* Closes #1980
2022-04-08 16:52:04 -04:00
Kevin Chung
0c6e28315c Add userName and userEmail to init objects in base.html (#2082)
* Add `userName` and `userEmail` to the CTFd init object in `base.html`
* Closes #2066
2022-04-08 15:14:57 -04:00
PinkDraconian
e526d60a6d Remove double printing of log (#2033)
* Fix double logging in log() function 

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-04-05 17:08:48 -04:00
Kevin Chung
24bf5302c4 Add support for only viewing hints after unlocking another hint (#2074)
* Add support for only viewing hints after unlocking another hint
* Closes #2007
2022-04-04 23:17:01 -04:00