Commit Graph

1222 Commits

Author SHA1 Message Date
Kevin Chung
7bae8360c8 Merge pull request #2328 from CTFd/2308-total-user-limit
Rough implementation of user registration limit
2023-06-14 02:04:33 -04:00
Kevin Chung
e4b91dfe58 Add test for num_user limit via MLC 2023-06-13 20:53:07 -04:00
Kevin Chung
d5c40142fb Fix lint 2023-06-13 20:36:32 -04:00
Kevin Chung
030a6bc4d5 Merge branch 'master' into 2308-total-user-limit 2023-06-13 20:36:02 -04:00
Kevin Chung
5d055f60f6 Add test for user limit registration behavior 2023-06-13 20:02:15 -04:00
Kevin Chung
8a1c0a4b07 Merge pull request #2325 from intrigus-lgtm/patch-1
* Enable gzip in nginx config
2023-06-13 18:52:44 -04:00
Kevin Chung
1ae65d7b3c Remove extra space 2023-06-13 18:34:25 -04:00
Kevin Chung
4be7b9f8ed Move gzip config so location is on top 2023-06-13 18:33:35 -04:00
Kevin Chung
5e8ff5d892 Rough implementation of user registration limit 2023-06-13 17:02:30 -04:00
intrigus-lgtm
4b4847e600 Enable gzip for nginx 2023-06-12 23:52:48 +02:00
Kevin Chung
dd20786b84 Merge pull request #2324 from CTFd/pull-core-beta
* Fix issue where the private team page would not render properly
2023-06-11 16:20:24 -04:00
Kevin Chung
89fb2e5803 Merge commit 'a64e7d51ef7c3bc33dfc19cc9ff48b3e3e23c64e' into pull-core-beta 2023-06-11 15:56:28 -04:00
Kevin Chung
a64e7d51ef Squashed 'CTFd/themes/core-beta/' changes from 9126d77d..5ce3003b
5ce3003b Merge pull request #47 from aCursedComrade/patch-1
c9887cb1 Fix team template

