1. 01 Sep, 2021 1 commit
    • Sean McGivern's avatar
      Error on newlines in sidekiq-cluster arguments · 91e7b17c
      Sean McGivern authored
      When using Helm charts, which are YAML files, it's relatively easy to
      accidentally include a newline in the Sidekiq arguments. This will
      typically be a trailing newline, which shouldn't be a problem, except
      that in our cloud-native deployment we launch Sidekiq using the command
      given by `sidekiq-cluster --dryrun` (to avoid having the wrapper
      process), so we effectively do:
      
          $(bin/sidekiq-cluster --dryrun $ARGS)
      
      Ruby's `Shellwords.escape` quotes newlines as `'\n'`:
      https://github.com/ruby/shellwords/blob/v0.1.0/lib/shellwords.rb#L161-L163
      
      When those are parsed back in the arguments array we get `foo'\n'` for
      an original argument of `foo\n`. Then, when we apply splitting, we get
      `foo'` and `'` as two separate arguments.
      
      The quoting here is quite complicated but the below demonstrates (in
      Bash) what's happening:
      
          $ ruby -e 'p ARGV; p ARGV.first.split' "foo'"$'\n'"'"
          ["foo'\n'"]
          ["foo'", "'"]
      
      If we did care about newlines in this argument array, the solution would
      be more involved. But we don't, because they are never valid, so we can
      just error when we encounter them.
      
      Changelog: fixed
      91e7b17c
  2. 30 Aug, 2021 30 commits
  3. 29 Aug, 2021 2 commits
  4. 28 Aug, 2021 7 commits