Commit Graph

974 Commits

Author SHA1 Message Date
Kevin Chung
ecdb99e2f1 Require passwords on accounts (#1754)
- Fixed an issue where Users/Teams could be created with a null password through the Admin Panel
2020-12-04 18:56:42 -05:00
Kevin Chung
cb5ba26bdb Miscellaneous Fixes (#1752)
* Update CHANGELOG 
* Add `registered_only` decorator
* Make team invites redirect to `/register` if you're unauthed
2020-12-04 14:10:36 -05:00
Kevin Chung
d9975f307c Mark 3.2.0 (#1748)
# 3.2.0 / unreleased

**General**

- Add Team invites.
  - Team invites are links containing a token that allow a user to join a team without knowing the team password
  - Captains can generate invite tokens for their teams
  - Admins can generate Team invite links as well
- Improved Team handling
  - Prevent team joining while already on a team
  - Return 403 instead of 200 for team join/create errors
  - Allow team captains whose teams haven't done anything to disband their team
- Allow for uploading navbar logo, favicon, and index page banner during initial setup
- Fixed issue in teams mode where a user couldn't unlock a hint despite their team having enough points
  - The fix for this is essentially to allow the user's points to go negative
- Imports have been made more stable
  - This is primarily done by killing MySQL processes that are locking metadta
  - This is a subpar approach but it seems to be the only solution to avoid a metadata lock in MySQL. This approach did not appear to be needed under Postgres or SQLite
- Update some migrations to first check if a table already exists.

**API**

- Addition of `POST /api/v1/teams/me/members` to generate invite tokens for teams
- Fixed an issue in `POST /api/v1/awards` where CTFd would 500 when a user could not be found by the provided `user_id`
- `POST /api/v1/unlocks` in teams mode now uses the team's score to determine if a user can purchase a hint
  - Properly check for existing unlocks in teams mode in `POST /api/v1/unlocks`
- `/api/v1/notifications` and `/api/v1/notifications/[notification_id]` now have an html parameter which specifies the rendered content of the notification content

**Themes**

- Added syntax highlighting to challenge descriptions, pages, hints, notifications, comments, and markdown editors
  - This is done with `highlight.js` which has been added to `package.json`
- Fix notifications to properly fix/support Markdown and HTML notifications
  - Notifications SQL Model now has an html propery
  - Notifications API schemas now has an html field
- Removed MomentJS (see https://momentjs.com/docs/#/-project-status/) in favor of dayjs
  - dayjs is mostly API compatible with MomentJS. The only major changes were:
    - dayjs always uses browser local time so you don't need to call `.local()`
    - dayjs segments out some MomentJS functionality into plugins which need to be imported in before using those features
- Fixed issue in `challenge.html` where the current attempt count would have a typo
- Fixed issue in `challenge.html` where the max attempts for a challenge would not show if it was set to 1
- Edit donut charts to have easier to read legends and labels
- Make data zoom bars thinner and more transparent

**Plugins**

- Don't run `db.create_all()` as much during plugin upgrade or during imports
  - By avoiding this we can let alembic and migrations do more of the table creation work but this means that plugins specifically opt into `app.db.create_all()` and will not implicitly get it through `upgrade()`.
  - This means plugins that run `upgrade()` without a migrations folder (no idea who would do this really) will need to upgrade their code.

**Admin Panel**

- Add Favicon uploading to the Admin Panel
- Move Logo uploading to the Theme tab in the Admin Panel
- The challenge left side bar tabs have been rewritten into VueJS components.
  - This fixes a number of issues with the consistency of what data is deleted/edited in the challenge editor
  - This also prevents having to refresh the page in most challenge editing situations
- Fixed a possible bug where the update available alert wouldn't go away on server restart
- Examples for regex flags are now provided
- Wrong submissions has been renamed to Incorrect Submissions
- Graphs in the Admin Statistics page will now scroll with mouse wheel to improve browsing large datasets

**Deployment**

- A restart policy set to `always` has been added to nginx in docker-compose
- Rename `requirements.txt` to `requirements.in` and generate `requirements.txt` using `pip-tools` under Python 3.6
- `UPLOAD_PROVIDER` no longer has a default `filesystem` set in config.ini. Instead it is defaulted through `config.py`

**Miscellaneous**

- The `psycopg2` dependency in development.txt has been removed in favor of `psycopg2-binary` which was updated to 2.8.6
- The `moto` dependency in development.txt has been updated to 1.3.16
- Add `pip-tools` to `development.txt`
- Add `import_ctf` and `export_ctf` commands to `manage.py` and deprecate `import.py` and `export.py`
- Override the `MAIL_SERVER` config with the `TESTING_MAIL_SERVER` envvar during tests
- `ping` events in the notification event handler have been fixed to not send duplicates
2020-12-01 16:09:31 -05:00
Kevin Chung
da4ee4021a Fix issue where a user can't be found for creating an award (#1736)
* Fix issue where a user can't be found for creating an award
2020-11-23 13:10:35 -05:00
Kevin Chung
af1c325371 Improved Team Handling (#1713)
* Prevent team joining while already on a team
* Return 403 instead of 200 for team join/create errors
* Allow team captains whose teams haven't done anything to disband their team
* Closes #1588
2020-11-23 02:35:46 -05:00
Laurent Jalbert-Simard
a4ce27b166 No longer set "filesystem" as UPLOAD_PROVIDER in config.ini (#1728)
* Remove the default `filesystem` setting for `UPLOAD_PROVIDER` in config.ini
  * `filesystem` is still the default via config.py
2020-11-19 14:25:26 -05:00
Kevin Chung
463f117b4a Fix requirements for Python 3.7 because of https://github.com/ericvsmith/dataclasses/pull/161 (#1730)
* Build `requirements.txt` on Python 3.7 to fix an issue with installing dataclasses. 
* Closes #1729 

I tested that this works in Python 3.6, 3.7, and 3.8. A useful project would be to add installing deps to Github Actions. 
I'll subscribe to https://github.com/ericvsmith/dataclasses/pull/161 since this is IMO a bug in dataclasses.
2020-11-19 12:47:15 -05:00
Frank
1883c62cf5 reduce ping events (Fix #1685) (#1699)
Closes #1685
2020-11-18 20:27:48 -05:00
Kevin Chung
44a588869e Increase timeout for update check (#1726)
* Increase timeout for update check from 0.1 seconds to 3 seconds
* Closes #1678
2020-11-18 02:54:15 -05:00
Kevin Chung
9efa102487 Max Attempts improvements in challenge.html (#1725)
* Fixed issue where the current attempt count would have a typo
* Fixed issue where the max attempts for a challenge would not show if it was set to 1
* Works on #1655
2020-11-18 02:34:52 -05:00
Kevin Chung
66ff9c0b91 Add import export commands to manage.py (#1723)
* Add `import_ctf` and `export_ctf` commands to `manage.py`
* Deprecate `import.py` and `export.py`
* Works on #1629
2020-11-16 20:24:42 -05:00
Kevin Chung
1e9c0b43b1 Freeze python dependencies using pip-tools (#1722)
* Rename `requirements.txt` to `requirements.in`
* Generate `requirements.txt` using `pip-tools` under Python 3.6
* Add `pip-tools` to `development.txt`
* Closes #1679
2020-11-16 17:06:01 -05:00
Kevin Chung
a2987f1199 Remove psycopg2 dep and only use psycopg2-binary (#1720)
* Remove `psycopg2` dep and only use `psycopg2-binary`
* Update `psycopg2-binary` to 2.8.6
2020-11-16 11:02:54 -05:00
Kevin Chung
048632788d Add examples for regex flags (#1716)
* Adds examples for regex flags in the flag creation form
2020-11-14 19:02:28 -05:00
Kevin Chung
17db97495e Rewrite the flag creation modal to be in vuejs (#1715)
* Rewrite flag creation modal to VueJS
* Rewrite flag edit modal to VueJS
* Rewrite flag list tab in the Admin Panel challenge page to VueJS
* Closes #1693
2020-11-14 16:17:43 -05:00
Kevin Chung
0ed1a0c659 Set MAIL_SERVER during testing to use the TESTING_MAIL_SERVER envvar (#1709)
* Override the `MAIL_SERVER` config with the `TESTING_MAIL_SERVER` envvar during tests
2020-11-08 22:28:28 -05:00
n01e0
23cef1c755 fix link name (#1698)
Co-authored-by: Kevin Chung <kchung@ctfd.io>
2020-11-08 21:35:16 -05:00
Nir
d0813e7296 Fix docker compose (#1708)
Seems reasonable. Thanks for the PR!
2020-11-08 20:54:57 -05:00
Nicolai Søborg
4c31dc23e8 Fix TemplateAssertionError in forms (#1675)
* Pin Jinja2==2.11.2 to fix a Jinja Assertion error
2020-10-03 15:42:22 -04:00
SpeedX
f331ee79d5 Bump gevent version (#1677)
* Closes #1667
* Updates gevent to 20.9.0
2020-10-01 03:40:52 -04:00
Kevin Chung
ed64b4871d Mark 3.1.1 (#1663)
# 3.1.1 / 2020-09-22

**General**

- Fix notification deliverability when there are multiple tabs open
- Only play notification sounds in the master tab that receives the notification

**Admin Panel**

- Fix issue preventing admins from emailing users through the Admin Panel
- Improve Notification UI
  - Clears notification form after notification submission
  - Add notification to notification list after creation

**Themes**

- Add fix for trying to increment solves when solves are hidden
- Update JS dependencies to fix a transpiliation error preventing optional custom fields from being left empty
  - `@babel/core`, `@babel/preset-env`, `@fortawesome/fontawesome-free`, and `babel-loader` were updated but only `@babel/core` needs to be updated to resolve the transpiliation issue
- Remove `console.log` statements from minified production JS
- Compress notification sound and document the compression command

**Miscellaneous**

- Add the ability to override the sender header of email sent via SMTP with the `MAILSENDER_ADDR` config value
3.1.1
2020-09-22 00:59:49 -04:00
Kevin Chung
1d6138e692 bump @babel/polyfill version to 7.11.5 (#1664)
* Bump @babel/polyfill version to 7.11.5
2020-09-21 19:07:31 -04:00
Kevin Chung
4cd4d0cb92 Add the ability to override the sender header of email via SMTP (#1657)
* Add the ability to override the sender header of email via SMTP with the `MAILSENDER_ADDR` config value
* Closes #1644
2020-09-20 23:54:19 -04:00
Kevin Chung
1be3659996 Fix regression in notification deliverability (#1659)
* Fix regression in notification deliverability. Closes #1641
    * Only master tabs were showing notifications
* Only play the notification sound in the master tab
* Clears notification form after notification submission
* Add notification to admin notification list after creation. Closes #1651 
* Remove `console.log` statements from minified production JS
2020-09-20 03:05:49 -04:00
Kevin Chung
722d45c73b Compress notification sound more (#1625)
* Compress `notification.webm` to save some file size
2020-09-20 02:45:10 -04:00
Kevin Chung
72f9fa75c6 Update @babel/core, @babel/preset-env, @fortawesome/fontawesome-free, and babel-loader to fix a transpiliation error (#1654)
* Update @babel/core, @babel/preset-env, @fortawesome/fontawesome-free, and babel-loader to fix a transpiliation error
* Closes #1653
2020-09-18 01:03:08 -04:00
Kevin Chung
dfe4f004f2 Add fix for trying to increment solves when solves are hidden (#1646)
* Don't attempt to increment solves if solves are hidden.
2020-09-13 02:27:56 -04:00
kreegahbundolo
ba26722407 Fix for email send issue (#1640)
* Fix issue with sending wrong API parameter for email sending in Admin Panel
2020-09-10 00:58:59 -04:00
Kevin Chung
cfde6c99af Fix regression in challenge creation (#1638)
* Closes #1637
3.1.0
2020-09-08 17:34:27 -04:00
Kevin Chung
efab97905b Add info about custom fields to the themes CHANGELOG (#1636)
* Add info about custom fields to the themes CHANGELOG
2020-09-08 16:56:41 -04:00
Kevin Chung
9264e96428 Mark 3.1.0 (#1634)
# 3.1.0 / 2020-09-08

**General**

- Loosen team password confirmation in team settings to also accept the team captain's password to make it easier to change the team password
- Adds the ability to add custom user and team fields for registration/profile settings.
- Improve Notifications pubsub events system to use a subscriber per server instead of a subscriber per browser. This should improve the reliability of CTFd at higher load and make it easier to deploy the Notifications system

**Admin Panel**

- Add a comments functionality for admins to discuss challenges, users, teams, pages
- Adds a legal section in Configs where users can add a terms of service and privacy policy
- Add a Custom Fields section in Configs where admins can add/edit custom user/team fields
- Move user graphs into a modal for Admin Panel

**API**

- Add `/api/v1/comments` to manipulate and create comments

**Themes**

- Make scoreboard caching only cache the score table instead of the entire page. This is done by caching the specific template section. Refer to #1586, specifically the changes in `scoreboard.html`.
- Add rel=noopener to external links to prevent tab napping attacks
- Change the registration page to reference links to Terms of Service and Privacy Policy if specified in configuration

**Miscellaneous**

- Make team settings modal larger in the core theme
- Update tests in Github Actions to properly test under MySQL and Postgres
- Make gevent default in serve.py and add a `--disable-gevent` switch in serve.py
- Add `tenacity` library for retrying logic
- Add `pytest-sugar` for slightly prettier pytest output
- Add a `listen()` method to `CTFd.utils.events.EventManager` and `CTFd.utils.events.RedisEventManager`.
  - This method should implement subscription for a CTFd worker to whatever underlying notification system there is. This should be implemented with gevent or a background thread.
  - The `subscribe()` method (which used to implement the functionality of the new `listen()` function) now only handles passing notifications from CTFd to the browser. This should also be implemented with gevent or a background thread.
2020-09-08 00:08:35 -04:00
Kevin Chung
c1d7910920 Don't provide extra time config values and prevent invalid dates during setup (#1627)
* Don't provide extra time config values when updating times in the Admin Panel
* Prevent invalid dates during setup
2020-08-31 12:30:56 -04:00
Connor Nelson
dddec84d7f Fix config default logic (#1623)
* Fix default logic in `config.py`

Co-authored-by: Kevin Chung <kchung@nyu.edu>
2020-08-28 15:57:12 -04:00
Kevin Chung
5b2926b18b Fix potential issue preventing a user from finishing setup (#1620)
* Fix a potential issue where setup could not be completed b/c next buttons were unclickable
2020-08-25 23:40:29 -04:00
Kevin Chung
c9fd529264 Mark 3.0.2 (#1617)
# 3.0.2 / 2020-08-23

**Admin Panel**

- Fix submission searching in Admin Panel
- Fix update banner being hidden behind navbar

**Plugins**

- Change default `input` & `submit` blocks in `challenge.html` to use the default values specified in the original challenge type plugins
3.0.2
2020-08-23 18:54:40 -04:00
Kevin Chung
e474c9dcc4 Move update banner to prpoer location (#1616)
* Move update banner to proper location in Admin Panel
2020-08-23 03:12:49 -04:00
Connor Nelson
cc190aa05b Match challenges and dynamic challenges (#1609)
* Change default `input` & `submit` blocks in `challenge.html` to use the default values specified in the original challenge type plugins
2020-08-22 19:31:08 -04:00
Kevin Chung
976b191b53 Fix submission search (#1605)
* Fix submission searching in Admin Panel
2020-08-14 12:20:41 -04:00
Kevin Chung
6559846452 Mark 3.0.1 (#1594)
# 3.0.1 / 2020-08-12

**General**

- Fix issue where admins could not see user graphs/api data if score visibility was set to hidden

**Admin Panel**

- Allow the Admin Panel Submissions page to filter by Account IDs, Challenge IDs, and Challenge Names
- Link to correct submissions for challenge from the challenge page

**API**

- Fix regression for creating hints via ctfcli. See #1582 for details. https://github.com/CTFd/CTFd/issues/1582.
- Deprecate `CTFd.api.v1.helpers.models.build_model_filters` and wrap it to `CTFd.utils.helpers.models.build_model_filters`

**Themes**

- Fix team pages to use the correct core errors component

**Plugins**

- Fix issues with previewing challenges under some challenge type plugins

**Deployment**

- Values specified in `config.ini` will now supercede values specified via environment variable. Config behavior is as follows:
  1. Config Key exists in `config.ini` and is set to a value. That value becomes the app config.
  2. Config Key exists in `config.ini` but is set to an empty string. An envvar with the same name is looked up. The envvar's value is used as the app config.
  3. If the envvar is not found, fall back to the default specified value in `config.py`
  4. If there is no default, use None or an empty string
3.0.1
2020-08-12 12:35:32 -04:00
Kevin Chung
2b0fb28f28 Update icon for link to correct submissions in challenge page (#1593)
* Update icon for link to correct submissions to `fa-tasks`
2020-08-12 03:03:17 -04:00
Kevin Chung
f4c9d1e2e8 1569 submission filter by challenge (#1590)
* Allow the Admin Panel Submissions page to filter by Account IDs, Challenge IDs, and Challenge Names
* Deprecate `CTFd.api.v1.helpers.models.build_model_filters` and wrap it to `CTFd.utils.helpers.models.build_model_filters`
* Clean up some miscellaneous Submissions code 
* Closes #1569
2020-08-09 03:40:11 -04:00
Kevin Chung
69b4aafeac Make team profile pages use the shared errors component (#1589)
* Fix team pages to use the core errors alert component
* Closes #1585
2020-08-08 04:09:13 -04:00
Kevin Chung
f597332c90 Fix regression from ded612d46b and fix https://github.com/CTFd/ctfcli/pull/20 (#1583)
* Fix regression for creating hints via ctfcli

See #1582 for details. 
Closes https://github.com/CTFd/ctfcli/pull/20.
2020-08-06 15:49:29 -04:00
Kevin Chung
5d7e0e39c7 1580 fix hidden admin scores (#1581)
* Fix issue where admins could not see user graphs/api data if score visibility was set to hidden
* Closes #1580
2020-08-04 13:23:46 -04:00
Kevin Chung
324fdeda4a Fix issue with previewing some challenge plugins (#1579) 2020-08-03 18:16:02 -04:00
dependabot[bot]
08f2f810fe Bump elliptic from 6.5.0 to 6.5.3 (#1577)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.0 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.0...v6.5.3)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-02 15:24:45 -04:00
Kevin Chung
02438852de Add a better fallback for environment variables through config interpolation (#1574)
* Make config.ini properly supercede environment variables
* Add ability for all config.ini values to fallback to environment variables. 
* Closes #1573 

Config Behavior should be as follows:

1. Key exists in `config.ini` and is set to a value. That value becomes the app config.
2. Key exists in `config.ini` but is set to empty string. An envvar the same name is looked up. The envvar's value is used as the app config. 
3. If the envvar is not found, fall back to the default specified value in `config.py`
4. If there is no default, use None or an empty string
2020-07-29 04:18:53 -04:00
Kevin Chung
0a17c73e6d Mark 3.0.0 (#1572)
# 3.0.0 / 2020-07-27

## Changelog Summary

The CTFd v3 Changelog represents the changes from v2.5.0 to v3. It is a summarized version of the changes that occured in all CTFd v3 beta/alpha releases.

CTFd v3 contains some breaking changes but many plugins remain compatible. Themes will need some minor changes to be compatible with v3.

These changes are made with great consideration to existing installations and for the health of the overall CTFd project. If you rely on specific behavior, you can always download the last CTFd v2 release on Github. Official plugin/theme updates will be sent to the email addresses on file.

The major changes in CTFd v3 are as follows with the detailed changelog beneath:

- ### Server Side HTML/Markdown Rendering

HTML rendering in some cases (challenge description rendering, hint content rendering) has been moved to the server side. Previously it was rendered by the browser but this led to a lot of duplicated behavior and complexity in some plugins. Rendering that HTML content on the server allows CTFd to take more advantage of theme content and reduce duplicated code across themes.

In addition, HTML sanitization can be enabled on the CTFd installation to prevent the injection of malicious scripts in HTML content.

- ### CommonMark

CTFd now uses [CommonMark](https://commonmark.org/) for HTML/Markdown rendering. This leads to much more consistent rendering of HTML/Markdown content.

In some cases, this can break your HTML output. You can use our [development testing script](https://gist.github.com/ColdHeat/085c47359ab86c18864135a198cbe505) to check if your HTML output will change and correct it accordingly.

- ### Forms, Nonces, Sessions

CTFd no longer directly injects values into the global session object for a theme. You may have used this as `{{ nonce }}` or `{{ id }}`. Instead these values should be accessed via the `Session` global as so: `{{ Session.nonce }}`.

All of the public facing forms in CTFd have been converted to form globals with WTForms. You can access them via the `Form` global in Jinja. For example, `{{ Forms.auth.LoginForm() }}`. A `{{ form.nonce() }}` function is available on all forms for easier access to the CSRF nonce as well.

Old forms will still work if the nonce used in the form is updated to `{{ Session.nonce }}`.

Values provided by configuration and plugins can now be accessed via the `Configs` and `Plugins` globals. For example `{{ Configs.ctf_name }}` and `{{ Plugins.scripts }}`. See the `base.html` file of the core theme to get an idea of how to use these values.

- ### Challenge Type Plugin Enhancements

Challenge type plugins now have better re-useability with the rest of CTFd. Plugin code no longer needs to copy unchanged methods over from the base challenge plugin classes.

In addition, challenge HTML is now rendered on the server side using a new `challenge.html` file provided by the current theme. This means that the theme effectively controls how a challenge should look overall, but the challenge plugin controls the overall content.

- ### Python 3

CTFd v3 is Python 3 only.

- ### Docker image based on Debian

The Docker image used in CTFd is now based on Debian.

- ### config.ini

Instead of editting `config.py` directly, it's now a better idea to edit `config.ini` or provide your configuration via environment variables

## Detailed Changelog

**General**

- CTFd is now Python 3 only
- Render markdown with the CommonMark spec provided by `cmarkgfm`
- HTML/Markdown content is now rendered on the server side in most cases.
  - This includes challenge descriptions, hint content, and page content
- Ability to render markdown stripped of any malicious JavaScript or HTML.
  - Controlled via the `HTML_SANITIZATION` server side configuration value
- 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
- Accept additional profile fields during registration (affiliation, website, country)
  - This does not add additional inputs. Themes or additional JavaScript can add the form inputs.

**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
- GeoIP support now available for converting IP addresses to guessed countries
- Redesign the challenge creation form to use a radio button with challenge type selection instead of a select input

**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
- Admins can no longer ban themselves through `PATCH /api/v1/users/[user_id]`
- Add `html` item for `GET /api/v1/hints/[hint_id]` which contains the rendered HTML of the Hint content
- Remove `content` from `GET /api/v1/hints`

**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
- Spinner centering has been switched from a hard coded margin in CSS to flexbox CSS classes from Bootstrap

**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 https://github.com/CTFd/CTFd/issues/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`

**Miscellaneous**

- Fix an issue where email sending would be broken if the CTF name contained a colon
- Lint Markdown files with Prettier
- Lint Dockerfile and docker-compose.yml in Github Actions
- Lint JavaScript files with eslint
- Certain static strings have been converted into Enums for better re-useability throughout the code base
- Switch to using Github Actions for testing and linting
- Better handling of missing challenge types. Missing challenge types no longer bring down all other challenges.
- Documentation has been seperated out into a seperate repo (https://github.com/CTFd/docs).
- Documentation hosting has moved from ReadTheDocs to Netlify
- Any links in the codebase to help.ctfd.io have been changed to docs.ctfd.io.
3.0.0
2020-07-27 03:08:25 -04:00
Kevin Chung
dc3a4d275b Fix issue with previewing certain pages (#1571)
* Fix previewing pages when page attributes are set
2020-07-24 14:52:35 -04:00
Kevin Chung
6062b980fc Return better errors on invalid API parameters (#1570)
* Return better errors on invalid API parameters

For example:
```
{
    "success": false,
    "errors": {
        "user_id": "value is not a valid integer"
    }
}
```
2020-07-24 13:43:27 -04:00