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

ArgumentError is raised if the keys of parameters include invalid byte sequence #53

Open
abicky opened this issue Sep 25, 2018 · 0 comments · May be fixed by #54
Open

ArgumentError is raised if the keys of parameters include invalid byte sequence #53

abicky opened this issue Sep 25, 2018 · 0 comments · May be fixed by #54

Comments

@abicky
Copy link

abicky commented Sep 25, 2018

We use GrapeLogging::Middleware::RequestLogger like below:

class MyApi < Grape::API
  use GrapeLogging::Middleware::RequestLogger, {
    include: [GrapeLogging::Loggers::FilterParameters.new],
  }
  post {}
end

If we send a request whose body includes invalid byte sequence, ArgumentError is raised.

echo -e '{"\xff":1}' | curl -X POST -H 'Content-Type: application/json' localhost:3000 --data-binary @-

Here is the server log:

ArgumentError (invalid byte sequence in UTF-8):

actionpack (5.2.1) lib/action_dispatch/http/parameter_filter.rb:63:in `=~'
actionpack (5.2.1) lib/action_dispatch/http/parameter_filter.rb:63:in `block (2 levels) in call'
actionpack (5.2.1) lib/action_dispatch/http/parameter_filter.rb:63:in `any?'
actionpack (5.2.1) lib/action_dispatch/http/parameter_filter.rb:63:in `block in call'
actionpack (5.2.1) lib/action_dispatch/http/parameter_filter.rb:61:in `each'
actionpack (5.2.1) lib/action_dispatch/http/parameter_filter.rb:61:in `call'
actionpack (5.2.1) lib/action_dispatch/http/parameter_filter.rb:15:in `filter'
grape_logging (1.7.0) lib/grape_logging/loggers/filter_parameters.rb:32:in `clean_parameters'
grape_logging (1.7.0) lib/grape_logging/loggers/filter_parameters.rb:27:in `safe_parameters'
grape_logging (1.7.0) lib/grape_logging/loggers/filter_parameters.rb:13:in `parameters'
grape_logging (1.7.0) lib/grape_logging/middleware/request_logger.rb:140:in `block (2 levels) in collect_parameters'
(snip)
abicky added a commit to abicky/grape_logging that referenced this issue Sep 25, 2018
This commit resolves aserafin#53.
@abicky abicky linked a pull request Sep 25, 2018 that will close this issue
abicky added a commit to abicky/grape_logging that referenced this issue Sep 25, 2018
This commit resolves aserafin#53.
abicky added a commit to abicky/grape_logging that referenced this issue Sep 25, 2018
abicky added a commit to abicky/grape_logging that referenced this issue Sep 25, 2018
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

Successfully merging a pull request may close this issue.

1 participant