Commit Graph

641 Commits (7a7595cf033b9198045a9daed79944d2992f4f49)

Author SHA1 Message Date
Kevin Chung d2f8b4090d
Adds ondelete='CASCADE' to some models. (#979)
* Fixes `populate.py` to assign captains to teams.
* Adds `ondelete='CASCADE'` to most ForeignKeys in models
    * Closes #794 
* Test reset in team mode to test removing teams with captains
* Test deleting users/teams with awards to test cascading deletion
* `gen_team()` test helper now creates users for the team and assigns the first one as captain
* Added `Challenges.flags` relationship and moved the `Flags.challenge` relationship to a backref on `Challenges`
2019-05-04 02:08:26 -04:00
Koki Takahashi 6fcf143392 Fix rate-limiting of flag submission when using team mode (#977)
* Fix rate-limiting of flag submission when using team mode (Resolves CTFd/CTFd#975)
* Add tests for rate-limiting of flag submission
2019-05-02 00:56:41 -04:00
Kevin Chung 3f4a242b2b
Fix challenge preview for admins (#978)
* Allow admins to hit `/api/v1/challenges` and `/api/v1/challenges/[id]` without having a team
* Fixes regression from 2.0.6
2019-05-02 00:25:09 -04:00
Kevin Chung e7884c856f
Don't insert or check Tracking on static files or custom CSS (#976)
* No longer incur Tracking hits on theme files or custom CSS
2019-04-30 21:48:29 -04:00
Kevin Chung 4ec45dc4bc
Fix imports/exports and update Flask-SQLAlchemy to reduce warnings (#974)
* Fix imports/exports to accept JSON 
    * MariaDB does not properly understand JSON so it must accept strings instead of dicts
    * MariaDB outputs strings instead of JSON for its JSON type so the export serializer will attempt to cast output JSON strings to JSON objects
* Update Makefile to not lint any uploads
* Update Flask-SQLAlchemy to 2.4.0 to remove a large amount of warnings
2019-04-30 20:36:25 -04:00
Kevin Chung 376d644de7
Force db.create_all to happen for imports on sqlite. Force ctf_theme to be set to core in imports. (#972)
* Force `db.create_all` to happen for imports on `sqlite` or on failure to create missing tables
* Force `ctf_theme` to be set to `core` in imports in case a theme is missing from the import or the instance
2019-04-28 21:20:49 -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 069d4382e1
Mark 2.1.0 and update CHANGELOG (#967) 2019-04-24 20:33:17 -04:00
Kevin Chung 367498fd72
Fix logging without root in container (#966)
* Catch IOError issues (i.e. permission issues) with writing to log files
    * Related to #844
* Logs now have a sys.stdout handler
* Update Dockerfile to create and chown/chmod the folders used by `docker-compose` to store files/logs (`/var/log/CTFd`, `/var/uploads`)
2019-04-22 22:22:54 -04:00
Kevin Chung ad5df80979
Documentation improvements (#963)
* Add `SECRET_KEY` instructions to `README.md` for `docker-compose`
* Add a basic `CONTRIBUTING.md`
2019-04-21 12:00:21 -04:00
Kevin Chung 95e4060f15
ProxyFix changes (#960)
* Fixes insufficiently documented changes in ProxyFix
    * https://github.com/pallets/werkzeug/issues/1484
* Pin `Werkzeug==0.15.2` in requirements.txt
* Allow exports test to parallelize
2019-04-19 02:11:09 -04:00
Kevin Chung 0fa480bc14
Some 2.1.0a1 bugfixes (#959)
* Fix admin's modifying their own team or own settings
* Fix some links not working in the admin panel
* Fix extensions with an extra space in `populate.py`
2019-04-18 21:55:55 -04:00
Kevin Chung b1061a3e91
Remove socket.io.min.js from base.html (#958) 2019-04-17 23:15:24 -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 33367422a5
Mark 2.0.6 (#946)
2.0.6 / 2019-04-08
==================

**Security**
* Fixes an issue where user email addresses could be disclosed to non-admins

**General**
* Users/Teams set to hidden or banned are no longer visible by other users
    * This affects the API and the main user interface. This does not affect admins.
* Users without Teams can no longer view challenges when the CTF is in Team Mode
2019-04-08 07:57:40 -04:00
Kevin Chung c0a32a836b
Properly load schemas specified as strings (#943)
* Properly load schemas specified by their key string
* Add test for UserSchema 
* Prevent users without teams from interacting with challenges if the CTF is in Team Mode
2019-04-08 01:47:26 -04:00
Kevin Chung 7c60c697ee
Properly hide users/teams if they are set to banned/hidden (#932)
* Properly hide users/teams if they are set to hidden/banned
    * This should be in the API and in the main user panel. This should not affect admins. 
* Update tests to reflect this behavior.
2019-04-04 22:44:18 -04:00
Kevin Chung 268ed85f60
Update CHANGELOG and bump version (#920)
* Bump version to 2.0.5
2019-03-23 01:26:46 -04:00
Kevin Chung f75d7b62ed
Record a new solve before calculating the new dynamic value. (#919)
* Record a new solve before calculating the new dynamic value so hidden solves can't unintentionally move the challenge value
2019-03-22 12:26:57 -04:00
Kevin Chung fadb8271d2
Dont calculate hidden users in place (#918)
* Fix for hidden users bumping a user's place in their profile 
* Don't calculate hidden users in a user's place
2019-03-22 04:07:53 -04:00
s-nirali 37dcfdc568 Read smtp server configuration from config.py (#914)
* Read smtp server configuration from config.py

The CTFd/utils/email/smtp.py file has a provision to read SMTP
configuration for all fields from either the UI or CTFd/config.py file.
Two fields, `MAIL_SERVER` and `MAIL_PORT`, were not being read from the
config.py file. This commit fixes this issue.

* Update simple SMTP server tests
2019-03-21 22:10:08 -04:00
Grant Hernandez 1eb687a065 Fix email confirmation log line (#913) 2019-03-21 20:23:16 -04:00
Kevin Chung 4f7c4687d7
Reimplement admin send mail to users (#903)
* Reimplement admin send mail to users as `/api/v1/users/<user_id>/email`
* Update form and related Javascript
* Write test for controller
* Closes #897
2019-03-17 18:54:44 -07:00
Kevin Chung 42fa8fe555
Fix order by clause in Teams.get_solves (#901)
* Fix order_by clause in Teams.get_solves
2019-03-17 15:49:36 -07:00
Kevin Chung 39ef6509ff
Fix incorrect UserSchema view (#902)
* Fix UserSchema to be controlled by the user's type
2019-03-17 12:26:11 -07:00
David Chan da98bc9314 Assign solves.filter query (#896)
Closes #895
2019-03-17 10:12:57 -07:00
Kevin Chung 79b7b1dd5c
Fix removing profile details (Closes #894) (#899)
* Fix removing profile details (Closes #894)
* Update tests to properly check setting and removing profile values
2019-03-17 09:08:52 -07:00
Kevin Chung bf799fb220
Closes #861 (#889)
* Move plugin table creation before insertion and ignore errors during Postgres
2019-03-01 15:37:02 -08:00
Kevin Chung 2f252f5240
Fix for overflowing content preventing edit and deletion in admin panel (#891)
* Closes #876
* Fixes overflowing admin panel content by adding the `.text-break` CSS class.
    * This is .text-break cloned from Bootstrap 4.3 with a fix for browsers not supporting break-word. It will be removed from the main CTFd classes when Bootstrap is upgraded internally.
2019-02-28 20:04:21 -08:00
Kevin Chung 1f768dbfaf
Fix for hidden teams being visible on the team listing page and score… (#880)
* Fix for hidden teams being visible on the team listing page and scoreboard endpoints
2019-02-10 01:55:27 -05:00
Kevin Chung b4da3b464b
Replace temfile.SpooledTemporaryFile with tempfile.NamedTemporaryFile (#870)
* Replace `tempfile.SpooledTemporaryFile` with `tempfile.NamedTemporaryFile` in exports code
* Closes #869
2019-02-04 23:19:07 -05:00
Kevin Chung 7502ace50e
Closes #866 (#868)
* Adds `linux-headers` package to Dockerfile
* Closes #866
2019-02-03 18:46:01 -05:00
Kevin Chung 385d128d73
Mark 2.0.4 (#863) 2019-01-31 02:09:48 -05:00
Kevin Chung 2f49477465
Fix creating users from the admin panel while name changes disabled (#862)
* Fix creating users from the admin panel while name changes are disabled; clean up user & team schema validators
* Closes #832
* Coerce /api/v1/teams/<team_id> to /api/v1/teams/<int:team_id>
2019-01-31 01:18:46 -05:00
Kevin Chung 2935a76722
Fix showing incorrect 'CTF has ended' error if view_after_ctf is set (#859)
* Fix showing incorrect 'CTF has ended' error if view_after_ctf is set
2019-01-30 19:46:31 -05:00
Kevin Chung ae8ce0b430
Install gevent-websocket and use it by default until we have a better solution (#850)
* Install `gevent-websocket` and use it by default until we have a better solution
* May help with #849
2019-01-24 02:47:50 -05: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 3af036b4b2
Block new user registration if registering via MLC (#840)
* Block new user registration if registering via MLC
* Allow login with MLC while registration is disabled
2019-01-19 16:00:29 -05:00
Kevin Chung f8607c3d5c
Call init_logs() function to add logging handlers. Move init_logs() into initialization vs logging. (#841)
* Closes #835 
* Move `utils.logging.init_logs()` into `utils.initialization`
2019-01-19 13:43:29 -05:00
Kevin Chung a181c0a1e2
Consider account configs when user patches their own account (#836)
* Consider account configs when user patches their own account
* Add test for name changing
* Add test to ensure that users changing emails are marked unconfirmed
* Only allow users to change to emails in whitelisted domains
* Simplify assertion for error check
2019-01-17 22:54:42 -05:00
Kevin Chung e70c985d73
Fix update_check() logic (#830)
* Fix update_check() logic so that we don't accidentally remove the link to updates
* Update CHANGELOG
2019-01-12 14:04:51 -05:00
Kevin Chung fed0366ac0
Mark 2.0.3 (#828)
* Mark 2.0.3
2019-01-12 10:53:25 -05:00
Kevin Chung 6e8c7aaa50
Require CSRF-Token header on state changing API requests, require CSRF nonces on more than just POSTs, replace usage of fetch() with custom CTFd.fetch() implementation (#827)
* Require CSRF-Token header on state changing API requests
* Require CSRF nonces on more than just POSTs, 
* Replace usage of `fetch()` with custom `CTFd.fetch()` implementation
2019-01-10 22:38:37 -05:00
Kevin Chung 9ee743de7e
Simplify url_for calls in themes, rework CTFd.js, fix flaky test (#826)
* Simplify url_for calls in themes, rework CTFd.js, fix flaky test
2019-01-10 01:58:39 -05:00
Kevin Chung 83e294057e
Default SameSite session cookie setting to Lax (#824) 2019-01-08 02:52:51 -05:00
Kevin Chung 9f7dc0543c
Fix insecure link to MLC (#822) 2019-01-05 19:25:29 -05:00
Kevin Chung f1d0221ee2
Mark 2.0.2 (#819)
* Mark 2.0.2
* [ci-skip] Fix grammar issues
2019-01-04 02:14:04 -05:00
Kevin Chung 3093aa7d00
Fix 500s from invalid page args (#818)
* Fix some 500s generated by invalid non-int page arguments
2019-01-03 02:38:48 -05:00
Kevin Chung 747fa432c0
Pin normality version (#817)
Closes #816
Pin version of normality to work around pudo/normality#6.
2019-01-02 22:04:32 -05:00