Commit Graph

3035 Commits

Author SHA1 Message Date
Christian Krakau-Louis 3bd8a52ea2 Merge pull request #836 from christianlouis/sentinel/fix-s3-ssrf-vulnerability-8738702433604673313
🛡️ Sentinel: [HIGH] Fix SSRF in S3 connection test endpoint_url
2026-04-07 11:34:28 +02:00
Christian Krakau-Louis 789e8c6236 Merge pull request #840 from christianlouis/sentinel/ssrf-redirect-bypass-15997970627137004397
🛡️ Sentinel: [HIGH] Fix SSRF bypass via HTTP redirects in url_upload
2026-04-07 11:34:11 +02:00
Christian Krakau-Louis a3ea215a1c Merge branch 'main' into sentinel/ssrf-redirect-bypass-15997970627137004397 2026-04-07 11:33:59 +02:00
github-actions[bot] c6e0b80bec docs(changelog): update changelog [skip ci] 2026-04-07 09:33:42 +00:00
Christian Krakau-Louis e86e1b9f13 Merge pull request #845 from christianlouis/sentinel-ssrf-httpx-redirect-fix-3175117423198883580
🛡️ Sentinel: [HIGH] Fix SSRF bypass via httpx redirects in /process-url
2026-04-07 11:33:11 +02:00
google-labs-jules[bot] 46a9a30af0 🛡️ Sentinel: [HIGH] Fix SSRF bypass via httpx redirects
🚨 Severity: HIGH
💡 Vulnerability: The `/process-url` endpoint used `httpx.AsyncClient` with `follow_redirects=True`. While the initial user-provided URL was validated against SSRF protections (blocking private/internal IPs), the client implicitly followed subsequent HTTP redirects without validating their target locations. This allowed an attacker to bypass the initial check by supplying a valid URL that redirected to an internal IP or cloud metadata endpoint.
🎯 Impact: An attacker could potentially access internal network services or cloud metadata endpoints.
🔧 Fix: Implemented an `event_hooks` listener (`validate_redirect`) on the `httpx.AsyncClient` that intercepts responses, extracts the `Location` header, resolves the absolute target URL, and applies the same `validate_url_safety` check before allowing the redirect to be followed.
 Verification: Ran `pytest tests/test_url_upload.py`, formatting checks via `ruff format` and linting via `ruff check`.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-04-06 02:55:58 +00:00
