Commit Graph

147 Commits

Author SHA1 Message Date
KodeStar 1c7ae3e335 Fix silent tile disappearance and ownership-reassignment bugs
Tiles could vanish without ever being deleted:

- Editing an item merged the editor's user_id into every save, so
  updating a visible item (e.g. a shared user_id=0 tile) silently
  reassigned ownership and hid it from everyone else. user_id is now
  set on create only, and excluded from update input in both Item and
  Tag controllers since it is mass-assignable.
- Deleting a user left their items orphaned with a dangling user_id,
  invisible to all users forever. The user's items are now hard-deleted
  with the account, and a data migration reassigns already-orphaned
  items to the admin user so previously "lost" tiles reappear.
- The Item global scope's ownership filter had an ungrouped orWhere,
  breaking operator precedence in any query that adds further clauses.

Includes regression coverage for ownership on create/update, user
deletion cleanup, and the orphan-recovery migration.
2026-07-09 10:52:29 +01:00
KodeStar f1eec81591 Fix appload() returning a coerced HTTP 200 instead of a 404
ItemController::appload() was declared ': ?string', so its two error
branches that 'return response()->json([...], 404)' had the JsonResponse
coerced through Response::__toString() into a raw HTTP message served as
an HTTP 200 body. Widen the return type to
'\Illuminate\Http\JsonResponse|string|null' so those branches emit
real 404 JSON responses. The method body is unchanged, so the happy path
still returns the same JSON string and the frontend contract is preserved.

Flip the endpoint characterization test to assert the corrected 404.
2026-07-08 20:33:26 +01:00
KodeStar caa4f39edd Merge pull request #1567 from linuxserver/fix/export-import-tags
Include tags in item export and restore them on import
2026-07-08 18:29:18 +01:00
KodeStar a1f0d8f75d Merge pull request #1568 from linuxserver/fix/host-header-injection
Harden against host header injection and open redirect (CVE-2025-50578)
2026-07-08 18:29:04 +01:00
KodeStar 9a9877a0dc Enforce TRUSTED_HOSTS allow-list regardless of APP_ENV
The custom TrustHosts middleware only overrode hosts(), so it inherited the
parent's shouldSpecifyTrustedHosts() gate, which skips enforcement whenever the
app runs in the local environment or under the test runner. Heimdall ships
APP_ENV=local by default (.env.example, copied to .env on install), so the
TRUSTED_HOSTS allow-list a user configures per the .env.example guidance was
never actually applied.

Override shouldSpecifyTrustedHosts() to tie enforcement to configuration
instead of environment: apply the allow-list whenever TRUSTED_HOSTS is set, in
any environment; when it is unset hosts() is empty and enforcement stays off,
preserving the historic no-restriction behaviour. Add handle()-driven tests
covering both the configured and unconfigured cases.
2026-07-08 18:22:49 +01:00
KodeStar f547ae42bb Return graceful output from get_stats instead of a 500
get_stats/{id} fataled when the item id was missing and 500'd whenever an
enhanced app's livestats() threw - a broken or updated remote app definition
(e.g. Komga) took the whole request down, and the frontend then stopped
refreshing that tile entirely.

getStats now returns valid JSON (200) with an inactive/empty payload when the
item is missing, has no class, references a stale class, or throws, logging
the failure for diagnosis. The successful path is unchanged and returns the
livestats output verbatim.

Resolves #1558
2026-07-08 15:21:39 +01:00
KodeStar 881533baa5 Harden against host header injection and open redirect
Heimdall trusted the incoming X-Forwarded-Host header for URL generation, so
a spoofed value poisoned the page base href, asset() URLs and redirect
targets - loading assets from and redirecting to an attacker-controlled host
(CVE-2025-50578).

- TrustProxies no longer trusts X-Forwarded-Host; a forged value can no longer
  influence getHost(), url(), asset() or redirects. X-Forwarded-For/Port/Proto
  handling is unchanged.
- Trusted proxies are now configurable via the TRUSTED_PROXIES env var
  (comma-separated CIDRs/IPs, "*" to trust all), defaulting to the previous
  private ranges.
- Added an opt-in TRUSTED_HOSTS allow-list: when set, only the listed hosts are
  served and any other Host header is rejected. Unset keeps the historic
  behaviour of serving arbitrary hosts, so existing installs are unaffected.

Resolves #1451
2026-07-08 14:42:12 +01:00
KodeStar fb9af1b216 Include tags in item export and restore them on import
The export endpoint (api/item) now emits each item's assigned tag titles,
excluding the root/default dashboard tag. On import, those titles are
resolved back to local tags - reusing an existing tag or creating a missing
one - instead of dropping every imported item onto the default dashboard.

Tags round-trip by title so a config can be moved between instances without
having to reassign each item to its section by hand.

Resolves #1555
2026-07-08 14:18:45 +01:00
Fabien Ehrlich 6a776e30f8 fix: proxy options in ItemController
The correct context is http->proxy :

