Browse Source
This backports the commits from the upstream `stable-4.0` branch, including the security content of [4.2.6](https://github.com/mastodon/mastodon/releases/tag/v4.2.6). --------- Co-authored-by: blah <blah@blah> Co-authored-by: Emelia Smith <ThisIsMissEm@users.noreply.github.com> Co-authored-by: Claire <claire.github-309c@sitedethib.com>hometown-4.0.10-merge v4.0.14+hometown-1.1.1
15 changed files with 222 additions and 38 deletions
@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true |
||||
|
||||
namespace :sidekiq_unique_jobs do |
||||
task delete_all_locks: :environment do |
||||
digests = SidekiqUniqueJobs::Digests.new |
||||
digests.delete_by_pattern('*', count: digests.count) |
||||
|
||||
expiring_digests = SidekiqUniqueJobs::ExpiringDigests.new |
||||
expiring_digests.delete_by_pattern('*', count: expiring_digests.count) |
||||
end |
||||
end |
||||
@ -1,16 +1,16 @@
|
||||
require 'rails_helper' |
||||
|
||||
RSpec.describe Identity, type: :model do |
||||
describe '.find_for_oauth' do |
||||
describe '.find_for_omniauth' do |
||||
let(:auth) { Fabricate(:identity, user: Fabricate(:user)) } |
||||
|
||||
it 'calls .find_or_create_by' do |
||||
expect(described_class).to receive(:find_or_create_by).with(uid: auth.uid, provider: auth.provider) |
||||
described_class.find_for_oauth(auth) |
||||
described_class.find_for_omniauth(auth) |
||||
end |
||||
|
||||
it 'returns an instance of Identity' do |
||||
expect(described_class.find_for_oauth(auth)).to be_instance_of Identity |
||||
expect(described_class.find_for_omniauth(auth)).to be_instance_of Identity |
||||
end |
||||
end |
||||
end |
||||
|
||||
@ -0,0 +1,83 @@
|
||||
# frozen_string_literal: true |
||||
|
||||
require 'rails_helper' |
||||
|
||||
describe 'Disabled OAuth routes' do |
||||
# These routes are disabled via the doorkeeper configuration for |
||||
# `admin_authenticator`, as these routes should only be accessible by server |
||||
# administrators. For now, these routes are not properly designed and |
||||
# integrated into Mastodon, so we're disabling them completely |
||||
describe 'GET /oauth/applications' do |
||||
it 'returns 403 forbidden' do |
||||
get oauth_applications_path |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
|
||||
describe 'POST /oauth/applications' do |
||||
it 'returns 403 forbidden' do |
||||
post oauth_applications_path |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
|
||||
describe 'GET /oauth/applications/new' do |
||||
it 'returns 403 forbidden' do |
||||
get new_oauth_application_path |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
|
||||
describe 'GET /oauth/applications/:id' do |
||||
let(:application) { Fabricate(:application, scopes: 'read') } |
||||
|
||||
it 'returns 403 forbidden' do |
||||
get oauth_application_path(application) |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
|
||||
describe 'PATCH /oauth/applications/:id' do |
||||
let(:application) { Fabricate(:application, scopes: 'read') } |
||||
|
||||
it 'returns 403 forbidden' do |
||||
patch oauth_application_path(application) |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
|
||||
describe 'PUT /oauth/applications/:id' do |
||||
let(:application) { Fabricate(:application, scopes: 'read') } |
||||
|
||||
it 'returns 403 forbidden' do |
||||
put oauth_application_path(application) |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
|
||||
describe 'DELETE /oauth/applications/:id' do |
||||
let(:application) { Fabricate(:application, scopes: 'read') } |
||||
|
||||
it 'returns 403 forbidden' do |
||||
delete oauth_application_path(application) |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
|
||||
describe 'GET /oauth/applications/:id/edit' do |
||||
let(:application) { Fabricate(:application, scopes: 'read') } |
||||
|
||||
it 'returns 403 forbidden' do |
||||
get edit_oauth_application_path(application) |
||||
|
||||
expect(response).to have_http_status(403) |
||||
end |
||||
end |
||||
end |
||||
Loading…
Reference in new issue