Commit Graph

2415 Commits

Author SHA1 Message Date
lovasoa 1c64fd25be increase windows signing timeouts
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql) (push) Has been cancelled
CI / test (mysql) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
CI / docker_build (linux/amd64) (push) Has been cancelled
CI / docker_build (linux/arm/v7) (push) Has been cancelled
CI / docker_build (linux/arm64) (push) Has been cancelled
CI / docker_push (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (.exe, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Create Release / Build sqlpage binaries (Linux) (push) Has been cancelled
Create Release / Build AWS Lambda Serverless zip image (push) Has been cancelled
Create Release / Create Github Release (push) Has been cancelled
Create Release / Publish to crates.io (push) Has been cancelled
v0.37.1
2025-09-24 17:16:40 +02:00
lovasoa ad48c4a6bc Add small SQL parser improvements 2025-09-24 15:36:29 +02:00
lovasoa 298923efb9 Update generator meta tag to include version
The generator meta tag now includes the SQLPage version. This is fetched
from the CARGO_PKG_VERSION environment variable during the build
process.
2025-09-20 20:47:29 +02:00
Ophir LOJKINE 0cf2e9491c Refactor OIDC request handling to streamline callback processing and remove redundant code. Simplify the handling of authenticated user info and improve error logging for OIDC callback parameters. (#1022)
* Refactor OIDC request handling to streamline callback processing and remove redundant code. Simplify the handling of authenticated user info and improve error logging for OIDC callback parameters.

* Refactor OIDC callback processing to use ID token directly, enhancing cookie management and nonce handling. Update logging for successful logins and streamline token claims retrieval.

* Refactor OIDC state management to use a temporary login flow state cookie, enhancing nonce and redirect handling. Update cookie creation and retrieval methods for improved clarity and maintainability.

fixes https://github.com/sqlpage/SQLPage/issues/1014

* Enhance error handling in login flow state parsing by adding context to JSON deserialization failure.

* Fix infinite redirect loop in OIDC login flows when multiple tabs initiate login simultaneously, particularly after inactivity in mobile browsers.

* clippy
2025-09-19 15:39:31 +02:00
lovasoa 0008f5b228 Update dependencies in Cargo.lock to latest versions, remove unused packages, and improve overall package management. 2025-09-19 15:31:18 +02:00
Ophir LOJKINE a451c7e7dc Fix concurrent oidc login cookie overwrites (#1018)
* Refactor OIDC state handling to use separate nonce and redirect cookies

Co-authored-by: contact <contact@ophir.dev>

* Refactor OIDC state management to use separate nonce and redirect cookies

Co-authored-by: contact <contact@ophir.dev>

* Refactor OIDC redirect handling to use updated cookie names and improve error logging

* Update OIDC redirect response to use header constant and simplify cookie creation

* Refactor nonce retrieval in OIDC user info handling to simplify logic and ensure proper token claims processing

* Refactor OIDC cookie handling to introduce a constant for cookie expiration and simplify nonce validation logic

* Refactor OIDC redirect URL cookie retrieval to streamline logic and improve error handling

* Refactor OIDC redirect URL cookie name construction for improved clarity

* fix redirect auth cookie removal

Update OIDC redirect URL cookie path to ensure proper handling after authentication

* Refactor OIDC redirect URL cookie name construction for improved efficiency

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-09-19 11:36:20 +02:00
lovasoa 31a4c29181 file access restrictions: improve error messages 2025-09-15 15:54:52 +02: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
lovasoa b1184b9308 Improve routing error messages 2025-09-15 11:21:27 +02:00
lovasoa 239b572734 clippy 2025-09-15 11:00:27 +02:00
lovasoa 172e0b2e6b Visual html errors for 403 and 429
Refactor HTTP unauthorized response

Use a builder to set the content type and WWW-Authenticate header on the
unauthorized response.

Also, remove unnecessary downcast and improve the handling of
`sqlx::Error::PoolTimedOut`.
2025-09-15 10:58:05 +02:00
lovasoa ab2e068267 OIDC: remove unnecessary ok-wrapping
- Changed return types to avoid unnecessary `Ok()` wrapping.
2025-09-15 10:31:54 +02:00
lovasoa 07c8a03633 Update log component SQL migration to include introduced_in_version field 2025-09-14 01:06:39 +02:00
lovasoa a9b2b2b471 Enhance log component documentation 2025-09-14 00:49:23 +02:00
lovasoa 08cfbcbcfe Rename "priority" to "level" in log handling and update corresponding SQL test file 2025-09-14 00:44:54 +02:00
Ophir LOJKINE c3fcd7b318 Update CHANGELOG.md 2025-09-12 14:22:58 +02:00
Lenardt Gerhardts 68b600595e Feature logger component (#1013)
* implemented logger Component

* changed target for logger to "sqlpage::logger" and made the log::Level case insensitive

* changed error message on missing message key, to be more precise

* changed custom method for String to log::Level conversion to builtin method log::Level::from_str()

* switched to utility method get_object_str and inlined constants

* dynamically target based on file and statement

* disabled ci error (large difference in enum variants) for ResponseWithWriter<S>

* added functionality to work in Header context

* Refactor log component to use compact error handling

* Rename comp_str variable to component_name

* Documented log component

* fixxed missing values statement

* fixxed pipeline errors

* very simple test case for logger

---------

Co-authored-by: Lenardt Gerhardts <lenardt.ger+git@gmail.com>
Co-authored-by: lovasoa <contact@ophir.dev>
2025-09-12 13:38:47 +02:00
lovasoa 1fec20826a Update 47_link.sql 2025-09-10 21:22:41 +02:00
lovasoa 963ec10643 Add missing FROM clause to query example 2025-09-10 21:12:59 +02:00
lovasoa 709ffb60ab Fix submenu scroll issue by enabling autoclose
This is a workaround for https://github.com/sqlpage/SQLPage/issues/1011
until tabler releases the proper fix.
2025-09-09 22:17:15 +02:00
lovasoa 2018478d7a Remove custom scrollbar styling from CSS
fixed upstream
2025-09-09 18:05:00 +02:00
lovasoa 474815244f Update it_works_set_case.sql 2025-09-09 16:22:37 +02:00
lovasoa c685bb6b46 Simplify modal class check condition 2025-09-09 14:33:16 +02:00
lovasoa b04f021d6c Fix handling of NULL values in sqlpage.link
NULL values were encoded as the string `'null'` instead of being omitted
from the link's parameters.
2025-09-08 23:56:18 +02:00
lovasoa 9ff1d9f98b Add test case for SET case expression 2025-09-08 23:43:09 +02:00
lovasoa 8c89673531 Merge remote-tracking branch 'refs/remotes/origin/main' 2025-09-08 22:19:26 +02:00
Ophir LOJKINE ddce6896f1 add support for UUID (#1009)
* update deps

* Fix: Decode Postgres UUID values

Also includes: - Upgrade sqlx-oldapi to 0.6.48 - Add uuid feature to
sqlx

fixes https://github.com/sqlpage/SQLPage/issues/1008

* Update sqlx-oldapi dependencies to 0.6.48

* also decode mssql uuid

* Fix: Convert unique identifier to lowercase in test
2025-09-07 23:58:58 +02:00
lovasoa fa174eb6aa update deps 2025-09-07 18:01:13 +02:00
Ophir LOJKINE d8106e8491 Sign windows build with signpath.io (#990)
Create Release / Build sqlpage binaries (macOS & Windows) (.exe, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Create Release / Build sqlpage binaries (Linux) (push) Has been cancelled
Create Release / Build AWS Lambda Serverless zip image (push) Has been cancelled
Create Release / Create Github Release (push) Has been cancelled
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql) (push) Has been cancelled
CI / test (mysql) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
CI / docker_build (linux/amd64) (push) Has been cancelled
CI / docker_build (linux/arm/v7) (push) Has been cancelled
CI / docker_build (linux/arm64) (push) Has been cancelled
CI / docker_push (push) Has been cancelled
Create Release / Publish to crates.io (push) Has been cancelled
* Sign windows build with signpath.io

Thanks to signpath.io for providing us with a free windows signing certificate !

- Added permissions for actions read access.
- Implemented unsigned artifact upload for Windows.
- Integrated SignPath for signing requests and added signed artifact upload.
- Updated non-Windows artifact upload process.

* release signing + link to signpath from README
v0.37.0
2025-09-02 15:48:40 +02:00
lovasoa 9a0cd6751e fix: simplify mime type 2025-09-01 10:11:34 +02:00
lovasoa c5fbb4be54 form select: loose equality testing for option values
the form component now considers numbers and their string representation as equal when comparing the `value` parameter and the values from the `options` parameter in dropdowns

see https://github.com/sqlpage/SQLPage/discussions/1002
2025-08-30 18:16:53 +02:00
lovasoa 2b8c51504f fix: simplify error message for database connection issues 2025-08-30 17:25:06 +02:00
lovasoa b85bf2c9ea fix: enhance error message clarity for database connection failures 2025-08-30 17:23:44 +02:00
lovasoa 637f198b57 error handling: improve visual presentation of error messages
- Updated error messages to be more user-friendly and visually appealing in the browser.
- Introduced a new method for retrieving static files from the cache.
- Improved error reporting for invalid UTF-8 encoding in SQL files.
2025-08-30 17:16:13 +02:00
lovasoa bb722d9e71 move http error handling to a dedicated module 2025-08-30 14:48:47 +02:00
lovasoa 50bad4e2e9 refactor: pass the full app state to the error response generation function
this will allow creating more user-friendly errors
2025-08-30 14:24:12 +02:00
lovasoa d14c38c021 quote file name in errors 2025-08-30 13:53:13 +02:00
lovasoa 3bd5dff44a early errors: set the charset in http headers 2025-08-30 13:52:50 +02:00
lovasoa 9320b16dca better errors for invalid character encoding in SQL files 2025-08-30 13:51:48 +02:00
Ophir LOJKINE 60ab81cb1c blob support: decode binary database values as data URLs (#1005)
* feat: Enhanced BLOB support across all database backends

- Add comprehensive BLOB support for all supported databases:
  * PostgreSQL: BYTEA columns with data URL conversion
  * MySQL/MariaDB: BLOB columns with data URL conversion
  * MSSQL: VARBINARY, BIGVARBINARY, BINARY, IMAGE columns
  * SQLite: BLOB columns with data URL conversion

- Create shared data URL conversion functions to eliminate code duplication
- Add comprehensive tests for all database types
- Update CHANGELOG.md with detailed feature description

- All blob data is now consistently converted to data URLs with base64 encoding
- Cross-database compatibility ensures identical blob behavior across all backends
- Comprehensive testing validates functionality across PostgreSQL, MySQL, MariaDB, MSSQL, and SQLite

* update changelog

* fmt

* fix: Address clippy linter issues

- Change blob function parameters from Vec<u8> to &[u8] to avoid unnecessary copying
- Use inline format args in data URL construction
- Update function calls to borrow parameters correctly
- Maintain backward compatibility and functionality

* feat: Add smart MIME type detection for BLOB data

- Implement automatic MIME type detection based on file signatures (magic bytes)
- Support common file formats: PNG, JPEG, GIF, BMP, WebP, SVG, PDF, DOCX, XLSX, PPTX, JSON, XML, ZIP
- Automatic fallback to 'application/octet-stream' for unknown formats
- Update CHANGELOG.md with comprehensive feature description
- Add comprehensive tests for MIME type detection functionality

- BLOB data now automatically returns appropriate data URLs:
  * PNG files: 'data:image/png;base64,...'
  * PDF files: 'data:application/pdf;base64,...'
  * SVG files: 'data:image/svg+xml;base64,...'
  * Unknown files: 'data:application/octet-stream;base64,...'

- Improves user experience by providing correct MIME types for downloads and displays
- Eliminates need for manual MIME type specification in most cases

* refactor: Make MIME type detection more concise

- Use bytes.starts_with() for cleaner magic byte detection
- Remove verbose comments for each MIME type
- Maintain same functionality with cleaner, more readable code
- Reduce code duplication and improve maintainability

* refactor: Improve MIME type detection with byte strings

- Use byte string literals (b"string") for better readability
- Remove UTF-8 parsing for text-based formats, use direct byte comparisons
- Maintain same functionality with cleaner, more performant code
- PNG: b"\x89PNG\r\n\x1a\n" instead of hex arrays
- JPEG: b"\xFF\xD8" instead of [0xFF, 0xD8]
- Text formats: Direct byte matching without String::from_utf8_lossy
- Update all tests to use new byte string format

* refactor: Extract MIME type detection into separate module

- Create new mime_detection.rs module for better code organization
- Move detect_mime_type() function and tests to dedicated module
- Update sql_to_json.rs to import from mime_detection module
- Remove unused import from functions.rs
- Maintain same functionality with improved code structure

Benefits:
- Better separation of concerns
- Improved code organization and maintainability
- Easier to extend MIME detection in the future
- Cleaner module boundaries

File changes:
- NEW: src/webserver/database/mime_detection.rs (MIME detection + tests)
- MOD: src/webserver/database/mod.rs (add mime_detection module)
- MOD: src/webserver/database/sql_to_json.rs (use mime_detection module)
- MOD: src/webserver/database/sqlpage_functions/functions.rs (remove unused import)

* refactor: Rename mime_detection.rs to blob_to_data_url.rs

- Rename module from mime_detection to blob_to_data_url for better clarity
- Follow project naming conventions (similar to sql_to_json.rs)
- Update all imports and references to use new module name
- Maintain same functionality with improved code organization

File changes:
- RENAMED: src/webserver/database/mime_detection.rs → src/webserver/database/blob_to_data_url.rs
- MOD: src/webserver/database/mod.rs (update module declaration)
- MOD: src/webserver/database/sql_to_json.rs (update import path)
- MOD: src/webserver/database/sqlpage_functions/functions.rs (update import path)

* move

- Add #[must_use] attribute to detect_mime_type for better usage indication
- Replace empty byte check with is_empty() for clarity
- Update tests for improved readability with formatted assertions
- Remove unnecessary blank lines in sql_to_json.rs

Benefits:
- Improved code clarity and maintainability
- Enhanced test readability

* remove old file

* refactor: Update sql_to_json.rs to use new blob_to_data_url module

- Replace direct call to vec_to_data_uri_value with updated import from blob_to_data_url
- Remove deprecated vec_to_data_uri and vec_to_data_uri_value functions for cleaner code
- Maintain existing functionality while improving code organization

* refactor: Simplify MIME type detection logic in blob_to_data_url.rs

- Remove unnecessary empty byte check and streamline conditions for text-based formats
- Enhance readability by consolidating checks for XML and JSON formats
- Maintain existing functionality while improving code clarity

* clippy

* Update documentation for BLOB support and data type handling

- CHANGELOG.md : details on BLOB support and automatic MIME type detection
- Add examples in extensions-to-sql.md illustrating data type conversions and JSON object structure
- Update SQL examples in migrations to reflect new BLOB handling capabilities
2025-08-30 09:02:32 +02:00
lovasoa 15c0d2411a chore: update dependencies in Cargo.lock
- Bump versions for several packages including actix-http, bitflags, cc, clap, and others.
- Update checksums to reflect the new versions.
- Ensure compatibility with the latest features and fixes from the updated packages.
2025-08-28 22:50:01 +02:00
lovasoa b0dadea0ae feat: add download component
- Introduce a new download component to facilitate file downloads.
- Implement download handling in the header context, supporting data URLs.
- Add a test for the download functionality to ensure correct behavior.

see https://github.com/sqlpage/SQLPage/discussions/996
2025-08-28 22:43:53 +02:00
lovasoa f3189665af add a title to the security page 2025-08-28 09:49:47 +02:00
lovasoa 653f4ad512 add a title to the performance page 2025-08-28 09:45:57 +02:00
lovasoa 5e723f8e22 fix: missing title in functions documentation 2025-08-28 09:43:57 +02:00
lovasoa a76acd74d0 feat: modals have their own URL
- Allow opening modals with a simple link, enabling triggering from
other components. - Persist modal state across page refreshes using URL
hash.
2025-08-27 17:30:27 +02:00
lovasoa 0ddcc355d9 fix official site carousel captions color 2025-08-26 21:30:26 +02:00
lovasoa c8fdf82349 better warning for $var and :var conflicts
Add a specific warning when a URL parameter and a form field have the
same name. The previous general warning about referencing form fields
with the `$var` syntax was confusing in that case.

see https://github.com/sqlpage/SQLPage/discussions/1001
2025-08-26 20:49:11 +02:00
lovasoa c03c3d4cc6 refactor: Clarify SSO documentation and user claims access
- Simplify the explanation of default page protection with SSO enabled.
- Emphasize accessing user claims to tailor user experience based on identity.
2025-08-25 16:19:20 +02:00