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

attribute accessor named "raw" misstaken for unsafe method #3291

Closed
RobertDober opened this issue Jul 6, 2016 · 1 comment
Closed

attribute accessor named "raw" misstaken for unsafe method #3291

RobertDober opened this issue Jul 6, 2016 · 1 comment
Labels

Comments

@RobertDober
Copy link

10:06 % rubocop -V                                                                                                                                                                              2016-07-06 10:06:40
0.41.1 (using Parser 2.3.1.2, running on ruby 2.3.1 x86_64-linux)
robert@rd ~/facilecomm/facilecomm_v2 (rd/FCV-1231/upgrade_rubocop✗)   (ruby-2.3.1@facilecomm_v2), node-5.10.1
10:06 % cat xxx.rb                                                                                                                                                                              2016-07-06 10:06:53
# frozen_string_literal: true
class M
  attr_reader :raw
  def a
    puts raw
  end
end
robert@rd ~/facilecomm/facilecomm_v2 (rd/FCV-1231/upgrade_rubocop✗)   (ruby-2.3.1@facilecomm_v2), node-5.10.1
10:07 % rubocop -a xxx.rb                                                                                                                                                                       2016-07-06 10:07:02
Inspecting 1 file
C

Offenses:

xxx.rb:5:10: C: Tagging a string as html safe may be a security risk, \
          prefer safe_join or other Rails tag helpers instead
    puts raw
         ^^^

1 file inspected, 1 offense detected

@bbatsov bbatsov added the bug label Jul 25, 2016
@bbatsov
Copy link
Collaborator

bbatsov commented Jul 25, 2016

Yeah, we should check whether raw was passed some params.

lumeet added a commit to lumeet/rubocop that referenced this issue Oct 14, 2016
Only assume `raw` and `html_safe` to be a Rails helpers if calls have
one and zero arguments respectively.

Also unify related test descriptions.
Neodelf pushed a commit to Neodelf/rubocop that referenced this issue Oct 15, 2016
Only assume `raw` and `html_safe` to be a Rails helpers if calls have
one and zero arguments respectively.

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

No branches or pull requests

2 participants