Commit Graph

1182 Commits

Author SHA1 Message Date
Thomas Bork
6f8f7d928c Add individual DATABASE_* options, as an alternative to DATABASE_URL (#2237)
Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-12-23 00:10:27 -05:00
dependabot[bot]
167bac79bb Bump certifi from 2020.11.8 to 2022.12.7 (#2234)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2020.11.8 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](https://github.com/certifi/python-certifi/compare/2020.11.08...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-13 23:47:05 -07:00
Cryptanalyse
3c299095cb Fix the order of the solves of the user pages to the chronological ordering (latest first). (#2108)
* Fix the order of the solves, fails, awards to be chronological ordering (latest first).
2022-12-07 13:26:50 -05:00
Kevin Chung
d89ac579f2 Cache challenge data for faster loading of /api/v1/challenges (#2232)
* Improve response time of `/api/v1/challenges` and `/api/v1/challenges/[challenge_id]/solves`
* Rewrite and remove _build_solves_query to make it cacheable
* Closes #2209
2022-12-05 00:10:30 -05:00
Kevin Chung
800fb8260a Clarify Score Visibility and Account Visibility (#2227)
* Don't show /scoreboard if we do not have account_visibility
* Clarify the behavior of Score Visibility with respect to Account Visibility
2022-12-03 12:16:11 -05:00
Eduardo Santos
7e575a2e47 Bump CTFd dependencies (#2229)
Bump bcrypt, gevent, greenlet, python-geoacumen-city, requests.
2022-11-18 12:42:34 -05:00
Kevin Chung
e4a605e235 Change sendmail functions into classes that can be overriden from a plugin (#2221)
* Change sendmail functions into classes that can be overriden from a plugin
* Deprecate `CTFd.utils.email.mailgun.sendmail`
* Deprecate `CTFd.utils.email.smtp.sendmail`
2022-11-06 17:37:15 -05:00
Kevin Chung
dfa7f87823 Adding more protections for 502's during imports (#2220)
* Be more defensive on asset loading during imports
* On primary databases only import backups when we are actually able to make it to the target migration
2022-11-05 19:08:12 -04:00
Kevin Chung
95bfb96a82 Add names_only parameter to get_columns_for_table (#2219) 2022-11-05 18:12:19 -04:00
Kevin Chung
5daa85fce6 Fix other issues wih missing autocomplete='off' (#2217) 2022-11-05 11:55:40 -04:00
Bradley Jenkins
54ebf824f6 Allow /healthcheck endpoint to bypass setup (#2215)
* fixes #2214: https://petsathome.atlassian.net/browse/PDE-2132: Added "views.healthcheck"

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2022-11-05 09:21:14 -04:00
Kevin Chung
a085d0922a Fix issue with scoreboard ordering when an award results in a tie (#2212)
* Fix issue with scoreboard ordering when an award results in a tie
* Closes #833
2022-11-02 16:56:23 -04:00
Ty Rieckmann
ac7d5c7214 Add autofocus to text fields on authentication pages (#2196)
* Add autofocus to text fields on authentication pages
2022-10-16 15:07:44 -04:00
Kevin Chung
9e3ebfd301 Fix issue where Next selection wouldn't always load in Admin Panel also Closes #2159 (#2199)
* Fix issue where Next selection wouldn't always load in Admin Panel 
* Closes #2159 by pinning `event-source-polyfill` to 1.0.19. Note that we will not be using this polyfill starting with the `core-beta` theme.
2022-10-15 03:41:06 -04:00
Kevin Chung
96e6d66120 Fix issue where users could login to their team even though they were already on the team (#2198)
* Fix issue where users couldn't login to their team even though they were already on the team
2022-10-14 04:26:00 -04:00
Smyler
eb66034aae Add S3 region support (#2188)
Co-authored-by: Smyler <smyler@hackademint.org>
2022-09-30 03:46:47 -04:00
Janos Bonic
02c08f50cc Redirect users to team creation before event start (#2185)
* Redirect users to the team creation page if they access a during_ctf_time_only page before the CTF starts
2022-09-23 00:35:43 -04:00
Brendan McShane
04de6c0b4f Update Docker Image CI/CD (#2183)
* Update docker-build.yml to provide ARM builds
2022-09-15 16:24:58 -04:00
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