Skip to content

Commit

Permalink
revert to pre-pseudonymisation
Browse files Browse the repository at this point in the history
  • Loading branch information
ericaporter committed Sep 23, 2024
1 parent 61e08c5 commit 90cb0b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 0 additions & 4 deletions lib/dfe/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ def self.extract_model_attributes(model, attributes = nil)
end

def self.anonymise(value)
pseudonymise(value)
end

def self.pseudonymise(value)
# Google SQL equivalent of this is TO_HEX(SHA256(value))
Digest::SHA2.hexdigest(value.to_s)
end
Expand Down
12 changes: 6 additions & 6 deletions lib/dfe/analytics/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def with_response_details(rack_response)
end

def with_user(user)
@event_hash.merge!(user_id: user_identifier_for(user))
@event_hash.merge!(user_id: user_identifier(user))

self
end
Expand Down Expand Up @@ -126,15 +126,15 @@ def hash_to_kv_pairs(hash)
end

def anonymised_user_agent_and_ip(rack_request)
DfE::Analytics.pseudonymise(rack_request.user_agent.to_s + rack_request.remote_ip.to_s) if rack_request.remote_ip.present?
DfE::Analytics.anonymise(rack_request.user_agent.to_s + rack_request.remote_ip.to_s) if rack_request.remote_ip.present?
end

def ensure_utf8(str)
str&.scrub
def user_identifier(user)
DfE::Analytics.user_identifier(user)
end

def user_identifier_for(user)
DfE::Analytics.user_identifier(user)
def ensure_utf8(str)
str&.scrub
end
end
end
Expand Down

0 comments on commit 90cb0b6

Please sign in to comment.