git-subtree-dir: CTFd/themes/core-beta
git-subtree-split: 5ce3003b4d68352e629ee2d390bc999e7d6b071e
2023-06-11 15:56:28 -04:00
Kevin Chung
23cdf85bf2 Mark 3.5.3 (#2319)
# 3.5.3 / 2023-06-07

**Deployment**

- Fixed permissions error in Dockerfile
- Bump dependencies for pybluemonday
2023-06-08 15:26:17 -04:00
Kevin Chung
b89cb3cb98 Add a section in the config panel to configure html sanitization but still allow config.ini to force it (#2316)
* Add a section in the config panel to configure html sanitization
* `HTML_SANITIZTION` in config.ini can still force sanitization regardless of the database configuration
* Closes #2194
2023-06-05 19:28:55 -04:00
Kevin Chung
692c4b086c Core beta (#2314)
* Install the core-beta theme into the CTFd repo

git-subtree-dir: CTFd/themes/core-beta
git-subtree-split: 9126d77d1a858e10c25ce028a35d42efaa0f49c0
2023-06-01 16:30:13 -04:00
Kevin Chung
1d9581cc0a Save pot file in repo (#2313) 2023-06-01 15:51:00 -04:00
Kevin Chung
635b0940e5 Add Translations layer (#2288)
* Add rough translations support into CTFd
* Add `flask-babel` dependency
* Adds language column to users table
* Closes #570 

---------

Co-authored-by: Miłosz Skaza <milosz.skaza@ctfd.io>
2023-06-01 15:24:00 -04:00
Kevin Chung
2474d6000d Bump pybluemonday version to support Python 3.11 (#2303)
* Bump pybluemonday version to `0.0.11` to support Python 3.11
* Closes #2301
2023-05-13 01:03:44 -04:00
Carl Fugate
c173ed6abd Added /opt/CTFD to chown path (line 47) to correct permissions error … (#2299)
* Added /opt/CTFd to chown path (line 47) to correct permissions error during startup.

---------

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2023-05-05 04:44:12 -04:00
Kevin Chung
3fbfd81644 Mark 3.5.2 (#2295)
# 3.5.2 / 2023-05-01

**General**

- Generate cachable S3 URLs by rounding time down to the previous hour to generate a consistent URL
- Change email whitelist error message to not include the list of allowed domains
- Clean up the language for confirming the password on team password change
- Fix issue where dynamic challenges break if the decay is 0 and prevent users from adding a decay limit of 0 to dynamic value challenges

**Admin Panel**

- Adds support for admins to control `robots.txt`
- Clean up the aesthetics for the 'Pause CTF' and 'View After CTF' configs
- Replaced TLS and SSL checkbox text to match the defaults used by Mozilla Thunderbird to eliminate confusion when configuring SMTP

**Deployment**

- Slim down Docker image by removing several dependencies not needed for production usage
  - The image size has been reduced from 648MB to 398MB
- In the Docker image run CTFd in a virtual environment located at `/opt/venv`
- Add freezegun to application dependencies
- Bump dependencies for pybluemonday, redis, SQLAlchemy-Utils, python-geoacumen-city
- Fix race conditions on cache healthcheck
- Fix situations where numeric config items in config.ini could cause CTFd to not start
2023-05-01 11:25:51 -04:00
mattcurts
0a967c99e0 Confirm Old Team Password (#2261)
* Update language for updating team password

---------

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2023-04-27 01:56:27 -04:00
skandix
25b3d77ed0 bump SQLAlchemy-Utils to version 0.41.0 (#2294)
* Bump down SQLAlchemy-Utils to version 0.41.0

* Update development dependencies

---------

Signed-off-by: Bendik Dyrli <skandix@datapor.no>
Co-authored-by: Kevin Chung <kchung@ctfd.io>
2023-04-27 01:38:31 -04:00
Peyton Duncan
ab91e7df34 SMTP TLS/SSL Labels to Match Thunderbird (#2293)
* TLS/SSL Labels to Match Thunderbird

Replaced TLS and SSL checkbox text to match the
defaults used by Mozilla Thunderbird to eliminate confusion when
configuring SMTP

* Add link to email server documentation

* Properly save changes

---------

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2023-04-27 00:53:59 -04:00
Kevin Chung
2a6f47d2ea Change email whitelist error message to not include the list of allowed domains (#2286)
* Change email whitelist error message to not include the list of allowed domains
2023-04-13 14:23:18 -04:00
dependabot[bot]
440aaddfb1 Bump redis from 3.5.2 to 4.4.4 (#2275)
Bumps [redis](https://github.com/redis/redis-py) from 3.5.2 to 4.4.4.
- [Release notes](https://github.com/redis/redis-py/releases)
- [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES)
- [Commits](https://github.com/redis/redis-py/compare/3.5.2...v4.4.4)

---
updated-dependencies:
- dependency-name: redis
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kevin Chung <kchung@ctfd.io>
2023-04-13 01:55:16 -04:00
Kevin Chung
c405fbb9b1 Bump pybluemonday version (#2285)
* Bump pybluemonday version
* Remove codecov from development.txt
2023-04-13 01:36:08 -04:00
Alper Berber
23c7b2f90f use ruff instead of flake8 (#2278)
* add: use ruff instead of flake8

* Update ruff switches and remove flake8 plugins

* fix: ignore linting rules

* fix: ignore I001

* fix: spaces before noqa

---------

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2023-04-11 11:20:48 -04:00
Smyler
faa937020a Prevent race conditions on /healthcheck (#2273)
In a high availability deployment scenario, two clients may make a request on /healthcheck at the exact same time, which can lead to check_config returning False if the second requests changes the 'healthcheck' cache key before the first one has had time to fetch the value it had set.

A solution to counter this is to ensure different keys are used for each healthcheck.
2023-04-03 02:01:17 -04:00
Kevin Chung
870eefb184 Fix issue where we are double processing config.ini items (#2274)
* In some cases with numeric config items it appears that we can end up processing a string twice. This issue fixes it so that we only process the strings once at configparser load time with `before_get`
2023-03-28 14:07:52 -04:00
Kevin Chung
b17adaf7aa Add support for robots.txt (#2269)
* Adds support for admins to control `robots.txt`
* Closes #2141
2023-03-12 17:03:35 -04:00
Kevin Chung
68da00900a Add freezegun to runtime dependencies, generate cachable s3 urls (#2264)
* Add freezegun to application dependencies
* Generate cachable S3 URLs by rounding time down to the previous hour to generate a consistent URL
2023-02-19 15:01:28 -05:00
Kevin Chung
c8dbfa6050 Fix Dockerfile venv so plugins can be installed at runtime (#2260)
* Set ownership of venv in Dockerfile to 1001
2023-02-14 21:22:29 -05:00
Kevin Chung
472010fcc2 Fix scoreboard detail count parameter (#2256)
* Add int requirement to `/api/v1/scoreboard/top/<count>`
2023-02-09 12:27:47 -05:00
Kevin Chung
68c3438474 Fix issue where dynamic challenges break if the decay is 0 (#2255)
* Fix issue where dynamic challenges break if the decay is 0
* Prevent users from adding a decay limit of 0 to dynamic value challenges
2023-02-08 13:22:16 -05:00
Kevin Chung
0f0064535c Clean up the aesthetics for the 'Pause CTF' and 'View After CTF' configs (#2250)
* Clean up the aesthetics for the 'Pause CTF' and 'View After CTF' configs
* Closes #2128
2023-01-28 04:21:16 -05:00
Eduardo Santos
fe9ba03e3b Add support for Docker multi-stage builds (#2228)
Separate docker build into two stagesto discard several binaries, builder, compiler and dev dependencies not needed for production usage. Run CTFd in a venv in `/opt/venv`. Reduce the image size from 648MB to 398MB.

Co-authored-by: Kevin Chung <kchung@ctfd.io>
2023-01-25 12:56:51 -05:00
Kevin Chung
89289ad641 Mark 3.5.1 (#2246)
# 3.5.1 / 2023-01-23

**General**

- The public scoreboard page is no longer shown to users if account visibility is disabled
- Teams created by admins using the normal team creation flow are now hidden by default
- Redirect users to the team creation page if they access a certain pages before the CTF starts
- Added a notice on the Challenges page to remind Admins if they are in Admins Only mode
- Fixed an issue where users couldn't login to their team even though they were already on the team
- Fixed an issue with scoreboard tie breaking when an award results in a tie
- Fixed the order of solves, fails, and awards to always be in chronological ordering (latest first).
- Fixed an issue where certain custom fields could not be submitted

**Admin Panel**

- Improved the rendering of Admin Panel tables on mobile devices
- Clarified the behavior of Score Visibility with respect to Account Visibility in the Admin Panel help text
- Added user id and user email fields to the user mode scoreboard CSV export
- Add CSV export for `teams+members+fields` which is teams with Custom Field entries and their team members with Custom Field entries
- The import process will now catch all exceptions in the import process to report them in the Admin Panel
- Fixed issue where `field_entries` could not be imported under MariaDB
- Fixed issue where `config` entries sometimes would be recreated for some reason causing an import to fail
- Fixed issue with Firefox caching checkboxes by adding `autocomplete='off'` to Admin Panel pages
- Fixed issue where Next selection for a challenge wouldn't always load in Admin Panel

**API**

- Improve response time of `/api/v1/challenges` and `/api/v1/challenges/[challenge_id]/solves` by caching the solve count data for users and challenges
- 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.
  - Unread notification count can now be tracked by themes that track which notifications a user has read
- Add `since_id` to `GET /api/v1/notifications` to get Notifications that have happened since a specific ID

**Deployment**

- Imports have been disabled when running with a SQLite database backend
  - See https://github.com/CTFd/CTFd/issues/2131
- Added `/healthcheck` endpoint to check if CTFd is ready
- There are now ARM Docker images for OSS CTFd
- Bump dependencies for passlib, bcrypt, requests, gunicorn, gevent, python-geoacumen-city
- Properly load `SAFE_MODE` config from environment variable
- The `AWS_S3_REGION` config has been added to allow specifying an S3 region. The default is `us-east-1`
- Add individual DATABASE config keys as an alternative to `DATABASE_URL`
  - `DATABASE_PROTOCOL`: SQLAlchemy DB protocol (+ driver, optionally)
  - `DATABASE_USER`: Username to access DB server with
  - `DATABASE_PASSWORD`: Password to access DB server with
  - `DATABASE_HOST`: Hostname of the DB server to access
  - `DATABASE_PORT`: Port of the DB server to access
  - `DATABASE_NAME`: Name of the database to use
- Add individual REDIS config keys as an alternative to `REDIS_URL`
  - `REDIS_PROTOCOL`: Protocol to access Redis server with (either redis or rediss)
  - `REDIS_USER`: Username to access Redis server with
  - `REDIS_PASSWORD`: Password to access Redis server with
  - `REDIS_HOST`: Hostname of the Redis server to access
  - `REDIS_PORT`: Port of the Redis server to access
  - `REDIS_DB`: Numeric ID of the database to access

**Plugins**

- Adds support for `config.json` to have multiple paths to add to the Plugins dropdown in the Admin Panel
- Plugins and their migrations now have access to the `get_all_tables` and `get_columns_for_table` functions
- Email sending functions have now been seperated into classes that can be customized via plugins.
  - Add `CTFd.utils.email.providers.EmailProvider`
  - Add `CTFd.utils.email.providers.mailgun.MailgunEmailProvider`
  - Add `CTFd.utils.email.providers.smtp.SMTPEmailProvider`
  - Deprecate `CTFd.utils.email.mailgun.sendmail`
  - Deprecate `CTFd.utils.email.smtp.sendmail`

**Themes**

- The beta interface `Assets.manifest_css` has been removed
- `event-source-polyfill` is now pinned to 1.0.19.
  - See https://github.com/CTFd/CTFd/issues/2159
  - Note that we will not be using this polyfill starting with the `core-beta` theme.
- Add autofocus to text fields on authentication pages
2023-01-23 10:34:49 -05:00
Bin We
57e2154e04 Fix display error on mobile devices (#2244)
* Add table-responsive class to more tables in the Admin Panel to improve mobile view
2023-01-21 03:33:26 -05:00
Thomas Bork
49bc81e517 Add individual REDIS_* options, as an alternative to REDIS_URL (#2245)
* Add individual REDIS_* options, as an alternative to REDIS_URL

* Clarify supported protocols for REDIS_PROTOCOL setting
2023-01-18 23:05:01 -05:00
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