https://www.php.net/manual/en/context.http.php
2026-05-13 11:35:13 +02:00
Chris Hunt 852c231724 Add autocomplete suggestions support and added to bing, duckduckgo, and google 2025-11-11 11:39:06 +00:00
Chris Hunt 755c3e59e1 Fix tag list url when tags are treated as tags 2025-09-16 09:50:03 +01:00
Chris Hunt 517f51ba90 Update items with no password 2025-09-10 16:14:14 +01:00
KodeStar 825f67a4a4 Merge pull request #1480 from Nyuwb/patch-1
feat(icon-upload): proxy management
2025-09-10 15:15:48 +01:00
Chris Hunt 63e777b338 Redirect to search provider without error fixes #1482 2025-08-02 17:40:37 +01:00
Chris Hunt fd926e983d Fix for some enhanced apps not working 2025-08-02 17:17:40 +01:00
Fabien Ehrlich dce37c1412 feat(icon-upload): proxy management 2025-07-31 16:54:44 +02:00
Chris Hunt d1a96dd752 Escape search queries and add setting value on edit 2025-07-24 19:05:16 +01:00
Chris Hunt 41aa255b88 Add missing variable 2025-07-22 15:57:29 +01:00
Chris Hunt a8e4ab448b Load in configs values if class has been lost 2025-07-22 15:50:51 +01:00
Chris Hunt 6075dcca2d Fix importing apps and logging in 2025-07-17 14:19:02 +01:00
Chris Hunt 1e6b1f6de5 Add tests and fix user edit form 2025-07-15 17:04:47 +01:00
Chris Hunt 69bc8cb34e Fixes to reduce the SSRF attack vector. 2025-07-13 19:06:33 +01:00
Chris Hunt 2df58472a1 Fix uploads and displaying of malicious SVG files 2025-07-13 17:00:23 +01:00
Chris Hunt 22f66d35e5 Throw error if image doesn't have an extension #1446 2025-07-11 16:19:34 +01:00
Shift 42d29f0fdb Re-register HTTP middleware 2025-07-10 18:54:02 +00:00
Shift b9e75b9284 Remove default app files 2025-07-10 18:53:54 +00:00
Shift c1c3888673 Apply code style 2025-07-10 18:53:44 +00:00
Tobias Kolzer 921631bdcd fixed some rebase conflicts 2025-05-05 11:49:18 +02:00
Tobias Kolzer c56ffe1d1e fixed some rebase conflicts 2025-05-05 11:49:18 +02:00
goodactive 184e19abbc chore: fix some typos in comments
Signed-off-by: goodactive <goodactive@qq.com>
2024-04-19 18:00:20 +08:00
Chris Hunt f3bc6ab618 Add tags to application list, and fix home dashboard tag 2024-02-19 10:58:19 +00:00
KodeStar 809a997631 Merge pull request #1291 from KodeStar/2.x
Fix upload paths
2024-02-18 20:27:26 +00:00
Chris Hunt fb7f9de127 Fix upload paths 2024-02-18 20:26:20 +00:00
Chris Hunt d276bf8b1d Add alternate tag types 2024-02-18 18:16:46 +00:00
Chris Hunt 8fa870e8eb Initial commit 2024-02-18 09:06:03 +00:00
Shift f3a5be79dc Remove redundant typing from DocBlocks 2024-02-16 21:13:14 +00:00
Shift 3487f52a6b Add type hints from DocBlocks 2024-02-16 21:13:14 +00:00
Shift 2cb837e4b5 Add type hints for Laravel 10 2024-02-16 21:13:13 +00:00
Shift ef25ec4f69 Shift core files 2024-02-16 21:13:07 +00:00
Shift 6423ccd075 Shift core files 2024-02-16 20:33:36 +00:00
Shift d41c4c8d4c Replace deprecated HEADER_X_FORWARDED_ALL constant 2024-02-16 20:33:33 +00:00
Shift aa72ce0a3f Shift registered middleware 2024-02-16 20:33:32 +00:00
Shift 51b30e55cd Adopt short array syntax
Since PHP 5.4 the short array syntax `[]` may be used instead of `array()`.
2024-02-16 20:33:26 +00:00
Attila Kerekes fbd050d4e4 fix: validate icons to be images (#1173) 2023-06-06 12:08:47 +02:00
Attila Kerekes 5d67f570a9 fix: validate icons to be images (#1167) 2023-06-05 18:27:30 +02:00
Attila Kerekes cd07d47445 fix: Add more verbose error when uploading background image (#1082) 2022-12-24 10:56:00 +01:00
Attila Kerekes 9e6321e500 fix: Enable tag slug creation from CN characters (#1077) 2022-12-16 10:26:00 +01:00
Attila Kerekes 4d3083886e fix: Autologin forces logout 2022-12-15 22:21:16 +01:00
Attila Kerekes aa886e4f77 fix: Public access to front also applies to tags 2022-12-15 20:17:08 +01:00
Attila Kerekes 5eb1f55b82 chore: Add php code sniffer github check (#1066) 2022-12-11 11:58:58 +01:00