Commit c59e63c0 authored by Sean Arnold's avatar Sean Arnold

Merge branch 'release_prevent_sensitive_fields_from_serializable_hash' into 'master'

Prevent encrypted fields from being serialized by default

See merge request gitlab-org/gitlab!83272
parents 1ad3c57b 0890001e
......@@ -19,7 +19,6 @@ module SensitiveSerializableHash
# In general, prefer NOT to use serializable_hash / to_json / as_json in favor
# of serializers / entities instead which has an allowlist of attributes
def serializable_hash(options = nil)
return super unless prevent_sensitive_fields_from_serializable_hash?
return super if options && options[:unsafe_serialization_hash]
options = options.try(:dup) || {}
......@@ -37,10 +36,4 @@ module SensitiveSerializableHash
super(options)
end
private
def prevent_sensitive_fields_from_serializable_hash?
Feature.enabled?(:prevent_sensitive_fields_from_serializable_hash, default_enabled: :yaml)
end
end
---
name: prevent_sensitive_fields_from_serializable_hash
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81773
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/353878
milestone: '14.9'
type: development
group: group::sharding
default_enabled: false
......@@ -30,16 +30,6 @@ RSpec.describe SensitiveSerializableHash do
expect(model.serializable_hash(unsafe_serialization_hash: true)).to include('super_secret')
end
end
context 'when prevent_sensitive_fields_from_serializable_hash feature flag is disabled' do
before do
stub_feature_flags(prevent_sensitive_fields_from_serializable_hash: false)
end
it 'includes the field in serializable_hash' do
expect(model.serializable_hash).to include('super_secret')
end
end
end
describe '#serializable_hash' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment