Commit Graph

23 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
4835aa7311 Replace databases dependency with asyncpg, remove SQLAlchemy except schema.py
- Rewrite database.py with asyncpg pool-based DatabasePool class
- Support named params (:param) → positional ($N) conversion
- Transaction context manager using contextvars for connection reuse
- Replace all SQLAlchemy query building with raw SQL in routes and sql modules
- Update utils/db.py to use raw SQL strings instead of SQLAlchemy Select
- Update utils/db_init.py to use local engine creation for DDL only
- Update all test files to use string table names and raw SQL
- Remove databases and sqlalchemy-stubs from dependencies
- Keep sqlalchemy only for schema.py definitions and alembic migrations
2026-07-28 19:00:52 +00:00
Copilot
1044914a48 fix: enforce dashboard_public check for unauthenticated API access (GHSA-9mjc-6fp2-hm9v) (#1660)
## Summary

Fixes the missing `dashboard_public` check security vulnerability
(GHSA-9mjc-6fp2-hm9v).

### Root cause

The `user_authenticated_or_public_dashboard` dependency in `auth.py`
only verified that the tournament existed in the database, but never
checked whether `dashboard_public = True`. This allowed unauthenticated
users to access sensitive tournament data on the following endpoints
even when the tournament was not publicly shared:

- `GET /tournaments/{tournament_id}` (partially protected by an explicit
post-dependency check)
- `GET /tournaments/{tournament_id}/courts`
- `GET /tournaments/{tournament_id}/teams`
- `GET /tournaments/{tournament_id}/rankings`
- `GET /tournaments/{tournament_id}/stages`

### Changes

- **`backend/bracket/routes/auth.py`**: Added `not
tournaments_fetched[0].dashboard_public` to the check in
`user_authenticated_or_public_dashboard`. Unauthenticated requests to a
tournament with `dashboard_public=False` now receive a 401 response.
- **`backend/bracket/routes/tournaments.py`**: Removed the now-redundant
explicit `dashboard_public` check in `get_tournament` (the dependency
handles it now).
- **`backend/tests/integration_tests/api/tournaments_test.py`**: Added
`test_non_public_tournament_endpoints_blocked_for_unauthenticated_users`
to assert that all affected endpoints return 401 for unauthenticated
requests when `dashboard_public=False`.

Note: `user_authenticated_or_public_dashboard_by_endpoint_name` (used
for the `GET /tournaments?endpoint_name=` route) was not affected — it
delegates to `sql_get_tournament_by_endpoint_name` which already
includes `AND dashboard_public IS TRUE` in its SQL query.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: evroon <11857441+evroon@users.noreply.github.com>
2026-04-14 10:38:16 +02:00
Erik Vroon
489fc2ba64 Feature: archived tournaments (#1112)
fixes https://github.com/evroon/bracket/issues/690
2025-02-09 18:00:52 +01:00
Erik Vroon
558c3163d1 Update pytest asyncio to 0.25.3 (#1110)
Updates the requirements on
[pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) to permit
the latest version.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](pytest-dev/pytest-asyncio@v0.21.2...v0.25.3)
2025-02-08 11:12:32 +00:00
Erik Vroon
d32c36080e Allow changing inputs after creating stage item (#962) 2024-10-26 19:34:08 +02:00
Erik Vroon
388afa585a Make primary key typing stricter (#904) 2024-09-10 20:32:59 +02:00
Erik Vroon
d6449e8d05 Customize rankings (#797)
Allows you to add rankings that specify how the ranking per stage item
is calculated.
Points are now stored per stage item input.
2024-09-07 12:03:16 +02:00
robigan
e3fa10e2a9 Team logos (#529) 2024-02-28 08:41:19 +01:00
Erik Vroon
880d212ce9 Use uuids for logos (#488)
Otherwise uploads can replace current files with the same name.
Also fixes and adds more tests for logo uploads.
2024-02-18 11:24:35 +01:00
Erik Vroon
0c0d99f8fe Write files async (non-blocking) (#485)
Also remove unused files and reload image in frontend when uploading a
new image.
2024-02-17 18:20:01 +01:00
Erik Vroon
61611066cd Pydantic v2 migration (#252)
Upgrade Pydantic to V2.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-09 11:51:14 +01:00
Erik Vroon
469316efd4 Use Ruff format instead of Black (#420) 2024-02-03 14:29:33 +01:00
Erik Vroon
4b3dfb9b20 Implement custom time per match (#337) 2023-11-21 21:11:25 +01:00
Erik Vroon
3dceda218a Time scheduling (#315) 2023-11-07 19:51:46 +01:00
Erik Vroon
ab86f7ea77 Add schedule builder (#267) 2023-11-02 20:34:49 +01:00
Erik Vroon
6c741fd821 Dashboard endpoint (#285) 2023-10-01 11:19:56 +02:00
Erik Vroon
aaca527647 Add courts functionality (#256) 2023-09-12 13:33:20 +02:00
Erik Vroon
731488ec1e Stop using fixed db ids in tests (#203) 2023-05-02 21:21:59 +02:00
Erik Vroon
127f0be934 Add integration tests for users (#174)
Adds various integration tests for users, tournaments and upcoming
matches.
2023-04-16 15:17:48 +02:00
Erik Vroon
dd81c6a83b Improve scheduling (#114) 2023-02-01 16:35:26 +01:00
Erik Vroon
56df31c343 Add test coverage (#61) 2023-01-07 17:27:21 +01:00
Erik Vroon
557debf14c Add tournaments and club endpoints (#43) 2023-01-07 15:00:43 +01:00
Erik Vroon
e77eecb09c Add more integration tests (#41) 2022-12-27 17:27:08 +01:00