-
Notifications
You must be signed in to change notification settings - Fork 699
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
Disable logging args in ShopifyApp jobs #1086
Conversation
80e3e5b
to
672bbf5
Compare
private | ||
|
||
def args_info(job) | ||
log_disabled_classes = %w(ShopifyApp::ScripttagsManagerJob ShopifyApp::WebhooksManagerJob) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to define this behaviour in the classes themselves? It seems like it would be easy to forget to add new classes to the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could add an attribute to check on each class but these jobs have been consistently alone for 5 years now :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough 😄 , I just thought that this isn't something we want to forget in the future.
672bbf5
to
9457598
Compare
Security | ||
-------- | ||
|
||
Please be certain to redact any private information from your logs or code snippets such as Api Keys, Api Secrets, and any authentication tokens such as shop_tokens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be certain to redact any private information from your logs or code snippets such as Api Keys, Api Secrets, and any authentication tokens such as shop_tokens. | |
Please be certain to redact any private information from your logs or code snippets such as API keys, API secrets, and any authentication tokens such as shop tokens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I specifically used shop_token so that they would see that visually and look in their logs for it visually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe write it as "shop_token
s"? (bit clunky, I know)
@@ -21,5 +31,16 @@ class Engine < Rails::Engine | |||
app.config.middleware.insert_after(ShopifyApp::SameSiteCookieMiddleware, ShopifyApp::JWTMiddleware) | |||
end | |||
end | |||
|
|||
initializer "shopify_app.redact_job_params" do | |||
ActiveSupport.on_load(:active_job) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to consider older Rails apps that don't use ActiveJob?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActiveJob was introduced in Rails 4.2 and this gem required 5.2
redacting job params in the shopify app jobs so that sensitive information is not accidentally pasted into issues.
a2098bf
to
2837a78
Compare
Hi @andyw8 , Do you know which version of Rails is required for |
Since shop tokens are passed into the parameters of the jobs and there has been a tendency for people to copy and paste these logs while debugging, it seems safest to redact the arguments from the jobs so that this will not happen accidentally in the future.
This will patch ActiveJob::Logging::LogSubscriber for rails < 6.1 and use
log_arguments = false
for rails >= 6.1