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

Does not support filter_attributes #187

Open
araslanov-e opened this issue Aug 29, 2023 · 1 comment
Open

Does not support filter_attributes #187

araslanov-e opened this issue Aug 29, 2023 · 1 comment

Comments

@araslanov-e
Copy link

araslanov-e commented Aug 29, 2023

Environment

Ruby: 3.1.4
Rails: 7.0.7.2
rails_semantic_logger (4.12.0)
semantic_logger (4.14.0)

Created a new application, added a Page model with title and desc fields, added the desc field to Rails.application.config.filter_parameters.

Expected Behavior

The log without the gem:

Started POST "/pages" for ::1 at 2023-08-29 10:04:05 +0300
Processing by PagesController#create as TURBO_STREAM
  Parameters: {"authenticity_token"=>"[FILTERED]", "page"=>{"title"=>"1111", "desc"=>"[FILTERED]"}, "commit"=>"Create Page"}
  TRANSACTION (0.1ms)  begin transaction
  ↳ app/controllers/pages_controller.rb:27:in `block in create'
  Page Create (1.1ms)  INSERT INTO "pages" ("title", "desc", "created_at", "updated_at") VALUES (?, ?, ?, ?)  [["title", "1111"], ["desc", "[FILTERED]"], ["created_at", "2023-08-29 07:04:05.536666"], ["updated_at", "2023-08-29 07:04:05.536666"]]
  ↳ app/controllers/pages_controller.rb:27:in `block in create'
  TRANSACTION (0.8ms)  commit transaction
  ↳ app/controllers/pages_controller.rb:27:in `block in create'
Redirected to http://localhost:3000/pages/1
Completed 302 Found in 8ms (ActiveRecord: 1.9ms | Allocations: 3939)

Actual Behavior

The log with the gem:

2023-08-29 10:07:39.767489 D [67049:puma srv tp 003] Rack -- Started -- { :method => "POST", :path => "/pages", :ip => "::1" }
2023-08-29 10:07:39.772787 D [67049:puma srv tp 003] PagesController -- Processing #create
2023-08-29 10:07:39.774923 D [67049:puma srv tp 003] (0.053ms) ActiveRecord -- TRANSACTION -- { :sql => "begin transaction", :allocations => 25, :cached => nil }
2023-08-29 10:07:39.776033 D [67049:puma srv tp 003] (0.774ms) ActiveRecord -- Page Create -- { :sql => "INSERT INTO \"pages\" (\"title\", \"desc\", \"created_at\", \"updated_at\") VALUES (?, ?, ?, ?)", :binds => { :title => "2222", :desc => "333", :created_at => "2023-08-29 07:07:39.774262", :updated_at => "2023-08-29 07:07:39.774262" }, :allocations => 42, :cached => nil }
2023-08-29 10:07:39.776974 D [67049:puma srv tp 003] (0.785ms) ActiveRecord -- TRANSACTION -- { :sql => "commit transaction", :allocations => 19, :cached => nil }

Summary

Field desc has not filtered

@araslanov-e
Copy link
Author

When config.rails_semantic_logger.semantic = false

2023-08-29 11:41:38.342510 I [71939:puma srv tp 003] Rails -- Started POST "/pages" for ::1 at 2023-08-29 11:41:38 +0300
2023-08-29 11:41:38.348703 I [71939:puma srv tp 003] Rails -- Processing by PagesController#create as TURBO_STREAM
2023-08-29 11:41:38.348746 I [71939:puma srv tp 003] Rails --   Parameters: {"authenticity_token"=>"[FILTERED]", "page"=>{"title"=>"000", "desc"=>"[FILTERED]"}, "commit"=>"Create Page"}
2023-08-29 11:41:38.351155 D [71939:puma srv tp 003] ActiveRecord::Base --   TRANSACTION (0.1ms)  begin transaction
2023-08-29 11:41:38.351668 D [71939:puma srv tp 003] ActiveRecord::Base --   ↳ app/controllers/pages_controller.rb:27:in `block in create'
2023-08-29 11:41:38.352524 D [71939:puma srv tp 003] ActiveRecord::Base --   Page Create (0.4ms)  INSERT INTO "pages" ("title", "desc", "created_at", "updated_at") VALUES (?, ?, ?, ?)  [["title", "000"], ["desc", "[FILTERED]"], ["created_at", "2023-08-29 08:41:38.350462"], ["updated_at", "2023-08-29 08:41:38.350462"]]
2023-08-29 11:41:38.352905 D [71939:puma srv tp 003] ActiveRecord::Base --   ↳ app/controllers/pages_controller.rb:27:in `block in create'
2023-08-29 11:41:38.353809 D [71939:puma srv tp 003] ActiveRecord::Base --   TRANSACTION (0.7ms)  commit transaction
2023-08-29 11:41:38.354123 D [71939:puma srv tp 003] ActiveRecord::Base --   ↳ app/controllers/pages_controller.rb:27:in `block in create'
2023-08-29 11:41:38.354612 I [71939:puma srv tp 003] Rails -- Redirected to http://localhost:3000/pages/6
2023-08-29 11:41:38.354650 I [71939:puma srv tp 003] Rails -- Completed 302 Found in 6ms (ActiveRecord: 1.2ms | Allocations: 3967)

["desc", "[FILTERED]"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant