Commit Graph

2937 Commits

Author SHA1 Message Date
github-actions[bot] 26963a8464 docs(changelog): update changelog [skip ci] 2026-03-23 16:16:55 +00:00
Christian Krakau-Louis 88368f7f76 Merge pull request #809 from christianlouis/security/fix-sql-injection-db-migrate-320708476140781345
🔒 Fix SQL Injection Vulnerability in Database Migration Preview
2026-03-23 17:16:07 +01:00
Christian Krakau-Louis 7fbcf5c593 Merge pull request #810 from christianlouis/add-send-to-dropbox-tests-794836455840300562
🧪 Add explicit tests for send_to_dropbox_endpoint
2026-03-23 17:15:49 +01:00
Christian Krakau-Louis cfcce57e35 Merge pull request #812 from christianlouis/refactor-filename-regex-constant-13933144971632372772
Refactor filename regex to shared constant (v2)
2026-03-23 17:15:34 +01:00
Christian Krakau-Louis 10297ede37 Merge branch 'main' into refactor-filename-regex-constant-13933144971632372772 2026-03-23 17:15:24 +01:00
github-actions[bot] 78bd5b5904 docs(changelog): update changelog [skip ci] 2026-03-23 16:15:23 +00:00
Christian Krakau-Louis 9153b1f7f0 Merge pull request #814 from christianlouis/sentinel-ssrf-imap-9566695902417221069
🛡️ Sentinel: [HIGH] Fix Server-Side Request Forgery in IMAP connections
2026-03-23 17:15:00 +01:00
Christian Krakau-Louis f9b4975093 Merge branch 'main' into sentinel-ssrf-imap-9566695902417221069 2026-03-23 17:14:50 +01:00
github-actions[bot] cc5e879ea9 docs(changelog): update changelog [skip ci] 2026-03-23 16:07:58 +00:00
Christian Krakau-Louis 7490462c67 Merge pull request #818 from christianlouis/sentinel/fix-path-traversal-3335474446649715249
🛡️ Sentinel: [CRITICAL] Fix path traversal vulnerability in file utilities
2026-03-23 17:07:36 +01:00
Christian Krakau-Louis c25e1b0e21 Merge branch 'main' into sentinel/fix-path-traversal-3335474446649715249 2026-03-23 17:07:30 +01:00
google-labs-jules[bot] a10f8e628e 🔒 Fix SQL injection in database migration and resolve merge conflicts
This commit safely handles the dynamic table names in database migration queries
by leveraging `sqlalchemy.select` and `sqlalchemy.table` in `app/utils/db_migrate.py`.
It addresses the `# noqa: S608` exception that was in place for string interpolation
SQL queries which are a known security anti-pattern.

Additionally, this commit includes the latest updates to `app/views/base.py`
from the `main` branch to handle backward compatibility across Starlette
versions (<1.0 vs 1.0+) when invoking `Jinja2Templates.TemplateResponse`,
resolving previous merge conflicts in the PR.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 15:56:34 +00:00
google-labs-jules[bot] 1018ea17d9 🛡️ Sentinel: [CRITICAL] Fix path traversal vulnerability in file utilities
🚨 Severity: CRITICAL
💡 Vulnerability: The generic file hashing utility `app/utils/file_operations.py:hash_file` was vulnerable to path traversal. An attacker controlling the `filepath` argument could read arbitrary files on the system by passing relative paths like `../../../etc/passwd` or providing absolute paths directly.
🎯 Impact: This could lead to Arbitrary File Read and potential information disclosure.
🔧 Fix: Used `pathlib.Path.resolve()` to resolve both the target file path and the allowed base directory (`settings.workdir`). Added a strict check to ensure the resolved target path is strictly within the allowed boundary using `filepath_obj.relative_to(workdir_obj)`, catching the `ValueError` raised when the path is out of bounds. This safely blocks both relative traversal attacks and arbitrary absolute paths, without breaking legitimate relative application paths.
 Verification: Ran the test suite `pytest tests/test_path_traversal_security.py -v` successfully, which explicitly checks for `FileNotFoundError` upon traversal attempts.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 15:53:18 +00:00
