Commit Graph

173 Commits (fe1037348b039f7f85aad4c0e3643fd0e19b2da2)

Author SHA1 Message Date
Your Name 0d01d5a963 Fix duplicate-key violation when importing remote media attachments
Helpers::importNoteAttachment unconditionally inserted a new Media row per
attachment, so re-importing a remote status (an Announce racing another
inbox job, a re-fetch, or a duplicate url within one activity) hit the
media_status_id_media_path_unique constraint and crashed the queue job with
a 1062 UniqueConstraintViolationException, dropping the boost/import.

Make createMediaAttachment idempotent on (status_id, media_path): skip when
a row already exists, and catch the unique-constraint violation as a
lost-race no-op, returning null so the caller skips re-dispatching storage.

Adds regression tests (re-import no-op, distinct urls still stored,
concurrent-insert returns null).
4 weeks ago
Your Name 3d82a8e8b2 Fix unauthenticated SSRF in remote media/avatar fetch (variant of CVE-2026-71246)
The remote media path validated URLs only as strings (Helpers::validateUrl
normalizes the host + checks a ban list) and then downloaded them with
Http::head + file_get_contents($url), which resolve DNS themselves and
follow redirects with no private-IP checks and no address pinning. A remote
actor whose icon.url redirected to an internal address (e.g. 172.18.0.1 or
169.254.169.254) made the queue worker fetch internal content and, for
image responses, republish it at a public avatar URL. No account required.

Fixes:
- Add SecureMediaFetchService: validates URL, resolves + rejects non-global
  IPs (fail-closed), pins the connection to the validated IP via
  CURLOPT_RESOLVE, disables auto-redirects with per-hop re-validation, and
  enforces https-only + a byte cap. Mirrors the ActivityPubFetchService
  hardening from CVE-2026-71246.
- Route MediaStorageService head()/fetchAvatar()/remoteToCloud() through it,
  removing the bare Http::head and file_get_contents($url) sinks.
- validateUrl(): when DNS verification is enabled, reject hosts that resolve
  into reserved ranges, closing the metadata.google.internal bypass.
- Harden adjacent same-class sinks: CustomEmojiService (emoji doc + image +
  head), FetchCacheService/webfinger, and DiscoverActor.
- Add regression tests (tests/Unit/ActivityPub/SsrfUrlValidationTest.php).
4 weeks ago
Your Name c0cde2f682 refactor: move 52 legacy models from App\ to App\Models\
Move all Eloquent models from the app/ root directory to app/Models/
for consistency with modern Laravel conventions. The project already had
54 models in App\Models; this migrates the remaining 52 legacy models.

Changes:
- Move 52 model files from app/ to app/Models/
- Update namespace declarations in each model
- Update all ~1000 import references across the codebase
- Add Relation::morphMap() in AppServiceProvider for backward
  compatibility with existing polymorphic database records
- Add missing HasSnowflakePrimary imports for models that relied
  on same-namespace resolution
1 month ago
Your Name c807a8524c refactor: replace short facade aliases with fully-qualified imports
Convert all 273 short facade alias imports (e.g. 'use Cache;') to their
fully-qualified class names (e.g. 'use Illuminate\Support\Facades\Cache;')
across 193 files.

This resolves 643 PHPStan 'class.notFound' errors caused by the static
analyzer being unable to resolve global aliases, and aligns with modern
Laravel conventions. It also unblocks removing the aliases array from
config/app.php in a future change.

