Commit Graph

51 Commits (0e0de62dd9767f8da8a76fa0ff4e5e2be5981744)

Author SHA1 Message Date
Your Name 2be73c4879 Larastan Level 1 6 days ago
Your Name 24e0548fb4 ThisCallOnStaticMethodToStaticCallRector 6 days ago
Your Name 5ebc1af91e BATCH 1 7 days ago
Daniel Supernault fbd52dd8fc
Improve federation handling 2 weeks ago
Daniel Supernault 6f688a31d7
Lint 2 weeks ago
Shlee ce4df00921
Update MediaStorageService.php 2 weeks ago
Your Name 3232761a74 fix: prevent remcache temp file leaks and add GC command
The remote avatar/media fetchers wrote temp files to storage/app/remcache/
and only unlinked them on the happy path. Any exception between the write
and the unlink (e.g. a cloud upload failure) leaked the file, and nothing
swept the directory.

- Wrap post-write logic in fetchAvatar() and remoteToCloud() in try/finally
  so the temp file is always removed, even on failure
- Add gc:remcache command to delete stale remcache files (default >24h old,
  preserves .gitignore, supports --hours and --dry-run)
- Schedule gc:remcache daily to clean up any stragglers

StoryFetch already handled cleanup via try/catch and was left unchanged.
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
Shlee f018004b56
Merge pull request #6892 from pixelfed/refactor/move-models-to-namespace
Refactor/move models to namespace
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
4 weeks ago
Your Name a142db87b4 polish 4 weeks ago
Daniel Supernault 53742fa699
Lint 9 months ago
Shlee ea39e52d49
Update MediaStorageService.php 11 months ago
Shlee 3d92562764
Larastan: Update MediaStorageService.php 11 months ago
Anil Kulkarni dbd2e17728
Ensure the cloud url is used when publishing a status to activitypub
Posting is done in two steps - first the media is uploaded and that begins a processing pipeline. When the media is finally
processed, the media pipeline sets the cdn_url to the final image (in the cloud if configured).
At any time, the user can click post. This begins a separate NewStatusPipeline to deliver the status over ActivityPub.
This causes a race. If the NewStatusPipeline runs before the media finishes processing, then the status is delivered with
the un-processed (and un-optimized images). If pixelfed is set to use cloud storage, then the ActivityPub message also incorrectly
uses the local media.

This commit fixes the race condition by waiting for all the media to be processed before sending the message over ActivityPub.
A new publish_delayed column is set per-post, indicating whether the
status should be delayed until all media is processed.

Then, the NewStatusPipeline is called twice per post -
When the media finishes processing and when the status is posted.

Both times, the pipeline will check to see if it's valid to post
If so, the pipeline will try to set publish_delayed to false
and only if it is the first time doing so, will it publish the post
11 months ago
Daniel Supernault 2e719bd008
Update media storage pipeline, improve support for non-local filesystems 1 year ago
Daniel Supernault 2eb3957609
Lint 1 year ago
Daniel Supernault d0a3599834
Update MediaStorageService to clear the AP obj cache after S3 storage 1 year ago
Daniel Supernault ab9c13fe0d
New supported formats, Preserve ICC Color Profiles, libvips support
Update image pipeline to handle avif, heic and webp and preserve ICC color profiles and added libvips support.
1 year ago
daniel 92ce41ce18
Merge pull request #5664 from hnrd/fix-migrate2cloud
Skip thumbnail cloud upload if no thumbnail exists
2 years ago
tercean 3eb9257def Skip thumbnail cloud upload if no thumbnail exists
migrate2cloud fails on media without thumbnail.
fix check for existing thumbnail, skip upload if none exists.
2 years ago
Daniel Supernault 280f63dc6a
Update MediaStorageService, handle local media deletes after successful S3 upload 2 years ago
Daniel Supernault 665581d80c
Update cloud storage, use config_cache 3 years ago
Daniel Supernault 622e9cee97
Add S3 IG Import Media Storage 3 years ago
Daniel Supernault 82798b5ea3
Update AvatarPipeline, improve refresh logic and garbage collection to purge old avatars 3 years ago
Daniel Supernault fb1deb6e28
Add Resilient Media Storage 3 years ago
Daniel Supernault 3590adbd87
Update MediaStorageService, improve head header handling 3 years ago
Daniel Supernault e8d4ce1888
Update MediaStorageService 3 years ago
Daniel Supernault d6374cfe70
Update MediaStorageService 3 years ago
Daniel Supernault 51768083fe
Added store remote media on S3 config setting, disabled by default 3 years ago
Daniel Supernault 964c62da31
Update MediaStorageService, fix improper path 4 years ago
Daniel Supernault 1cdc0fe8ed
Update delete pipelines 4 years ago
Daniel Supernault de56b0f078
Update MediaStorageService, clear MediaService and StatusService caches after localToCloud 4 years ago
Daniel Supernault 66226658db
Update MediaStorageService, improve support for pleroma .blob avatars 4 years ago
Daniel Supernault 02edd19d4d
Update Avatar pipeline, fix cloud storage media_path 4 years ago
Daniel Supernault 319f0ba50f
Update MediaStorageService, fix size check bug 4 years ago
Daniel Supernault 989e42497a
Update Profile, fix avatarUrl paths. Fixes #3559 #3634 4 years ago
Daniel Supernault b0422d4f26
Fix remote profile avatar urls when storing locally 4 years ago
Daniel Supernault 1de7a136f6
Update MediaStorageService 4 years ago
Daniel Supernault 1c20d6960a
Update MediaStorageService, fix reremote avatar bug 5 years ago
Daniel Supernault b4bd0400c2
Store remote avatars locally if S3 not enabled 5 years ago
Daniel Supernault 9d9e9ce7fa
Update MediaStorageService, improve header parsing 5 years ago
Daniel Supernault 07bc5d5c83
Update MediaStorageService 5 years ago
Daniel Supernault 41792eea56
Update config() to config_cache() 5 years ago
Daniel Supernault 1d54204635
Update config() to config_cache() 5 years ago
Daniel Supernault 1769cdfd74
Update MediaStorageService, improve head checks to fix failed jobs 6 years ago
Daniel Supernault 37dbb3de29
Update MediaStorageService, dispatch deletes to MediaDeletePipeline 6 years ago
Daniel Supernault 94a9f685b5
Update MediaStorageService, add avatar method 6 years ago
Daniel Supernault ce6ab80dba
Update MediaStorageService, clear transformer cache after storing media 6 years ago
Daniel Supernault be6d12fcb6
Update MediaPipeline, handle cloud object storage 6 years ago