How might we determine if free text contains any sensitive information before filtering it? #50
Closed
stevepolitodesign
started this conversation in
Ideas
Replies: 2 comments
-
|
Right now, we could do something like this: class Message < ApplicationRecord
validate :content_cannot_contain_sensitive_information
private
def content_cannot_contain_sensitive_information
result = TopSecret::Text.filter(content)
return if result.mapping.empty?
errors.add(:content, "contains the following sensitive information #{result.mapping.values.to_sentence}")
end
endHowever, it might be more performant to build a mapping without actually filtering the text. class Message < ApplicationRecord
validate :content_cannot_contain_sensitive_information
private
def content_cannot_contain_sensitive_information
result = TopSecret::Text.scan(content)
return if result.clean?
errors.add(:content, "contains the following sensitive information #{result.mapping.values.to_sentence}")
end
end |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
This was addressed in #70 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I can image a case where we just want to scan an input to determine if it contains any sensitive information. Once example could be a validating a message in Rails.
Beta Was this translation helpful? Give feedback.
All reactions