google-labs-jules[bot] 28d4bced0c 🛡️ Sentinel: [HIGH] Fix Server-Side Request Forgery in IMAP connections
🚨 Severity: HIGH
💡 Vulnerability: User-provided IMAP `host` in `_test_imap_connection` and `pull_inbox` was not validated against private IPs, creating an SSRF risk.
🎯 Impact: Attackers could abuse the endpoints to port-scan or interact with internal/private network services.
🔧 Fix: Integrated `is_private_ip` from `app.utils.network` to block connections resolving to private, loopback, link-local, or reserved IPs.
 Verification: Ran `test_imap_tasks.py` and `test_api_imap_accounts.py` successfully. Checked `ruff` output and diffs. Removed all scratch files from the commit.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:58:49 +00:00
google-labs-jules[bot] d22175310a 🛡️ Sentinel: [HIGH] Fix Server-Side Request Forgery in IMAP connections
🚨 Severity: HIGH
💡 Vulnerability: User-provided IMAP `host` in `_test_imap_connection` and `pull_inbox` was not validated against private IPs, creating an SSRF risk.
🎯 Impact: Attackers could abuse the endpoints to port-scan or interact with internal/private network services.
🔧 Fix: Integrated `is_private_ip` from `app.utils.network` to block connections resolving to private, loopback, link-local, or reserved IPs.
 Verification: Ran `test_imap_tasks.py` and `test_api_imap_accounts.py` successfully. Checked `ruff` output and diffs. Removed all scratch files from the commit.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:45:22 +00:00
google-labs-jules[bot] 7755f5a1ed 🔒 Fix potential SQL injection in database migration preview
The `preview_migration` function in `app/utils/db_migrate.py` used string
interpolation to dynamically execute a COUNT query on the source database
(`f"SELECT COUNT(*) FROM {quoted_table}"`).

While the table name was quoted via the dialect's identifier preparer and
validated with a regex, string interpolation for raw SQL should be avoided
as it represents an anti-pattern and a theoretical risk for SQL injection
if validation controls are ever bypassed or modified.

This commit replaces the raw string interpolation with safe, parameterized
SQLAlchemy Core query construction `select(func.count()).select_from(table(table_name))`,
which automatically handles table quoting and execution safely. It also removes
the unused `text` import to keep the code clean.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:44:48 +00:00
github-actions[bot] 0497fbbbad docs(changelog): update changelog [skip ci] 2026-03-23 14:40:10 +00:00
Christian Krakau-Louis a4bd1d7178 Merge pull request #811 from christianlouis/fix-test-api-process-assertions-2136380211698614662
🧪 Add assertions for task enqueuing parameters in process tests
2026-03-23 15:39:48 +01:00
Christian Krakau-Louis d94e9ca4bc Merge branch 'main' into sentinel-ssrf-imap-9566695902417221069 2026-03-23 15:39:29 +01:00
Christian Krakau-Louis 82c6915c42 Merge branch 'main' into refactor-filename-regex-constant-13933144971632372772 2026-03-23 15:38:35 +01:00
google-labs-jules[bot] d71945b7b9 🛡️ Sentinel: [HIGH] Fix Server-Side Request Forgery in IMAP connections
🚨 Severity: HIGH
💡 Vulnerability: User-provided IMAP `host` in `_test_imap_connection` and `pull_inbox` was not validated against private IPs, creating an SSRF risk.
🎯 Impact: Attackers could abuse the endpoints to port-scan or interact with internal/private network services.
🔧 Fix: Integrated `is_private_ip` from `app.utils.network` to block connections resolving to private, loopback, link-local, or reserved IPs.
 Verification: Ran `test_imap_tasks.py` and `test_api_imap_accounts.py` successfully. Checked `ruff` output and diffs.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:38:34 +00:00
google-labs-jules[bot] 91f36e0d5a refactor(tasks): extract filename regex to shared constant
Move the valid filename regex pattern to a shared constant in `app/utils/filename_utils.py` and update both the task logic and security tests to use it. This eliminates duplication and ensures consistency across the codebase.

Normalized line endings in `app/tasks/extract_metadata_with_gpt.py` from CRLF to LF to ensure consistency and prevent CI issues.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:31:12 +00:00
google-labs-jules[bot] 1e69c55947 🐛 Fix FastAPI template rendering backward compatibility bug
The transition to a newer FastAPI/Starlette version changed the signature of `Jinja2Templates.TemplateResponse` from `(name, context)` to `(request, name, context)`.

