Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ad4c798
Fix profile editor spacing after rebase
diondiondion Oct 5, 2026
19922b6
Use #nitiasa as the default community hashtag
kyori19 Oct 13, 2026
7007e35
Update dependency `sanitize`
ClearlyClaire Oct 28, 2026
b2b97ed
Update dependency `pghero`
ClearlyClaire Oct 28, 2026
b7f4852
Update dependency `css_parser`
ClearlyClaire Oct 28, 2026
d9cf22f
Update dependency `aws-sdk-s3`
ClearlyClaire Oct 28, 2026
c530851
Federate local collection item revocation (#40930)
oneiros Oct 7, 2026
21d6eda
Fix error in `dev:populate_sample_data` task (#40995)
isidzukuri Oct 12, 2026
9646b20
Extract `visibility_scope` method to re-use existing scopes in `Accou…
mjankowski Oct 9, 2026
8d1f1b9
Fix account timeline with `exclude_direct` also excluding followers-o…
ClearlyClaire Oct 13, 2026
f112d40
Avoid double constant warning from dev rake spec (#41051)
mjankowski Oct 14, 2026
a7d19ae
Reduce number of queries to DB from StatusCacheHydrator (#41079)
isidzukuri Oct 15, 2026
9f0fc97
Fix slow hashtag timelines with any[] when using min_id (#41132)
hugogameiro Oct 19, 2026
83c4819
Update dependency `excon`
ClearlyClaire Oct 28, 2026
9b0edf6
Send a security code challenge to users that try to long in after a l…
jhbabon Oct 5, 2026
c08bda2
Bump ruby version
ClearlyClaire Oct 28, 2026
8a254b6
New Crowdin translations
web-flow Oct 29, 2026
4123b61
Fix cross-domain redirects breaking origin-based security model
ClearlyClaire Oct 27, 2026
125b3b6
Hardening
ClearlyClaire Oct 28, 2026
d04059f
Bump version to v4.7.4
ClearlyClaire Oct 29, 2026
7d006db
Update dependency `addressable`
ClearlyClaire Nov 3, 2026
cee5404
Update dependency `loofah`
ClearlyClaire Nov 3, 2026
2ed4a9b
Update dependency `rack`
ClearlyClaire Nov 3, 2026
6d48e2a
Update dependency `rails-html-sanitizer`
ClearlyClaire Nov 3, 2026
804ed3c
Fix invite uses decreasing on invitee account deletion (#41458)
ClearlyClaire Nov 3, 2026
88c6c93
Fix “Forwarded” header being used inappropriately (#41481)
ClearlyClaire Nov 3, 2026
aeb73fa
Fix ActivityPub node count check (#41482)
ClearlyClaire Nov 3, 2026
1e1852e
Merge commit from fork
ClearlyClaire Nov 3, 2026
24cd1c8
Bump version to v4.7.5
ClearlyClaire Nov 3, 2026
e6428fe
Merge tag 'v4.7.5' into v4.7/base
kyori19 Nov 12, 2026
717c1ee
Merge branch 'v4.7/base' into v4.7/nitiasadon
kyori19 Nov 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-ruby/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
${{ inputs.additional-system-dependencies }}

- name: Set up Ruby
uses: ruby/setup-ruby@6e5d382445ae5590b7449d8b3bc8cb1c2c27f617 # v1
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
with:
ruby-version: ${{ inputs.ruby-version }}
bundler-cache: true
2 changes: 1 addition & 1 deletion .github/workflows/bundler-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6

- name: Set up Ruby
uses: ruby/setup-ruby@6e5d382445ae5590b7449d8b3bc8cb1c2c27f617 # v1
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
with:
bundler-cache: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-haml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6

- name: Set up Ruby
uses: ruby/setup-ruby@6e5d382445ae5590b7449d8b3bc8cb1c2c27f617 # v1
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
with:
bundler-cache: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6

- name: Set up Ruby
uses: ruby/setup-ruby@6e5d382445ae5590b7449d8b3bc8cb1c2c27f617 # v1
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
with:
bundler-cache: true

Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.6
4.0.9
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

All notable changes to this project will be documented in this file.

## [4.7.5] - 2026-11-03

### Security

- Fix password authentication bypass for inactive accounts ([GHSA-3xjw-gv43-3w62](https://github.com/mastodon/mastodon/security/advisories/GHSA-3xjw-gv43-3w62))
- 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.7.4] - 2026-10-29

### Security

- Fix insufficient ActivityPub identifier verification ([GHSA-288h-6j8h-6x5j](https://github.com/mastodon/mastodon/security/advisories/GHSA-288h-6j8h-6x5j))
- Added security challenge e-mail to users that try to log in after long period of inactivity (#40745 by @jhbabon)
- Updated dependencies, in particular to address security advisories in Ruby, NodeJS, `excon`, `css_parser`, `pghero`, and `sanitize`

### Fixed

- Fix inefficiency in some hashtag timeline queries (#41132 by @hugogameiro)
- Fix minor inefficiency in timeline deliveries (#41079 by @isidzukuri)
- Fix account timeline with `exclude_direct` also excluding followers-only posts for non-followed users (#41019 by @ClearlyClaire)
- Fix error in `dev:populate_sample_data` task (#40995 and #41051 by @isidzukuri and @mjankowski)
- Fix local collection item revocation not being properly federated (#40930 by @oneiros)

## [4.7.3] - 2026-10-01

### Security
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ARG BASE_REGISTRY="docker.io"

# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="4.0.x"]
# renovate: datasource=docker depName=docker.io/ruby
ARG RUBY_VERSION="4.0.6"
ARG RUBY_VERSION="4.0.9"
# # Node.js version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="22"]
# renovate: datasource=node-version depName=node
ARG NODE_MAJOR_VERSION="24"
Expand Down
37 changes: 19 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -98,10 +98,10 @@ GEM
activesupport (>= 6.0.0)
ast (2.4.3)
attr_required (1.0.2)
aws-eventstream (1.4.0)
aws-eventstream (1.4.1)
aws-partitions (1.1279.0)
aws-sdk-core (3.257.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-sdk-core (3.261.0)
aws-eventstream (~> 1, >= 1.4.1)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
Expand All @@ -112,8 +112,8 @@ GEM
aws-sdk-kms (1.130.0)
aws-sdk-core (~> 3, >= 3.254.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.232.3)
aws-sdk-core (~> 3, >= 3.256.0)
aws-sdk-s3 (1.235.0)
aws-sdk-core (~> 3, >= 3.258.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
Expand Down Expand Up @@ -179,9 +179,10 @@ GEM
crack (1.0.1)
bigdecimal
rexml
crass (1.0.7)
css_parser (3.0.0)
crass (1.0.8)
css_parser (3.3.0)
addressable
base64
ssrf_filter (~> 1.5)
csv (3.3.6)
database_cleaner-active_record (2.2.2)
Expand Down Expand Up @@ -229,7 +230,7 @@ GEM
erubi (1.13.1)
et-orbi (1.4.1)
tzinfo
excon (1.7.0)
excon (1.8.0)
logger
fabrication (3.0.0)
faker (3.8.0)
Expand Down Expand Up @@ -427,9 +428,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)
Expand Down Expand Up @@ -468,7 +469,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)
Expand Down Expand Up @@ -593,7 +594,7 @@ GEM
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.6.3)
pghero (4.0.1)
pghero (4.1.0)
activerecord (>= 7.2)
playwright-ruby-client (1.62.0)
base64
Expand Down Expand Up @@ -624,7 +625,7 @@ GEM
activesupport (>= 3.0.0)
raabro (1.5.0)
racc (1.8.1)
rack (3.2.7)
rack (3.2.8)
rack-attack (6.8.0)
rack (>= 1.0, < 4)
rack-cors (3.0.0)
Expand Down Expand Up @@ -668,8 +669,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)
Expand Down Expand Up @@ -808,8 +809,8 @@ GEM
fugit (~> 1.1, >= 1.11.1)
safety_net_attestation (0.5.0)
jwt (>= 2.0, < 4.0)
sanitize (7.0.0)
crass (~> 1.0.2)
sanitize (7.0.1)
crass (~> 1.0.8)
nokogiri (>= 1.16.8)
scenic (1.9.0)
activerecord (>= 4.0.0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

module Admin
class Users::SignInTokenAuthenticationsController < BaseController
before_action :set_target_user

def create
authorize @user, :enable_sign_in_token?
@user.enable_sign_in_token!
log_action :enable_sign_in_token, @user
redirect_to admin_account_path(@user.account_id)
end

def destroy
authorize @user, :disable_sign_in_token?
@user.disable_sign_in_token!
log_action :disable_sign_in_token, @user
redirect_to admin_account_path(@user.account_id)
end

private

def set_target_user
@user = User.find(params[:user_id])
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/api/v1/timelines/public_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def public_statuses
end

def public_feed
return CommunityFeed.new(current_account, only_media: truthy_param?(:only_media)) if truthy_param?(:local) && !truthy_param?(:remote)

PublicFeed.new(
current_account,
local: truthy_param?(:local),
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/auth/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Auth::SessionsController < Devise::SessionsController
prepend_before_action :check_suspicious!, only: [:create]

include Auth::TwoFactorAuthenticationConcern
include Auth::SignInTokenAuthenticationConcern

content_security_policy only: :new do |p|
p.form_action(false)
Expand Down Expand Up @@ -62,7 +63,7 @@ def find_user_from_params
end

def user_params
params.expect(user: [:email, :password, :otp_attempt, credential: {}])
params.expect(user: [:email, :password, :otp_attempt, :sign_in_token_attempt, credential: {}])
end

def after_sign_in_path_for(resource)
Expand Down Expand Up @@ -169,6 +170,10 @@ def on_authentication_failure(user, security_measure, failure_reason)
)
)

# No need to send a mail for failure to log in with a sign-in token, as that goes throug a mail
# as well
return if security_measure == :sign_in_token

# Only send a notification email every hour at most
return if redis.set("2fa_failure_notification:#{user.id}", '1', ex: 1.hour, get: true).present?

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# frozen_string_literal: true

module Auth::SignInTokenAuthenticationConcern
extend ActiveSupport::Concern

included do
prepend_before_action :authenticate_with_sign_in_token, if: :sign_in_token_required?, only: [:create]
end

def sign_in_token_required?
find_user&.suspicious_inactive_sign_in?
end

def authenticate_with_sign_in_token
if user_params[:email].present?
user = self.resource = find_user_from_params
prompt_for_sign_in_token(user) if user&.valid_password?(user_params[:password])
elsif session[:attempt_user_id]
user = self.resource = User.find_by(id: session[:attempt_user_id])
return if user.nil?

if session[:attempt_user_updated_at] != user.updated_at.to_s
restart_session
elsif params.key?(:sign_in_token_resend)
prompt_for_sign_in_token(user, resend: true)
elsif user_params[:sign_in_token_attempt].present?
authenticate_with_sign_in_token_attempt(user)
end
end
end

def authenticate_with_sign_in_token_attempt(user)
if check_second_factor_rate_limits(user)
flash.now[:alert] = I18n.t('users.rate_limited')
return prompt_for_sign_in_token(user)
end

if user.valid_sign_in_token?(user_params[:sign_in_token_attempt])
user.clear_sign_in_token!
on_authentication_success(user, :sign_in_token)
else
on_authentication_failure(user, :sign_in_token, :invalid_sign_in_token)
flash.now[:alert] = I18n.t('users.invalid_sign_in_token')
prompt_for_sign_in_token(user)
end
end

def prompt_for_sign_in_token(user, resend: false)
if resend || user.sign_in_token_expired?
user.generate_sign_in_token && user.save
UserMailer.sign_in_token(user, request.remote_ip, request.user_agent, Time.now.utc.to_s).deliver_later!
end

register_attempt_in_session(user)
render :sign_in_token
end
end
2 changes: 1 addition & 1 deletion app/helpers/formatting_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def extract_status_plain_text(status)
def status_content_format(status)
quoted_status = status.quote&.quoted_status if status.local?

html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []), quoted_status: quoted_status)
html_aware_format(DefaultHashtag.text(status), status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []), quoted_status: quoted_status)
end

def rss_status_content_format(status)
Expand Down
19 changes: 11 additions & 8 deletions app/helpers/json_ld_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,19 @@ def safe_for_forwarding?(original, compacted)

# Fetch the resource given by uri.
# @param uri [String]
# @param id_is_known [Boolean]
# @param allow_redirects [Boolean]
# @param on_behalf_of [nil, Account]
# @param raise_on_error [Symbol<:all, :temporary, :none>] See {#fetch_resource_without_id_validation} for possible values
def fetch_resource(uri, id_is_known, on_behalf_of = nil, raise_on_error: :none, request_options: {})
unless id_is_known
json = fetch_resource_without_id_validation(uri, on_behalf_of, raise_on_error: raise_on_error)
def fetch_resource(uri, allow_redirects: false, on_behalf_of: nil, raise_on_error: :none, request_options: {})
if allow_redirects
json = fetch_resource_without_id_validation(uri, on_behalf_of: on_behalf_of, raise_on_error: raise_on_error)

return if !json.is_a?(Hash) || unsupported_uri_scheme?(json['id'])

uri = json['id']
end

json = fetch_resource_without_id_validation(uri, on_behalf_of, raise_on_error: raise_on_error, request_options: request_options)
json = fetch_resource_without_id_validation(uri, allow_redirects: false, on_behalf_of: on_behalf_of, raise_on_error: raise_on_error, request_options: request_options)
json.present? && json['id'] == uri ? json : nil
end

Expand All @@ -264,21 +264,24 @@ def fetch_resource(uri, id_is_known, on_behalf_of = nil, raise_on_error: :none,
#
# @param uri [String]
# @param on_behalf_of [nil, Account]
# @param allow_redirects [Boolean]
# @param raise_on_error [Symbol<:all, :temporary, :none>]
# - +:all+ - raise if response code is not in the 2xx range
# - +:temporary+ - raise if the response code is not an "unsalvageable error" like a 404
# (see {#response_error_unsalvageable} )
# - +:none+ - do not raise, return +nil+
def fetch_resource_without_id_validation(uri, on_behalf_of = nil, raise_on_error: :none, request_options: {})
def fetch_resource_without_id_validation(uri, allow_redirects: true, on_behalf_of: nil, raise_on_error: :none, request_options: {})
on_behalf_of ||= Account.representative

request_options = request_options.merge(follow: false) unless allow_redirects

build_request(uri, on_behalf_of, options: request_options).perform do |response|
raise Mastodon::UnexpectedResponseError, response if !response_successful?(response) && (
raise_on_error == :all ||
(!response_error_unsalvageable?(response) && raise_on_error == :temporary)
)

body_to_json(response.body_with_limit) if response.code == 200 && valid_activitypub_content_type?(response)
body_to_json(response.body_with_limit) if response.code == 200 && valid_activitypub_content_type?(response) && (allow_redirects || response.uri.to_s == uri)
end
end

Expand Down Expand Up @@ -345,7 +348,7 @@ def fetch_collection_page(collection_or_uri, reference_uri: nil, on_behalf_of: n
return collection_or_uri if collection_or_uri.is_a?(Hash)
return if !reference_uri.nil? && non_matching_uri_hosts?(reference_uri, collection_or_uri)

fetch_resource_without_id_validation(collection_or_uri, on_behalf_of, raise_on_error: :temporary)
fetch_resource_without_id_validation(collection_or_uri, on_behalf_of: on_behalf_of, raise_on_error: :temporary)
end

def valid_activitypub_content_type?(response)
Expand Down
Loading
Loading