Skip to content

Commit

Permalink
do not hash subject in body payload
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadn committed Jul 2, 2024
1 parent 4d37e57 commit a32ab92
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
8 changes: 1 addition & 7 deletions lib/firetail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def log(env,
headers: response_headers,
},
oauth: subject ? {
subject: sha1_hash(subject),
subject: subject,
} : nil,
}.compact) # .compact removes keys with nil values, so we avoid sending empty values
@request.body.rewind
Expand Down Expand Up @@ -218,12 +218,6 @@ def log(env,
Firetail.logger.error(exception.message)
end

def sha1_hash(value)
encode_utf8 = value.encode(Encoding::UTF_8)
hash = Digest::SHA1.hexdigest(encode_utf8)
sha1 = "sha1: #{hash}"
end

def jwt_decoder(value)
bearer_string = value
# if authorization exists, get the value at index
Expand Down
6 changes: 0 additions & 6 deletions spec/firetail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@
end

context "backend logic" do
it "should be able to generate correct sha1sum string" do
api_key = "abc123"
hash = @app.sha1_hash(api_key.encode(Encoding::UTF_8))
hash_computed = Digest::SHA1.hexdigest(api_key)
expect(hash).to eq("sha1: #{hash_computed}")
end

it "should be able to correctly run backoff strategy for failure from retries" do
url = "https://api.logging.eu-west-1.prod.firetail.app/logs/bulk"
Expand Down

0 comments on commit a32ab92

Please sign in to comment.