Project

General

Profile

Actions

Refactor #23300

closed

Do not use string interpolation when composing SQL queries.

Added by Martin Povolny almost 6 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Rails
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Using string interpolation when composing SQL queries is just one step away from creating a security issue. It's against the Rails best practices to do so. Doing so actually results into Brakeman complaining loudly.

Task: replace string interpolation with use of parameterization of queries and/or AREL.


Related issues 5 (1 open4 closed)

Related to Foreman - Tracker #21834: Rails 5.2 upgrade tasksClosed

Actions
Related to Foreman - Refactor #23234: remove friendly_id <5.0 workaroundsClosedTomer BriskerActions
Related to Foreman - Tracker #24837: Rails 6.0 TrackerClosed

Actions
Related to Foreman - Refactor #29520: Wrap sql in Arel.sql() where neededClosedActions
Blocks Foreman - Tracker #28570: Rails 6.1 TrackerNew

Actions
Actions #1

Updated by Marek Hulán almost 6 years ago

  • Status changed from New to Need more information

Could you share the list of such places? Or is that based on brakeman scan only? Was it just Foreman core or also some plugins that you've scanned?

Actions #2

Updated by Anonymous almost 6 years ago

Brakeman is there: http://ci.theforeman.org/job/test_brakeman (although that's going to be deleted soon). The Rails 5.2 warnings can be seen in the new deprecations in https://github.com/theforeman/foreman/pull/5428

Actions #3

Updated by Martin Povolny almost 6 years ago

I started with Brakeman scan and `grep` and with Foreman only and did not spend much time on this yet.

I think that basic checking should be done on regular basis possibly as part of the CI and also for plugins. Brakeman can be used and/or services such as Hakiri (https://hakiri.io/).

I don't have a list of issues. Initial one can be obtained by running Brakeman.

In my opinion as a starting point all issues reported by Brakeman should be fixed or marked as false positives in the Brakeman config file (to be included with Foreman).

Actions #4

Updated by Anonymous almost 6 years ago

Actions #5

Updated by Anonymous almost 6 years ago

  • Tracker changed from Bug to Refactor
Actions #6

Updated by Anonymous almost 6 years ago

Actions #7

Updated by Anonymous almost 6 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5367 added
Actions #8

Updated by Anonymous over 5 years ago

Actions #9

Updated by Anonymous about 5 years ago

  • Status changed from Need more information to New
  • Pull request deleted (https://github.com/theforeman/foreman/pull/5367)
Actions #10

Updated by Anonymous almost 5 years ago

  • Related to Bug #26414: Api error when querying LDAP users added
Actions #11

Updated by Anonymous over 4 years ago

  • Related to deleted (Bug #26414: Api error when querying LDAP users )
Actions #12

Updated by Anonymous over 4 years ago

Actions #13

Updated by Anonymous over 4 years ago

Actions #14

Updated by Anonymous over 4 years ago

Actions #15

Updated by Anonymous almost 4 years ago

Actions #16

Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8979 added
Actions #17

Updated by The Foreman Bot about 2 years ago

  • Fixed in Releases 3.2.0 added
Actions #18

Updated by Leos Stejskal about 2 years ago

  • Status changed from Ready For Testing to Closed
Actions #19

Updated by Amit Upadhye about 2 years ago

  • Category set to Rails
Actions

Also available in: Atom PDF