The `app/views/base.py:template_response_with_version` wrapper naively forwarded positional arguments `*args` to `original_template_response`. This caused the template name (`"files.html"`) to be passed as the `request` parameter, and the context dictionary to be passed as the `name` parameter. This resulted in Jinja2 attempting to cache the template using a dictionary as the cache key, which triggered a `TypeError: unhashable type: 'dict'`.

This commit updates the wrapper to automatically translate the legacy positional arguments `(name: str, context: dict)` into the explicit keyword arguments `request=context.get("request"), name=name, context=context` required by modern Starlette, preventing template rendering crashes across the application and restoring passing CI test suites.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:31:06 +00:00
google-labs-jules[bot] 9b748db4d4 refactor(tasks): extract filename regex to shared constant
Move the valid filename regex pattern to a shared constant in `app/utils/filename_utils.py` and update both the task logic and security tests to use it. This eliminates duplication and ensures consistency across the codebase.

Also normalized line endings to LF in affected files to ensure CI compatibility.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:23:31 +00:00
google-labs-jules[bot] eeae47ddec test: add assertions for task enqueuing parameters
Added `mock_task.delay.assert_called_once_with(str(test_file))` to all integration tests involving background task enqueuing in `app/api/process.py` endpoints to ensure background tasks are called with the correct file path arguments.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:23:12 +00:00
google-labs-jules[bot] be500e1a2b Add explicit tests for send_to_dropbox_endpoint
Adds missing unit tests for the send_to_dropbox_endpoint in app/api/process.py, covering both success (queued) and error (file not found) states to ensure better robustness and API reliability.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:20:59 +00:00
github-actions[bot] 45d3ac8cf0 docs(changelog): update changelog [skip ci] 2026-03-23 14:12:41 +00:00
Christian Krakau-Louis 4df4673628 Merge pull request #807 from christianlouis/sentinel-fix-ssrf-dns-resolution-16520734505214840647
🛡️ Sentinel: [HIGH] Fix SSRF bypass on DNS resolution failure
2026-03-23 15:12:16 +01:00
github-actions[bot] 9642020887 chore(release): update build metadata files [skip ci] 2026-03-23 14:11:26 +00:00
semantic-release 89dec45062 0.172.2
Automatically generated by python-semantic-release
2026-03-23 14:11:22 +00:00
Christian Krakau-Louis 34457f9775 Merge pull request #805 from christianlouis/copilot/fix-image-build-failure
fix(build): remove --omit=dev from npm ci in Dockerfile frontend-builder stage
2026-03-23 15:10:59 +01:00
google-labs-jules[bot] 1d9bd15a70 🔒 Fix potential SQL injection in database migration preview
The `preview_migration` function in `app/utils/db_migrate.py` used string
interpolation to dynamically execute a COUNT query on the source database
(`f"SELECT COUNT(*) FROM {quoted_table}"`).

While the table name was quoted via the dialect's identifier preparer and
validated with a regex, string interpolation for raw SQL should be avoided
as it represents an anti-pattern and a theoretical risk for SQL injection
if validation controls are ever bypassed or modified.

This commit replaces the raw string interpolation with safe, parameterized
SQLAlchemy Core query construction `select(func.count()).select_from(table(table_name))`,
which automatically handles table quoting and execution safely. It also removes
the unused `text` import to keep the code clean.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 14:06:18 +00:00
google-labs-jules[bot] 8b4280d5dd 🛡️ Sentinel: [HIGH] Fix SSRF bypass on DNS resolution failure
Modified `is_private_ip` in `app/utils/network.py` to fail securely by returning True (blocking the request) when a hostname cannot be resolved. The previous implementation failed open, creating a risk for Server-Side Request Forgery (SSRF) and DNS rebinding attacks.

Updated corresponding tests to expect the secure behavior.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-23 13:42:14 +00:00
copilot-swe-agent[bot] 93629ff440 fix: update test assertions and lint fixes for Starlette 1.0 TemplateResponse API
Update test mocks to check kwargs["context"] instead of positional
args[1] for tests that verify auth.py and base.py wrapper behavior.
Fix B026 lint error by avoiding star-arg after keyword argument.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/7b5f7e0d-89ad-43be-b68d-a9c0c5407a7e
2026-03-23 13:14:25 +00:00
copilot-swe-agent[bot] c4e10bee5e fix: adapt TemplateResponse calls to Starlette 1.0 new-style API
Starlette 1.0.0 changed TemplateResponse signature from
(name, context_dict) to (request, name, context=dict).

