Merge commit 'b0d009a6c63c3efdbca815249af8bac160cca267' into glitch-soc/stable-4.6

This commit is contained in:
Claire committed 2026-11-03 16:31:05 +01:00
commit 08a50aee8b
10 files changed
+57 -14

No files matched your search

+12
View File
@@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file.
## [4.6.11] - 2026-11-03
- Fix DoS through JSON-LD compaction (#41482 by @ClearlyClaire, [GHSA-cf49-73r7-rxj6](https://github.com/mastodon/mastodon/security/advisories/GHSA-cf49-73r7-rxj6))
- Fix `Forwarded` header taking precedence over `X-Forwarded-For` (#41481 by @ClearlyClaire, [GHSA-qp4r-p842-mw5c](https://github.com/mastodon/mastodon/security/advisories/GHSA-qp4r-p842-mw5c))
- If your reverse-proxy setup uses `Forwarded` instead of `X-Forwarded-For`, please make sure it ignores user-provided `X-Forwarded-For` headers.
- If you are using our provided `nginx.conf`, please consider updating it.
- Updated dependencies, in particular to address security advisories in `addressable`, `loofah`, `rack`, and `rails-html-sanitizer`
### Changed
- Change invites use counts to not decrease if an invited user deletes their account (#41458 by @ClearlyClaire)
## [4.6.10] - 2026-10-29
### Security
+8 -8
View File
@@ -89,7 +89,7 @@ GEM
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.9.0)
addressable (2.9.2)
public_suffix (>= 2.0.2, < 8.0)
aes_key_wrap (1.1.0)
android_key_attestation (0.3.0)
@@ -430,9 +430,9 @@ GEM
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.25.2)
loofah (2.25.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
nokogiri (>= 1.19.5)
mail (2.9.1)
logger
mini_mime (>= 0.1.1)
@@ -471,7 +471,7 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.5)
nokogiri (1.19.4)
nokogiri (1.19.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
omniauth (2.1.4)
@@ -630,7 +630,7 @@ GEM
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.8.1)
rack (3.2.6)
rack (3.2.8)
rack-attack (6.8.0)
rack (>= 1.0, < 4)
rack-cors (3.0.0)
@@ -674,8 +674,8 @@ GEM
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.7.1)
loofah (~> 2.25, >= 2.25.2)
rails-html-sanitizer (1.7.2)
loofah (~> 2.25, >= 2.25.3)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails-i18n (8.1.0)
i18n (>= 0.7, < 2)
@@ -1104,4 +1104,4 @@ RUBY VERSION
ruby 4.0.5
BUNDLED WITH
4.0.13
4.0.23
+6 -1
View File
@@ -70,7 +70,7 @@ class User < ApplicationRecord
:confirmable
belongs_to :account, inverse_of: :user
belongs_to :invite, counter_cache: :uses, optional: true
belongs_to :invite, optional: true
belongs_to :created_by_application, class_name: 'Doorkeeper::Application', optional: true
belongs_to :role, class_name: 'UserRole', optional: true
accepts_nested_attributes_for :account
@@ -115,6 +115,7 @@ class User < ApplicationRecord
before_validation :sanitize_role
before_create :set_approved
before_create :set_age_verified_at
after_create :increment_invite_uses
after_commit :send_pending_devise_notifications
after_create_commit :trigger_webhooks
@@ -524,4 +525,8 @@ class User < ApplicationRecord
def trigger_webhooks
TriggerWebhookWorker.perform_async('account.created', 'Account', account_id)
end
def increment_invite_uses
invite&.increment!(:uses)
end
end
@@ -12,7 +12,13 @@ class ActivityPub::ProcessCollectionService < BaseService
return unless @json.is_a?(Hash)
begin
@json = compact(@json) if @json['signature'].is_a?(Hash)
if @json['signature'].is_a?(Hash)
check_jsonld_limits!(@json)
@json = compact(@json)
end
# Unsupported features can be aliased, so re-check after compaction
check_jsonld_limits!(@json)
rescue Mastodon::InvalidJsonLdError => e
Rails.logger.debug { "JSON-LD handling for document from #{value_or_id(@json['actor'])} skipped: #{e.message}" }
+2
View File
@@ -1,5 +1,7 @@
# frozen_string_literal: true
Rack::Request.forwarded_priority = [:x_forwarded, :forwarded]
unless Rails.application.config.action_dispatch.trusted_proxies.nil?
# Rack is configured with a default collection of trusted proxies
# If Rails has been configured to use a specific list, configure
+2
View File
@@ -128,6 +128,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Forwarded "";
proxy_set_header Proxy "";
proxy_pass http://streaming;
@@ -145,6 +146,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Forwarded "";
proxy_set_header Proxy "";
proxy_pass_header Server;
+3 -3
View File
@@ -60,7 +60,7 @@ services:
web:
# You can uncomment the following line if you want to not use the prebuilt image, for example if you have local code changes
# build: .
image: ghcr.io/glitch-soc/mastodon:v4.6.10
image: ghcr.io/glitch-soc/mastodon:v4.6.11
restart: always
env_file: .env.production
command: bundle exec puma -C config/puma.rb
@@ -84,7 +84,7 @@ services:
# build:
# dockerfile: ./streaming/Dockerfile
# context: .
image: ghcr.io/glitch-soc/mastodon-streaming:v4.6.10
image: ghcr.io/glitch-soc/mastodon-streaming:v4.6.11
restart: always
env_file: .env.production
command: node ./streaming/index.js
@@ -103,7 +103,7 @@ services:
sidekiq:
# You can uncomment the following line if you want to not use the prebuilt image, for example if you have local code changes
# build: .
image: ghcr.io/glitch-soc/mastodon:v4.6.10
image: ghcr.io/glitch-soc/mastodon:v4.6.11
restart: always
env_file: .env.production
command: bundle exec sidekiq
+1 -1
View File
@@ -13,7 +13,7 @@ module Mastodon
end
def patch
10
11
end
def default_prerelease
+15
View File
@@ -25,6 +25,21 @@ RSpec.describe User do
describe 'Associations' do
it { is_expected.to belong_to(:account).required }
it { is_expected.to have_many(:login_activities) }
it { is_expected.to belong_to(:invite).optional }
it { is_expected.to have_many(:invites).inverse_of(:user).dependent(false) }
it { is_expected.to have_one(:invite_request).inverse_of(:user).dependent(:destroy).class_name(UserInviteRequest) }
describe 'invite' do
let(:invite) { Fabricate(:invite) }
it 'increments invite uses on creation but does not decrement it on deletion' do
expect { Fabricate(:user, email: 'alice@example.com', invite: invite) }
.to change { invite.reload.uses }.by(1)
expect { described_class.find_by(email: 'alice@example.com').destroy }
.to_not(change { invite.reload.uses })
end
end
end
describe 'Validations' do
+1
View File
@@ -122,6 +122,7 @@ RSpec.describe 'Auth Registration' do
expect { fill_in_and_submit_form(apply: false) }
.to change(User, :count).by(1)
.and change { invite.reload.uses }.by(1)
expect(User.find_by(email: 'test@example.com'))
.to have_attributes(approved: true)