From a32ab927aeab342645159cb87ef38736c3e6b637 Mon Sep 17 00:00:00 2001 From: Muhammad Nuzaihan Bin Kamal Luddin Date: Tue, 2 Jul 2024 14:46:05 +0800 Subject: [PATCH] do not hash subject in body payload --- lib/firetail.rb | 8 +------- spec/firetail_spec.rb | 6 ------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/firetail.rb b/lib/firetail.rb index 7c56b09..b3f16aa 100644 --- a/lib/firetail.rb +++ b/lib/firetail.rb @@ -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 @@ -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 diff --git a/spec/firetail_spec.rb b/spec/firetail_spec.rb index a33f2ab..e040161 100644 --- a/spec/firetail_spec.rb +++ b/spec/firetail_spec.rb @@ -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"