- Update base.py wrapper to convert old-style calls to new-style
- Update main.py error handler TemplateResponse calls
- Update local_auth.py, billing.py, auth.py, share.py calls
- Update test mocks for new calling convention

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/7b5f7e0d-89ad-43be-b68d-a9c0c5407a7e
2026-03-23 12:50:09 +00:00
github-actions[bot] 084171395d docs(changelog): update changelog [skip ci] 2026-03-23 12:17:55 +00:00
Christian Krakau-Louis 958b195e79 Merge pull request #806 from christianlouis/alert-autofix-400
Potential fix for code scanning alert no. 400: Clear-text logging of sensitive information
2026-03-23 13:17:29 +01:00
Christian Krakau-Louis c5ef1ec50c Potential fix for code scanning alert no. 400: Clear-text logging of sensitive information
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-03-23 13:17:19 +01:00
copilot-swe-agent[bot] b4e0067a27 fix(build): remove --omit=dev from npm ci in Dockerfile frontend-builder stage
The Tailwind CSS CLI is a devDependency in frontend/package.json. Using
`npm ci --omit=dev` skipped installing it, causing the Docker build to
fail with 'sh: tailwindcss: not found' at the `npm run build` step.

Since this is a multi-stage build where the frontend-builder stage is
discarded after compilation, all dependencies (including devDependencies)
are needed during the build but do not bloat the final image.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/f16fabb4-4d8c-48e3-8d26-c2d38cc7129f
2026-03-22 18:54:52 +00:00
copilot-swe-agent[bot] 6188003897 Initial plan 2026-03-22 18:48:13 +00:00
github-actions[bot] ef897f660d chore(release): update build metadata files [skip ci] 2026-03-22 18:47:10 +00:00
semantic-release 6cb9feacab 0.172.1
Automatically generated by python-semantic-release
2026-03-22 18:47:07 +00:00
Christian Krakau-Louis 76c0e91500 Merge pull request #804 from christianlouis/copilot/enable-qr-code-upload
fix: social login providers load from DB without restart; connections page shows accurate linked status
2026-03-22 19:46:48 +01:00
copilot-swe-agent[bot] 0c7ea6748d fix: social login providers now work from DB config without restart
- Extract all OAuth registration into _setup_social_providers() with a
  _register_oauth_client() helper that clears the authlib _clients cache
  so credentials can change without a restart
- Add refresh_social_providers() public function called after every
  settings reload (lifespan startup + settings_sync live reload)
- Fix connections page linked status to use _get_effective() (DB-aware)
  instead of the stale startup-time SOCIAL_PROVIDERS dict
- Fix oauth_configured template variable similarly
- Add tests: DB-driven linked status, stale-provider clearing,
  register_oauth_client cache-clear, refresh function coverage

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/ef15910f-fd25-469a-814b-9e1fb40659c9
2026-03-22 18:42:18 +00:00
github-actions[bot] 78077fa8c7 chore(release): update build metadata files [skip ci] 2026-03-22 18:24:56 +00:00
semantic-release 242846aa9c 0.172.0
Automatically generated by python-semantic-release
2026-03-22 18:24:52 +00:00
Christian Krakau-Louis 868613ac49 Merge pull request #802 from christianlouis/copilot/migrate-tailscale-to-3-x
feat(ui): migrate Tailwind CSS from v2 CDN to compiled v3 production build
2026-03-22 19:24:31 +01:00
copilot-swe-agent[bot] 33a0e49acd Initial plan 2026-03-22 18:21:40 +00:00
copilot-swe-agent[bot] 14b3031e63 feat(ui): replace Tailwind CSS CDN with compiled v3 production build
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/85d2244d-170a-48d3-8f6b-b4c124a49ed9
2026-03-22 18:07:32 +00:00
copilot-swe-agent[bot] 1d7df13c94 feat(ui): migrate Tailwind CSS from v2 CDN to v3 Play CDN (interim step)
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/85d2244d-170a-48d3-8f6b-b4c124a49ed9
2026-03-22 17:50:11 +00:00