Skip to content

Commit

Permalink
Move as_json override to ApplicationRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Apr 29, 2024
1 parent defa262 commit f8d0d0e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion app/models/account.rb
Expand Up @@ -89,7 +89,6 @@ class Account < ApplicationRecord
include DomainMaterializable
include DomainNormalizable
include Paginable
include NoImplicitSerialization

enum :protocol, { ostatus: 0, activitypub: 1 }
enum :suspension_origin, { local: 0, remote: 1 }, prefix: true
Expand Down
6 changes: 6 additions & 0 deletions app/models/application_record.rb
Expand Up @@ -22,4 +22,10 @@ def boolean_with_default(key, default_value)
value
end
end

# Prevent implicit serialization in ActiveModel::Serializer or other code paths.
# This is a hardening step to avoid accidental leaking of attributes.
def as_json
raise NotImplementedError
end
end
9 changes: 0 additions & 9 deletions app/models/concerns/no_implicit_serialization.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/models/user.rb
Expand Up @@ -59,7 +59,6 @@ class User < ApplicationRecord
include User::LdapAuthenticable
include User::Omniauthable
include User::PamAuthenticable
include NoImplicitSerialization

# The home and list feeds will be stored in Redis for this amount
# of time, and status fan-out to followers will include only people
Expand Down

0 comments on commit f8d0d0e

Please sign in to comment.