google-labs-jules[bot] bdfa3ba1e0 style: sort imports in test_url_upload.py
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-30 03:31:23 +00:00
github-actions[bot] 8295279ec9 style: apply ruff auto-fix
- Auto-formatted code with ruff format
- Applied ruff linting fixes with --fix

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-30 03:24:20 +00:00
google-labs-jules[bot] 152ee15b06 test: add coverage for url_upload redirect SSRF bypass prevention hook
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-30 03:23:56 +00:00
google-labs-jules[bot] a75e8b9297 🛡️ Sentinel: [HIGH] Fix SSRF bypass via HTTP redirects in url_upload
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-30 03:02:05 +00:00
google-labs-jules[bot] 925864ddca Close as obsolete
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-27 14:51:28 +00:00
copilot-swe-agent[bot] 57db4c7c82 fix(api): resolve merge conflicts, add type safety for endpoint_url in S3 connection test
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/8a9f717e-a6cb-45f0-8f2a-0e5d1d404657

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-27 14:50:51 +00:00
copilot-swe-agent[bot] 35752c9092 fix(api): resolve merge conflicts, add type safety for endpoint_url in S3 connection test
- Resolve merge conflicts with main (PR #834 also fixed S3 SSRF)
- Add isinstance(endpoint_url, str) type check before urlparse to prevent TypeError on non-string values
- Reject endpoint_url with empty/missing hostname after parsing (malformed URLs like 'https://')
- Keep scheme validation (http/https only) and private IP blocking via is_private_ip()
- Add logger.warning for SSRF block events
- Add regression tests: non-string endpoint_url and empty hostname cases
- Update sentinel.md with consolidated SSRF entry

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-27 14:48:52 +00:00
github-actions[bot] 9b9882c4d6 docs(changelog): update changelog [skip ci] 2026-03-27 14:24:59 +00:00
Christian Krakau-Louis 6a77533795 Merge pull request #834 from christianlouis/fix-ssrf-integrations-8041414258112165107
🛡️ Sentinel: [HIGH] Fix SSRF in integrations connection test
2026-03-27 15:24:36 +01:00
github-actions[bot] 69053bfb08 docs(changelog): update changelog [skip ci] 2026-03-27 14:21:42 +00:00
Christian Krakau-Louis f1cf5d0e76 Merge pull request #835 from christianlouis/dependabot/npm_and_yarn/frontend/multi-bf05dc1ecf
Bump picomatch in /frontend
2026-03-27 15:21:16 +01:00
google-labs-jules[bot] c547ad1acc 🛡️ Sentinel: [HIGH] Fix SSRF vulnerability in S3 connection test endpoint_url
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-27 04:18:28 +00:00
dependabot[bot] 1625896e30 Bump picomatch in /frontend
Bumps  and [picomatch](https://github.com/micromatch/picomatch). These dependencies needed to be updated together.

Updates `picomatch` from 2.3.1 to 2.3.2
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

Updates `picomatch` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-26 08:41:48 +00:00
google-labs-jules[bot] 470f08d893 test: add tests for SSRF validation in integrations
Adds missing unit tests for `_test_imap_connection` and `_test_s3_connection` to cover the new `is_private_ip()` SSRF blocking logic and satisfy Codecov checks.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-26 04:18:24 +00:00
google-labs-jules[bot] a57766ed7e 🛡️ Sentinel: [HIGH] Fix SSRF in integrations connection test
Adds validation using `is_private_ip()` for user-provided hosts in `_test_imap_connection` and `_test_s3_connection` to prevent Server-Side Request Forgery vulnerabilities.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-26 04:00:55 +00:00
github-actions[bot] 76f202f7f1 docs(changelog): update changelog [skip ci] 2026-03-25 09:53:14 +00:00
Christian Krakau-Louis 33484b236a Merge pull request #833 from christianlouis/copilot/fix-pygments-vulnerability
chore(ci): suppress CVE-2026-4539 (pygments ReDoS) in pip-audit until upstream fix ships
2026-03-25 10:52:53 +01:00
copilot-swe-agent[bot] 6927e7643f chore(ci): ignore CVE-2026-4539 in pip-audit until pygments releases a fix
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/47fb37db-2146-4550-aeb2-60adfd2a8b6a
2026-03-25 09:20:01 +00:00
copilot-swe-agent[bot] aeb50c21d2 Initial plan 2026-03-25 09:17:32 +00:00
github-actions[bot] 45e41338dc chore(release): update build metadata files [skip ci] 2026-03-25 07:54:31 +00:00
semantic-release f0d3563029 0.172.8
Automatically generated by python-semantic-release
2026-03-25 07:54:28 +00:00
Christian Krakau-Louis 12a35f9b30 Merge pull request #832 from christianlouis/copilot/fix-save-settings-env-not-found 2026-03-25 08:54:06 +01:00
copilot-swe-agent[bot] 4136033bf0 fix(api): track env_file_written accurately in save_google_drive_settings
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/df99f308-d964-4732-88b7-a01be6aeee05
2026-03-24 20:24:35 +00:00
copilot-swe-agent[bot] 48331f6e91 fix(tests): restore correct route URLs and fix auth/exception handling broken by d221753
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/df99f308-d964-4732-88b7-a01be6aeee05
2026-03-24 20:22:18 +00:00
copilot-swe-agent[bot] cafc0e4523 fix(tests): add admin override fixture to TestSaveDropboxSettings
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/916d85bf-aa2d-48bb-ad46-2672a641d6fe
2026-03-24 18:09:54 +00:00
copilot-swe-agent[bot] a2c9915908 Initial plan 2026-03-24 18:03:54 +00:00
github-actions[bot] c3124b08bd docs(changelog): update changelog [skip ci] 2026-03-24 12:18:06 +00:00
Christian Krakau-Louis 4faba2ec08 Merge pull request #831 from christianlouis/copilot/restoremobile-pre-d2217531
[WIP] Restore mobile directory to state before commit d22175310
2026-03-24 13:17:43 +01:00
copilot-swe-agent[bot] 2f3c22000c restore(mobile): restore mobile/ directory to pre-d2217531 state
Restored mobile/ from d22175310a711e7ebdd8062ae29a54f0136dc3f6^
(parent commit d94e9ca4bc).

Commit d22175310a (google-labs-jules[bot], 2026-03-23T14:45:22Z) introduced
an SSRF security fix for IMAP connections but unintentionally deleted or
truncated a large number of files across the repository, including 24 files
under mobile/.

This commit targets only the mobile/ directory and restores the following
files to their pre-d2217531 state:

- mobile/README.md
- mobile/app.json
- mobile/app/(tabs)/_layout.tsx
- mobile/app/(tabs)/file-detail.tsx  (re-added)
- mobile/app/+not-found.tsx          (re-added)
- mobile/app/_layout.tsx
- mobile/eslint.config.js            (re-added)
- mobile/package-lock.json
- mobile/package.json
- mobile/src/context/ShareContext.tsx
- mobile/src/i18n/de.json            (re-added)
- mobile/src/i18n/en.json            (re-added)
- mobile/src/i18n/es.json            (re-added)
- mobile/src/i18n/fr.json            (re-added)
- mobile/src/i18n/index.ts           (re-added)
- mobile/src/i18n/it.json            (re-added)
- mobile/src/screens/FileDetailScreen.tsx (re-added)
- mobile/src/screens/FilesScreen.tsx
- mobile/src/screens/LoginScreen.tsx
- mobile/src/screens/ProfileScreen.tsx
- mobile/src/screens/UploadScreen.tsx
- mobile/src/screens/WelcomeScreen.tsx
- mobile/src/services/api.ts
- mobile/src/utils/mimeTypes.ts      (re-added)
- mobile/src/utils/normalizeUri.ts   (re-added)

Security fixes introduced by d2217531 that are unrelated to mobile/
(IMAP SSRF fix in app/utils/network.py and app/tasks/imap_tasks.py)
are preserved — this restore targets only files under mobile/.
2026-03-24 12:14:14 +00:00
copilot-swe-agent[bot] aca12858c1 Initial plan 2026-03-24 12:10:30 +00:00
github-actions[bot] ae524bb94e chore(release): update build metadata files [skip ci] 2026-03-24 11:02:28 +00:00
semantic-release 5af4dbcb25 0.172.7
Automatically generated by python-semantic-release
2026-03-24 11:02:25 +00:00
Christian Krakau-Louis 94a090da77 Merge pull request #830 from christianlouis/copilot/fix-try-except-pass-issues
fix(main): log exceptions in shutdown handlers instead of silently swallowing them
2026-03-24 12:02:03 +01:00
copilot-swe-agent[bot] 3fd8b32724 fix(dockerfile): add frontend-builder stage to compile Tailwind CSS
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/6ef2a3d8-263b-47f9-9bd8-a05d6de89cea
2026-03-24 02:05:26 +00:00
copilot-swe-agent[bot] 7f20c903ef fix(api): remove duplicate Depends from AdminUser parameters in dropbox, onedrive, google_drive
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/18477ff5-a7a6-4806-a07b-076789c4a72b
2026-03-24 01:30:17 +00:00
copilot-swe-agent[bot] 8fcc223ef1 fix(main): replace silent except-pass with exception logging to fix S110
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/9c3fe34a-35d6-4f32-8257-336f66aff7cf
2026-03-24 01:11:23 +00:00
copilot-swe-agent[bot] ce050b542a Initial plan 2026-03-24 01:09:54 +00:00
github-actions[bot] 114b69a8c2 chore(release): update build metadata files [skip ci] 2026-03-24 01:06:07 +00:00
semantic-release f6591d10fc 0.172.6
Automatically generated by python-semantic-release
2026-03-24 01:06:03 +00:00
Christian Krakau-Louis c26c376e2e Merge pull request #829 from christianlouis/copilot/fix-container-startup-issue
fix(migrations): restore 5 migration files accidentally deleted by SSRF sentinel commit
2026-03-24 02:05:39 +01:00
github-actions[bot] 627a8579de style: apply ruff auto-fix
- Auto-formatted code with ruff format
- Applied ruff linting fixes with --fix

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-24 01:03:37 +00:00
copilot-swe-agent[bot] f041f28d9f fix: resolve multiple test failures in imap_tasks, main lifespan, and API settings endpoints
- Add _require_admin + AdminUser dependency to google_drive.py, dropbox.py, onedrive.py
  and switch save-settings endpoints from @require_login to Depends(_require_admin) so
  tests can use dependency_overrides to bypass auth
- Wrap lifespan shutdown section (logging.info + notify_shutdown) in try/except to
  silence OSError and other exceptions during shutdown (test_lifespan_shutdown_*)
- Add @patch("app.tasks.imap_tasks.is_private_ip", return_value=False) to 5 IMAP
  tests that use imap.example.com (unresolvable in CI, causing is_private_ip to return
  True and pull_inbox to return early before any IMAP operations)

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/06fb29ae-8e36-4f13-89b8-68c06378e8a6
2026-03-24 01:01:00 +00:00
copilot-swe-agent[bot] 7dec570ce6 fix(tasks): add -- end-of-options separator to ocrmypdf command in convert_to_pdfa
The test_successful_conversion test asserts that '--' precedes the input/output
file paths in the ocrmypdf command as a security measure against argument
injection (file paths starting with '-' being interpreted as options).
The implementation was missing this separator, causing the test to fail and
triggering a downstream pytest INTERNALERROR (OSError: Bad file descriptor)
when pytest's terminal writer tried to report the failure.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/bd7ef195-4b30-456e-8118-5c200fb4bf45
2026-03-24 00:11:04 +00:00
copilot-swe-agent[bot] c7d3ec57c3 fix: restore all code deleted/truncated by d2217531 Jules SSRF commit
Commit d2217531 (google-labs-jules SSRF fix) catastrophically deleted
11,500+ lines across 100+ files while fixing an unrelated IMAP issue.

Restored from d2217531^ (pre-bad-commit state):

Deleted files (fully restored):
- app/api/{automation,classification_rules,comments,sharing}.py
- app/middleware/upload_rate_limit.py
- app/tasks/{automation_tasks,classify_document}.py
- app/utils/{automation_hooks,classification_rules}.py
- docs/AppleAppStoreCompliance.md
- frontend/input.css, package.json, package-lock.json, tailwind.config.js
- frontend/static/js/{annotations,claim,comments,sharing}.js
- frontend/templates/{admin_connections,file_annotations,file_summary}.html
- tests/{test_api_files_comprehensive,test_auth_extended,test_sharing,
         test_comments,test_connections,test_imap_profiles,test_api_sessions,
         test_automation,test_classification_rules,test_api_advanced_filters,
         test_api_classification_rules,test_upload_rate_limit,test_api_dropbox,
         test_classify_document,test_comments_ui,test_upload_to_icloud,
         test_api_onedrive_comprehensive,test_frontend_build,test_sentry,
         test_diagnostic,test_database,test_views_dropbox,test_local_auth}.py

Truncated files (content restored):
- app/{auth,config,main,models,celery_worker,database}.py
- app/api/{__init__,api_tokens,diagnostic,dropbox,files,google_drive,
           integrations,local_auth,mobile,onedrive,pipelines,qr_auth,
           settings,url_upload}.py
- app/middleware/upload_rate_limit.py
- app/tasks/upload_to_nextcloud.py
- app/utils/{allowed_types,settings_service,settings_sync,user_scope,webhook}.py
- app/views/{base,dropbox,files,google_drive,onedrive,settings}.py
- docs/{API,AuthenticationSetup,ConfigurationGuide,DatabaseConfiguration,
        DeploymentGuide,DropboxSetup,GoogleDriveSetup,KubernetesDeployment,
        MobileApp,OneDriveSetup,ProductionReadiness,SentrySetup,
        SocialLoginSetup,UserGuide}.md
- frontend/static/{js/upload.js,styles.css}
- frontend/templates/{api_tokens,base,devices,dropbox,dropbox_callback,
                      file_view,files,google_drive,onedrive,onedrive_callback,
                      signup}.html
- frontend/translations/en.json
- migrations/env.py
- tests/{conftest,test_api_integrations,test_api_mobile,test_api_settings,
         test_api_tokens,test_audit_logs,test_duplicates,test_imap_tasks,
         test_setup_wizard,test_views_files_comprehensive}.py

Security fixes kept from post-d2217531 commits:
- app/utils/network.py: DNS SSRF fail-secure fix (06b0fced)
- app/utils/file_operations.py: path traversal fix (1018ea17)
- tests/test_imap_tasks.py: re-applied 4 is_private_ip mock patches

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/51133dd8-9bec-41ab-aa10-3de753634187
2026-03-23 23:52:39 +00:00