Commit Graph

20 Commits

Author SHA1 Message Date
Kevin Chung
adc70fb320 3.0.0a1 (#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 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`
2020-07-01 12:06:05 -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
Baptiste MOINE
420e4f4dc7 Make ctfd user usable for mysql connection (#1028)
* Make unprivileged `ctfd` user usable for mysql connection in docker-compose by having the db image create the database instead of CTFd
2019-06-21 00:55:44 -04:00
Kevin Chung
b37684d8ba Run as root when using docker-compose to be able to write to the volume (#981)
* Docker Compose needs to be run as root to be able to write to the bind mounted volumes.
2019-05-04 17:17:11 -04:00
Kevin Chung
c4e9b7037a Reduce default gunicorn worker count to reduce memory usage (#968)
Drop the default worker count in `docker-entrypoint.sh` because the default memory usage was higher than it needed to be. If you need more workers you can still increase the values and set a `SECRET_KEY` as before.
2019-04-25 15:05:20 -04:00
Kevin Chung
b6d54b9ee9 2.1.0 (#957)
https://github.com/CTFd/CTFd/milestone/6
2019-04-17 01:36:30 -04:00
Kevin Chung
06f0715369 Allow custom MySQL ports in docker entrypoint (#848)
* Allow DATABASE_URL to contain custom MySQL ports for docker-entrypoint.sh
* Drop WORKERS count to 1 to avoid dealing with Flask-SocketIO sticky sessions
2019-01-21 22:40:23 -05:00
Kevin Chung
92e7be224b Revert 762 log envvar (#845)
* Stop gunicorn from logging to `LOG_FOLDER` in docker without explicit opt-in
* Re-add the `LOG_FOLDER` envvar to docker-compose so we don't try to write to the read-only host
* Add `ACCESS_LOG` and `ERROR_LOG` envvars to docker to specify where gunicorn will log to
2019-01-21 12:17:59 -05:00
Kevin Chung
614243d8c0 Update mariadb to 10.4 based on #726 (#762)
* Update mariadb to 10.4
* Remove LOG_FOLDER from docker-compose.yml
2018-11-28 00:57:54 -05:00
Kevin Chung
b78589d20d Update docker files (#598)
* Add redis to docker-compose, bump worker count to 4
* Add workers & missing SECRET_KEY error
* Remove uwsgi specific files
* Parse database host in `docker-entrypoint.sh`. Closes #587
2018-03-25 04:25:33 -04:00
Victor "Nate" Graf
54d12460d5 Improve the flexibility and ease-of-use for docker-compose deployment (#560)
* docker-compose improvements
    * Use gevent gunicorn workers
    * Makes logs easier to access
* Customization of the logs location
* Improve secret key generation & only generate secret keys if one isn't defined (Closes #123)
* Install requirements required by plugins
2018-02-11 03:52:21 -05:00
Kevin Chung
0aefdcc162 Update requirements.txt and fix docker-compose mariadb issue (#566)
* Update dependencies in requirements.txt 
* Fix issue where mariadb would remove gunicorn database connections in docker-compose
2018-02-09 01:56:35 -05:00
Kevin Chung
b900d1cb68 Fixes #315 (#316)
CTFd creates the database instead of the docker-compose files which allows us to control encoding. Also adds a test for registering with a unicode team name.
2017-07-16 02:50:32 -04:00
Kevin Chung
736a0e1dc3 Fixing some docker issues
Closes #266
2017-06-03 16:28:02 -04:00
Kevin Chung
f07a39c343 Updating Docker files
Thanks @erasche for these changes from PR #204.
2017-04-08 17:35:18 -04:00
Kevin Chung
967129a009 Closes #225
Also removes unnecessary pip install from travis config
2017-03-10 01:17:17 -05:00
Kevin Chung
09398b2ab0 Changing to Ubuntu and docker-compose v2. Closes #185 2017-01-06 17:04:57 -05:00
Kevin Chung
f1bf2fd4e5 Streamlining docker-compose process 2016-11-10 15:35:59 -05:00
Mark Ignacio
1f1fbbf585 Docker Compose files and adjustments 2016-01-08 21:01:55 -05:00