All 107 tests pass.
1 month ago
Daniel Supernault 30085e8708
Fix validateUrl() 1 month ago
Daniel Supernault bb33409fea
Lint 1 month ago
Daniel Supernault b84ae82f60
Update helpers 1 month ago
dansup 4748f66a02
Merge pull request #6687 from pixelfed/shleeable-patch-21
Improve validation
1 month ago
Daniel Supernault 2216402ed4
Update Helpers 1 month ago
Shlee 595220e088
Update Helpers.php 2 months ago
Shlee 886306d1d0
Update Helpers.php 2 months ago
dansup 40a5130430
Fix federation (#6346)
* Prepared new docker

* Docker setup improvements and fixes

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update .dockerignore

* DB/Redis health check

* updated health checks

* updated install guide

* updated DOCKER_SETUP

* Updated DOCKER_SETUP

* Updated DOCKER_SETUP

* Update and rename DOCKER_SETUP.md to DOCKER_COMPOSE_SETUP.md

* RemoveUnreachableStatementRector

* Update GroupActivityPubService.php

* Larastan: Add @property

* Delete rector.php

* more properties

* 2fa_enabled needs to be refactored

* Fix AdminUser.php syntax error - remove invalid property declaration

* Update AdminUser.php

* update

* Upgrade predis from v2.0 to v3.2

- Update predis/predis from ^2.0 to ^3.2
- Predis v3.2.0 includes RESP3 support, improved pipeline abstractions
- No code changes required, configuration remains compatible
- Tested successfully with tinker

* Upgrade predis from v2.0 to v3.2

* Update

* Update .env.docker.example

* Update DOCKER_COMPOSE_SETUP.md

* Create ImageDriverManager.php

* Update image.php

* Update ImageResizePipeline.php

* Update StoryComposeController.php

* Update AvatarOptimize.php

* Update Image.php

* Update composer.json

* Update AvatarOptimize.php

* update lock

* Update composer.lock

* update

* update

* update

* Allow to set new image types in admin interface

* Update composer, fix deps

* Update composer

* Update DOCKER_COMPOSE_SETUP.md - Added troubleshooting (#6344)

* Staging (#6343)

* Prepared new docker

* Docker setup improvements and fixes

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update DOCKER_SETUP.md

* Update .dockerignore

* DB/Redis health check

* updated health checks

* updated install guide

* updated DOCKER_SETUP

* Updated DOCKER_SETUP

* Updated DOCKER_SETUP

* Update and rename DOCKER_SETUP.md to DOCKER_COMPOSE_SETUP.md

* RemoveUnreachableStatementRector

* Update GroupActivityPubService.php

* Larastan: Add @property

* Delete rector.php

* more properties

* 2fa_enabled needs to be refactored

* Fix AdminUser.php syntax error - remove invalid property declaration

* Update AdminUser.php

* update

* Upgrade predis from v2.0 to v3.2

- Update predis/predis from ^2.0 to ^3.2
- Predis v3.2.0 includes RESP3 support, improved pipeline abstractions
- No code changes required, configuration remains compatible
- Tested successfully with tinker

* Upgrade predis from v2.0 to v3.2

* Update

* Update .env.docker.example

* Update DOCKER_COMPOSE_SETUP.md

* Create ImageDriverManager.php

* Update image.php

* Update ImageResizePipeline.php

* Update StoryComposeController.php

* Update AvatarOptimize.php

* Update Image.php

* Update composer.json

* Update AvatarOptimize.php

* update lock

* Update composer.lock

* update

* update

* update

* Allow to set new image types in admin interface

* Update composer, fix deps

* Update composer

---------

Co-authored-by: Shlee <github@shl.ee>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: Severin <savewish@icloud.com>

* Update DOCKER_COMPOSE_SETUP.md

* Update DOCKER_COMPOSE_SETUP.md

---------

Co-authored-by: dansup <danielsupernault@gmail.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: Severin <savewish@icloud.com>

* Regression - Fix federation - Update ActivityHandler.php (#6345)

* Update ActivityHandler.php

* Update ActivityHandler.php

* Revert inbox changes

* Fix InboxWorker

---------

Co-authored-by: Shlee <github@shl.ee>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: Severin <savewish@icloud.com>
11 months ago
Daniel Supernault efd351900d
Fix InboxWorker 11 months ago
dansup 7881b09c2f
Merge pull request #6304 from pixelfed/classV2
Larastan: Fix Missing classes 2 - Medium risk
11 months ago
Your Name 15cc07e602 Fix all class.notFound PHPStan issues - 31 fixes 11 months ago
Your Name 72e840345e Fix PHPStan 'empty() always exists and is not falsy' errors
- Remove redundant empty() checks where variables are guaranteed to exist and be non-falsy
- Replace empty() with simple null/false checks where appropriate
- Maintain original logic while fixing static analysis issues
- Affected files:
  - app/Http/Controllers/GroupController.php
  - app/Http/Controllers/ProfileAliasController.php
  - app/Jobs/ImageOptimizePipeline/ImageUpdate.php
  - app/Jobs/InboxPipeline/DeleteWorker.php
  - app/Jobs/InboxPipeline/InboxValidator.php
  - app/Jobs/InboxPipeline/InboxWorker.php
  - app/Jobs/ProfilePipeline/HandleUpdateActivity.php
  - app/Rules/ExpoPushTokenRule.php
  - app/Services/AutospamService.php
  - app/Services/CollectionService.php
  - app/Services/NotificationAppGatewayService.php
  - app/Services/WebfingerService.php
  - app/Util/ActivityPub/Helpers.php
11 months ago
Daniel Supernault 3686c92122
Update Status storage, add SanitizerService to fix spacing in html stripped content 1 year ago
daniel 2b4bccdfb1
Merge pull request #5972 from intentionally-left-nil/fix-id-domain-mismatch
Fix id domain mismatch
1 year ago
Daniel Supernault cb80c65995
Fix tests 1 year ago
Anil Kulkarni e3b7f1d7cd
For an ActivityStream object, such as a note, the code currently validates
the domain of the object id, matches the domain of the object url.
However, the current implementation of threads has objects where the id is
threads.net/ap/... and the url is www.threads.com/...
The AS spec does not guarantee any particular relationship between the
id and url. The only requirement is that the id is globally unique.
Additionally, mastodon also does not appear to require the domains to
match
1 year ago
Daniel Supernault 75e7a678ce
Update ActivityPub helpers 2 years ago
Daniel Supernault 22eae69fd5
Update AP Helpers, fix comment bug 2 years ago
Daniel Supernault 92d8df9116
Update AP helpers 2 years ago
Daniel Supernault d373887615
Update Helpers 2 years ago
Daniel Supernault cf2012c3af
Update Helpers.php 2 years ago
Daniel Supernault 823d756781
Update Helpers.php 2 years ago
Daniel Supernault 12b400707f
Refactor ActivityPub helpers 2 years ago
Daniel Supernault 85124aa642
Fix rendered caption 2 years ago
Daniel Supernault 8c39ef449a
Update Helpers.php 2 years ago
Daniel Supernault 1d2f76c8e5
Postgres fixes 2 years ago
Daniel Supernault 51bbb85bb0
Update Helpers.php 2 years ago
Daniel Supernault 9eeb7b6741
Update Status caption logic, stop storing duplicate html caption in db and defer to cached StatusService rendering 2 years ago
Daniel Supernault cf38a508ca
Lint 2 years ago
Daniel Supernault 960f3849f2
Update AP helpers, reject statuses with invalid dates 2 years ago
Daniel Supernault 03ad41e2c4
Update AP Helpers 2 years ago
Daniel Supernault f1497655ba
Update AP helpers, fix Moved account support 2 years ago
Daniel Supernault 42424028b0
Update AP helpers, add forceBanCheck param to validateUrl method 2 years ago
Daniel Supernault 8fea821504
Update AP helpers 2 years ago
Daniel Supernault d723e207fd
Update Helpers.php 2 years ago
Daniel Supernault 665581d80c
Update cloud storage, use config_cache 3 years ago
Daniel Supernault d835e0adaa
Update Inbox, cast live filters to lowercase 3 years ago
Daniel Supernault 40b45b2a11
Update Autospam, add live filters to block remote activities based on comma separated keywords 3 years ago
Daniel Supernault fb0bb9a34f
Update Federation, use proper Content-Type headers for following/follower collections 3 years ago
Daniel Supernault 00ed330cf3
Update AP helpers, fix sensitive bug 3 years ago
Daniel Supernault b81ae5773f
Update AP helpers, refactor post count decrement logic 3 years ago
Daniel Supernault 7caed381fb
Update AP helpers, more efficently update post counts 3 years ago
Daniel Supernault 33a60e767d
Update AP helpers, fix fanout scope 3 years ago
Daniel Supernault c6a6b3ae30
Update Experimental Home Feed, fix remote posts, shares and reblogs 3 years ago
Daniel Supernault 21218c794b
Update AP helpers, improve preferredUsername validation 3 years ago
Daniel Supernault 36b23fe34e
Update AP helpers, adjust RemoteAvatarFetch ttl from 24h to 3 months 3 years ago