12 Commits

Author SHA1 Message Date
Prayag Bhakar 6fb9a35336 fix(rust): enforce lint on all files + fix lint issues (#1394) 2026-08-21 07:38:45 +02:00
Ophir LOJKINE d92a7399e2 fix: enforce unprivileged path guard on fresh cache hits (#1307)
Reserved/private SQL files (sqlpage/ prefix, dotfiles, .. traversal,
absolute paths) became directly routable over HTTP while their parsed
form was fresh in sql_file_cache. A trusted page loading such a file via
sqlpage.run_sql(...) loads it with privilege and caches it; a later
direct unprivileged request hit the fresh cache entry before the path
guard ran, returning 200 and executing the private SQL instead of 403.

The unprivileged path validation is extracted into
filesystem::validate_unprivileged_path and now enforced before
consulting the cache in both HTTP routing (AppFileStore::contains) and
the unprivileged FileCache::get_with_privilege path.
2026-06-10 16:37:20 +02:00
lovasoa 1af44a79d0 fmt 2026-04-13 02:44:47 +02:00
Ophir LOJKINE 3af82f4857 Fix http header only page crashes (#1253)
Return errors early on invalid header values
2026-03-17 16:13:11 +01:00
Ophir LOJKINE 3eb527490e Fix HTTP status mapping for client request errors (#1240) 2026-03-13 11:11:12 +01:00
lovasoa 7399b1084a Fix basic auth test assertions
Use "Unauthorized" instead of "not authorized" to match the expected
response.

Add tests for basic auth error cases.
2025-09-15 14:01:28 +02:00
lovasoa ddd52fd74c Refactor unauthorized response
Use ErrorWithStatus for unauthorized errors to set the WWW-Authenticate
header.
2025-09-15 11:34:23 +02:00
Ophir LOJKINE 33125565d3 Check for 404 before redirecting on no-extension paths (#972)
* Check for 404 before redirecting on no-extension paths

The commit improves routing logic by checking if a path would result in
a 404

fixes https://github.com/sqlpage/SQLPage/issues/971 before adding a
trailing slash. This prevents unnecessary redirects when a custom 404
handler exists.

* Fix test function signature formatting in routing module (#973)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* Simplify path resolution and redirect logic

The shorter code more clearly handles finding files with .sql extensions
and decides whether to add trailing slashes based on index file
presence.

* clippy

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-28 17:54:23 +02:00
lovasoa 7da1b2882a implement default 404 error page
... and update routing logic to serve it; remove old 404 handling code; add tests for new behavior
2025-05-29 22:44:22 +02:00
lovasoa 2d307fa6f0 move 404 test 2025-05-25 23:31:58 +02:00
lovasoa acdc03891d clippy fixes 2025-05-25 23:22:41 +02:00
lovasoa 5cbd12fcfd reorganize tests: better structure 2025-05-25 23:20:31 +02:00