0

セキュリティの問題をチェックするために CircleCI を使用していますが、これはエラーとして表示されますが、それが正しいかどうかはわかりません。

これは、スクリプト エラーの 1 つを引き起こしているコード行です。

= link_to t(:delete), main_app.board_comment_path(@board, comment), method: :delete

これは有効なセキュリティ上の問題ですか? Brakeman にこれらのパラメータを安全なものとして受け入れさせる方法はありますか? 読み進めました--url-safe-methodsが、それを機能させる方法がわかりませんでした。

このリンクをガイドとして使用https://github.com/presidentbeef/brakeman/pull/45

を実行bundle exec brakeman -A -q --exit-on-warnしています。これはエラー レポートです。

+BRAKEMAN REPORT+

Application path: ****
Rails version: 4.2.2
Brakeman version: 3.0.4
Started at 2015-06-26 14:10:14 -0700
Duration: 1.8311 seconds
Checks run: BasicAuth, ContentTag, CreateWith, CrossSiteScripting, DefaultRoutes, Deserialize, DetailedExceptions, DigestDoS, EscapeFunction, Evaluation, Execute, FileAccess, FileDisclosure, FilterSkipping, ForgerySetting, HeaderDoS, I18nXSS, JRubyXML, JSONEncoding, JSONParsing, LinkTo, LinkToHref, MailTo, MassAssignment, ModelAttrAccessible, ModelAttributes, ModelSerialize, NestedAttributes, NumberToCurrency, QuoteTableName, Redirect, RegexDoS, Render, RenderDoS, RenderInline, ResponseSplitting, SQL, SQLCVEs, SSLVerify, SafeBufferManipulation, SanitizeMethods, SelectTag, SelectVulnerability, Send, SendFile, SessionSettings, SimpleFormat, SingleQuotes, SkipBeforeFilter, StripTags, SymbolDoS, SymbolDoSCVE, TranslateBug, UnsafeReflection, UnscopedFind, ValidationRegex, WithoutProtection, XMLDoS, YAMLParsing


+SUMMARY+

+-------------------+-------+
| Scanned/Reported  | Total |
+-------------------+-------+
| Controllers       | 23    |
| Models            | 9     |
| Templates         | 53    |
| Errors            | 0     |
| Security Warnings | 2 (0) |
+-------------------+-------+

+----------------------+-------+
| Warning Type         | Total |
+----------------------+-------+
| Cross Site Scripting | 2     |
+----------------------+-------+


View Warnings:

+------------+------------------------------------------------------------------+----------------------+-------------------->>
| Confidence | Template                                                         | Warning Type         | Message            >>
+------------+------------------------------------------------------------------+----------------------+-------------------->>
| Medium     | boards/show (BoardsController#show) | Cross Site Scripting | Unsafe parameter va>>
| Medium     | boards/show (BoardsController#show) | Cross Site Scripting | Unsafe parameter va>>
+------------+------------------------------------------------------------------+----------------------+-------------------->>
4

1 に答える 1

1

board_comment_pathパスを返すと仮定すると、これは (ほぼ確実に) 誤検知です。

Brakeman が の URL について警告する理由link_toは、 のような URL を設定できるためですjavascript:dangerous_stuff_here()。一般的な例は、ユーザーの Web サイトにリンクしているユーザー プロファイルです。

--url-safe-methodsへの入力をラップするメソッドにのみ適用されますlink_to。たとえば、link_to 'stuff', safe_url(some_input).

ただし、https://github.com/presidentbeef/brakeman/pull/674以降、 Brakeman は URL のパス ヘルパーに関する警告を停止し、すべてのタイプのメソッドに一致するように--safe-methods/も展開します。--url-safe-methods

于 2015-06-28T22:28:30.603 に答える