Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do Not Log Message Body #128

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 5.2.14 - 2024-02-05
### Changed
- Do not log message body when publishing. Message bodies may have PII like email addresses in them.

## 5.2.13 - 2024-01-26
### Changed
- Updated dependencies
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
pheme (5.2.13)
pheme (5.2.14)
activesupport (>= 4)
aws-sdk-sns (~> 1.1)
aws-sdk-sqs (~> 1.3)
Expand Down
3 changes: 2 additions & 1 deletion lib/pheme/topic_publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def publish(message,
publisher: self.class.to_s,
topic_arn: topic_arn,
}
Pheme.logger.info(payload.to_json)

Pheme.logger.info(payload.except(:body).to_json)

sns_client.publish(
topic_arn: topic_arn,
Expand Down
2 changes: 1 addition & 1 deletion lib/pheme/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Pheme
VERSION = '5.2.13'.freeze
VERSION = '5.2.14'.freeze
end
27 changes: 27 additions & 0 deletions spec/topic_publisher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
message_deduplication_id: nil,
message_group_id: nil,
})
expect(Pheme.logger).to(
receive(:info).with(
{
message: "ExamplePublisher publishing message to arn:aws:sns:whatever",
publisher: "ExamplePublisher",
topic_arn: "arn:aws:sns:whatever",
}.to_json,
).twice,
)
subject.publish_events
end

Expand All @@ -64,6 +73,15 @@
message_deduplication_id: nil,
message_group_id: nil,
})
expect(Pheme.logger).to(
receive(:info).with(
{
message: "Pheme::TopicPublisher publishing message to #{topic_arn}",
publisher: "Pheme::TopicPublisher",
topic_arn: topic_arn,
}.to_json,
),
)
subject.publish(message)
end

Expand All @@ -78,6 +96,15 @@
message_deduplication_id: nil,
message_group_id: nil,
})
expect(Pheme.logger).to(
receive(:info).with(
{
message: "Pheme::TopicPublisher publishing message to #{topic_arn}",
publisher: "Pheme::TopicPublisher",
topic_arn: topic_arn,
}.to_json,
),
)
subject.publish(message, sns_client: sns_client)
end
end
Expand Down
Loading