2017-05-07 03:45:34 +03:00
{
"ignored_warnings": [
2018-08-18 04:03:12 +03:00
{
"warning_type": "SQL Injection",
"warning_code": 0,
"fingerprint": "04dbbc249b989db2e0119bbb0f59c9818e12889d2b97c529cdc0b1526002ba4b",
"check_name": "SQL",
"message": "Possible SQL injection",
"file": "app/models/report.rb",
2020-06-02 20:24:53 +03:00
"line": 112,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
"code": "Admin::ActionLog.from(\"(#{[Admin::ActionLog.where(:target_type => \"Report\", :target_id => id, :created_at => ((created_at..updated_at))).unscope(:order), Admin::ActionLog.where(:target_type => \"Account\", :target_id => target_account_id, :created_at => ((created_at..updated_at))).unscope(:order), Admin::ActionLog.where(:target_type => \"Status\", :target_id => status_ids, :created_at => ((created_at..updated_at))).unscope(:order)].map do\n \"(#{query.to_sql})\"\n end.join(\" UNION ALL \")}) AS admin_action_logs\")",
"render_path": null,
"location": {
"type": "method",
"class": "Report",
"method": "history"
},
"user_input": "Admin::ActionLog.where(:target_type => \"Status\", :target_id => status_ids, :created_at => ((created_at..updated_at))).unscope(:order)",
"confidence": "High",
"note": ""
},
2018-11-05 19:53:25 +02:00
{
"warning_type": "SQL Injection",
"warning_code": 0,
"fingerprint": "19df3740b8d02a9fe0eb52c939b4b87d3a2a591162a6adfa8d64e9c26aeebe6d",
"check_name": "SQL",
"message": "Possible SQL injection",
"file": "app/models/status.rb",
2020-06-02 20:24:53 +03:00
"line": 100,
2018-11-05 19:53:25 +02:00
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
"code": "result.joins(\"INNER JOIN statuses_tags t#{id} ON t#{id}.status_id = statuses.id AND t#{id}.tag_id = #{id}\")",
"render_path": null,
"location": {
"type": "method",
"class": "Status",
"method": null
},
"user_input": "id",
"confidence": "Weak",
"note": ""
},
2018-08-18 04:03:12 +03:00
{
2020-06-02 20:24:53 +03:00
"warning_type": "Dynamic Render Path",
"warning_code": 15,
"fingerprint": "20a660939f2bbf8c665e69f2844031c0564524689a9570a0091ed94846212020",
"check_name": "Render",
"message": "Render path contains parameter value",
"file": "app/views/admin/action_logs/index.html.haml",
"line": 26,
"link": "https://brakemanscanner.org/docs/warning_types/dynamic_render_path/",
"code": "render(action => Admin::ActionLogFilter.new(filter_params).results.page(params[:page]), {})",
"render_path": [
{
"type": "controller",
"class": "Admin::ActionLogsController",
"method": "index",
"line": 8,
"file": "app/controllers/admin/action_logs_controller.rb",
"rendered": {
"name": "admin/action_logs/index",
"file": "app/views/admin/action_logs/index.html.haml"
}
}
],
2018-08-18 04:03:12 +03:00
"location": {
2020-06-02 20:24:53 +03:00
"type": "template",
"template": "admin/action_logs/index"
2018-08-18 04:03:12 +03:00
},
2020-06-02 20:24:53 +03:00
"user_input": "params[:page]",
"confidence": "Weak",
2018-08-18 04:03:12 +03:00
"note": ""
},
2017-11-24 03:05:53 +02:00
{
"warning_type": "Dynamic Render Path",
"warning_code": 15,
2020-06-02 20:24:53 +03:00
"fingerprint": "371fe16dc4c9d6ab08a20437d65be4825776107a67c38f6d4780a9c703cd44a5",
2017-11-24 03:05:53 +02:00
"check_name": "Render",
"message": "Render path contains parameter value",
2020-06-02 20:24:53 +03:00
"file": "app/views/admin/email_domain_blocks/index.html.haml",
"line": 17,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/dynamic_render_path/",
2020-06-02 20:24:53 +03:00
"code": "render(action => EmailDomainBlock.where(:parent_id => nil).includes(:children).order(:id => :desc).page(params[:page]), {})",
"render_path": [
{
"type": "controller",
"class": "Admin::EmailDomainBlocksController",
"method": "index",
"line": 10,
"file": "app/controllers/admin/email_domain_blocks_controller.rb",
"rendered": {
"name": "admin/email_domain_blocks/index",
"file": "app/views/admin/email_domain_blocks/index.html.haml"
}
}
],
2017-11-24 03:05:53 +02:00
"location": {
"type": "template",
2020-06-02 20:24:53 +03:00
"template": "admin/email_domain_blocks/index"
2017-11-24 03:05:53 +02:00
},
"user_input": "params[:page]",
"confidence": "Weak",
"note": ""
},
2020-12-14 10:06:34 +02:00
{
"warning_type": "Dynamic Render Path",
"warning_code": 15,
"fingerprint": "4704e8093e3e0561bf705f892e8fc6780419f8255f4440b1c0afd09339bd6446",
"check_name": "Render",
"message": "Render path contains parameter value",
"file": "app/views/admin/instances/index.html.haml",
"line": 39,
"link": "https://brakemanscanner.org/docs/warning_types/dynamic_render_path/",
"code": "render(action => filtered_instances.page(params[:page]), {})",
"render_path": [
{
"type": "controller",
"class": "Admin::InstancesController",
"method": "index",
"line": 10,
"file": "app/controllers/admin/instances_controller.rb",
"rendered": {
"name": "admin/instances/index",
"file": "app/views/admin/instances/index.html.haml"
}
}
],
"location": {
"type": "template",
"template": "admin/instances/index"
},
"user_input": "params[:page]",
"confidence": "Weak",
"note": ""
},
2018-08-18 04:03:12 +03:00
{
"warning_type": "Redirect",
"warning_code": 18,
"fingerprint": "5fad11cd67f905fab9b1d5739d01384a1748ebe78c5af5ac31518201925265a7",
"check_name": "Redirect",
"message": "Possible unprotected redirect",
"file": "app/controllers/remote_interaction_controller.rb",
2020-06-02 20:24:53 +03:00
"line": 24,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/redirect/",
"code": "redirect_to(RemoteFollow.new(resource_params).interact_address_for(Status.find(params[:id])))",
"render_path": null,
"location": {
"type": "method",
"class": "RemoteInteractionController",
"method": "create"
},
"user_input": "RemoteFollow.new(resource_params).interact_address_for(Status.find(params[:id]))",
"confidence": "High",
"note": ""
},
2020-12-14 10:06:34 +02:00
{
"warning_type": "SQL Injection",
"warning_code": 0,
"fingerprint": "6e4051854bb62e2ddbc671f82d6c2328892e1134b8b28105ecba9b0122540714",
"check_name": "SQL",
"message": "Possible SQL injection",
"file": "app/models/account.rb",
"line": 491,
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
"code": "find_by_sql([\" WITH first_degree AS (\\n SELECT target_account_id\\n FROM follows\\n WHERE account_id = ?\\n UNION ALL\\n SELECT ?\\n )\\n SELECT\\n accounts.*,\\n (count(f.id) + 1) * ts_rank_cd(#{textsearch}, #{query}, 32) AS rank\\n FROM accounts\\n LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?)\\n WHERE accounts.id IN (SELECT * FROM first_degree)\\n AND #{query} @@ #{textsearch}\\n AND accounts.suspended_at IS NULL\\n AND accounts.moved_to_account_id IS NULL\\n GROUP BY accounts.id\\n ORDER BY rank DESC\\n LIMIT ? OFFSET ?\\n\".squish, account.id, account.id, account.id, limit, offset])",
"render_path": null,
"location": {
"type": "method",
"class": "Account",
"method": "advanced_search_for"
},
"user_input": "textsearch",
"confidence": "Medium",
"note": ""
},
2018-11-05 19:53:25 +02:00
{
"warning_type": "SQL Injection",
"warning_code": 0,
"fingerprint": "6f075c1484908e3ec9bed21ab7cf3c7866be8da3881485d1c82e13093aefcbd7",
"check_name": "SQL",
"message": "Possible SQL injection",
"file": "app/models/status.rb",
2020-06-02 20:24:53 +03:00
"line": 105,
2018-11-05 19:53:25 +02:00
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
"code": "result.joins(\"LEFT OUTER JOIN statuses_tags t#{id} ON t#{id}.status_id = statuses.id AND t#{id}.tag_id = #{id}\")",
"render_path": null,
"location": {
"type": "method",
"class": "Status",
"method": null
},
"user_input": "id",
"confidence": "Weak",
"note": ""
},
2017-11-07 15:49:32 +02:00
{
2020-06-02 20:24:53 +03:00
"warning_type": "Mass Assignment",
"warning_code": 105,
"fingerprint": "7631e93d0099506e7c3e5c91ba8d88523b00a41a0834ae30031a5a4e8bb3020a",
"check_name": "PermitAttributes",
"message": "Potentially dangerous key allowed for mass assignment",
"file": "app/controllers/api/v2/search_controller.rb",
"line": 28,
"link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/",
"code": "params.permit(:type, :offset, :min_id, :max_id, :account_id)",
"render_path": null,
2017-11-07 15:49:32 +02:00
"location": {
2020-06-02 20:24:53 +03:00
"type": "method",
"class": "Api::V2::SearchController",
"method": "search_params"
2017-11-07 15:49:32 +02:00
},
2020-06-02 20:24:53 +03:00
"user_input": ":account_id",
"confidence": "High",
"note": ""
},
{
2020-12-14 10:06:34 +02:00
"warning_type": "SQL Injection",
"warning_code": 0,
"fingerprint": "9251d682c4e2840e1b2fea91e7d758efe2097ecb7f6255c065e3750d25eb178c",
"check_name": "SQL",
"message": "Possible SQL injection",
"file": "app/models/account.rb",
"line": 460,
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
"code": "find_by_sql([\" SELECT\\n accounts.*,\\n ts_rank_cd(#{textsearch}, #{query}, 32) AS rank\\n FROM accounts\\n WHERE #{query} @@ #{textsearch}\\n AND accounts.suspended_at IS NULL\\n AND accounts.moved_to_account_id IS NULL\\n ORDER BY rank DESC\\n LIMIT ? OFFSET ?\\n\".squish, limit, offset])",
2020-06-02 20:24:53 +03:00
"render_path": null,
"location": {
"type": "method",
2020-12-14 10:06:34 +02:00
"class": "Account",
"method": "search_for"
2020-06-02 20:24:53 +03:00
},
2020-12-14 10:06:34 +02:00
"user_input": "textsearch",
"confidence": "Medium",
2017-11-07 15:49:32 +02:00
"note": ""
},
2017-10-08 18:34:34 +03:00
{
"warning_type": "SQL Injection",
"warning_code": 0,
"fingerprint": "9ccb9ba6a6947400e187d515e0bf719d22993d37cfc123c824d7fafa6caa9ac3",
"check_name": "SQL",
"message": "Possible SQL injection",
"file": "lib/mastodon/snowflake.rb",
2017-11-07 15:49:32 +02:00
"line": 87,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
2017-10-08 18:34:34 +03:00
"code": "connection.execute(\" CREATE OR REPLACE FUNCTION timestamp_id(table_name text)\\n RETURNS bigint AS\\n $$\\n DECLARE\\n time_part bigint;\\n sequence_base bigint;\\n tail bigint;\\n BEGIN\\n time_part := (\\n -- Get the time in milliseconds\\n ((date_part('epoch', now()) * 1000))::bigint\\n -- And shift it over two bytes\\n << 16);\\n\\n sequence_base := (\\n 'x' ||\\n -- Take the first two bytes (four hex characters)\\n substr(\\n -- Of the MD5 hash of the data we documented\\n md5(table_name ||\\n '#{SecureRandom.hex(16)}' ||\\n time_part::text\\n ),\\n 1, 4\\n )\\n -- And turn it into a bigint\\n )::bit(16)::bigint;\\n\\n -- Finally, add our sequence number to our base, and chop\\n -- it to the last two bytes\\n tail := (\\n (sequence_base + nextval(table_name || '_id_seq'))\\n & 65535);\\n\\n -- Return the time part and the sequence part. OR appears\\n -- faster here than addition, but they're equivalent:\\n -- time_part has no trailing two bytes, and tail is only\\n -- the last two bytes.\\n RETURN time_part | tail;\\n END\\n $$ LANGUAGE plpgsql VOLATILE;\\n\")",
"render_path": null,
"location": {
"type": "method",
"class": "Mastodon::Snowflake",
"method": "define_timestamp_id"
},
"user_input": "SecureRandom.hex(16)",
"confidence": "Medium",
"note": ""
},
2017-05-07 03:45:34 +03:00
{
"warning_type": "Dynamic Render Path",
"warning_code": 15,
"fingerprint": "9f31d941f3910dba2e9bfcd81aef4513249bd24c02d0f98e13ad44fdeeccd0e8",
"check_name": "Render",
"message": "Render path contains parameter value",
"file": "app/views/admin/accounts/index.html.haml",
2020-06-02 20:24:53 +03:00
"line": 54,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/dynamic_render_path/",
2017-05-07 03:45:34 +03:00
"code": "render(action => filtered_accounts.page(params[:page]), {})",
2020-06-02 20:24:53 +03:00
"render_path": [
{
"type": "controller",
"class": "Admin::AccountsController",
"method": "index",
"line": 12,
"file": "app/controllers/admin/accounts_controller.rb",
"rendered": {
"name": "admin/accounts/index",
"file": "app/views/admin/accounts/index.html.haml"
}
}
],
2017-05-07 03:45:34 +03:00
"location": {
"type": "template",
"template": "admin/accounts/index"
},
"user_input": "params[:page]",
"confidence": "Weak",
"note": ""
},
2018-02-16 08:22:20 +02:00
{
"warning_type": "Redirect",
"warning_code": 18,
2020-06-02 20:24:53 +03:00
"fingerprint": "ba568ac09683f98740f663f3d850c31785900215992e8c090497d359a2563d50",
2018-02-16 08:22:20 +02:00
"check_name": "Redirect",
"message": "Possible unprotected redirect",
2020-06-02 20:24:53 +03:00
"file": "app/controllers/remote_follow_controller.rb",
"line": 21,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/redirect/",
2020-06-02 20:24:53 +03:00
"code": "redirect_to(RemoteFollow.new(resource_params).subscribe_address_for(@account))",
2018-02-16 08:22:20 +02:00
"render_path": null,
"location": {
"type": "method",
2020-06-02 20:24:53 +03:00
"class": "RemoteFollowController",
"method": "create"
2018-02-16 08:22:20 +02:00
},
2020-06-02 20:24:53 +03:00
"user_input": "RemoteFollow.new(resource_params).subscribe_address_for(@account)",
2018-02-16 08:22:20 +02:00
"confidence": "High",
"note": ""
},
2017-05-07 03:45:34 +03:00
{
"warning_type": "Redirect",
"warning_code": 18,
2020-06-02 20:24:53 +03:00
"fingerprint": "ba699ddcc6552c422c4ecd50d2cd217f616a2446659e185a50b05a0f2dad8d33",
2017-05-07 03:45:34 +03:00
"check_name": "Redirect",
"message": "Possible unprotected redirect",
2020-06-02 20:24:53 +03:00
"file": "app/controllers/media_controller.rb",
"line": 20,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/redirect/",
2020-06-02 20:24:53 +03:00
"code": "redirect_to(MediaAttachment.attached.find_by!(:shortcode => ((params[:id] or params[:medium_id]))).file.url(:original))",
2017-05-07 03:45:34 +03:00
"render_path": null,
"location": {
"type": "method",
2020-06-02 20:24:53 +03:00
"class": "MediaController",
"method": "show"
2017-05-07 03:45:34 +03:00
},
2020-06-02 20:24:53 +03:00
"user_input": "MediaAttachment.attached.find_by!(:shortcode => ((params[:id] or params[:medium_id]))).file.url(:original)",
2017-05-07 03:45:34 +03:00
"confidence": "High",
"note": ""
},
2020-12-14 10:06:34 +02:00
{
"warning_type": "SQL Injection",
"warning_code": 0,
"fingerprint": "e21d8fee7a5805761679877ca35ed1029c64c45ef3b4012a30262623e1ba8bb9",
"check_name": "SQL",
"message": "Possible SQL injection",
"file": "app/models/account.rb",
"line": 507,
"link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
"code": "find_by_sql([\" SELECT\\n accounts.*,\\n (count(f.id) + 1) * ts_rank_cd(#{textsearch}, #{query}, 32) AS rank\\n FROM accounts\\n LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?) OR (accounts.id = f.target_account_id AND f.account_id = ?)\\n WHERE #{query} @@ #{textsearch}\\n AND accounts.suspended_at IS NULL\\n AND accounts.moved_to_account_id IS NULL\\n GROUP BY accounts.id\\n ORDER BY rank DESC\\n LIMIT ? OFFSET ?\\n\".squish, account.id, account.id, limit, offset])",
"render_path": null,
"location": {
"type": "method",
"class": "Account",
"method": "advanced_search_for"
},
"user_input": "textsearch",
"confidence": "Medium",
"note": ""
},
2018-08-18 04:03:12 +03:00
{
"warning_type": "Mass Assignment",
"warning_code": 105,
"fingerprint": "e867661b2c9812bc8b75a5df12b28e2a53ab97015de0638b4e732fe442561b28",
"check_name": "PermitAttributes",
"message": "Potentially dangerous key allowed for mass assignment",
"file": "app/controllers/api/v1/reports_controller.rb",
Add type, limit, offset, min_id, max_id, account_id to search API (#10091)
* Add type, limit, offset, min_id, max_id, account_id to search API
Fix #8939
* Make the offset work on accounts and hashtags search as well
* Assure brakeman we are not doing mass assignment here
* Do not allow paginating unless a type is chosen
* Fix search query and index id field on statuses instead of created_at
2019-02-26 16:21:36 +02:00
"line": 36,
2018-08-18 04:03:12 +03:00
"link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/",
"code": "params.permit(:account_id, :comment, :forward, :status_ids => ([]))",
"render_path": null,
"location": {
"type": "method",
"class": "Api::V1::ReportsController",
"method": "report_params"
},
"user_input": ":account_id",
"confidence": "High",
"note": ""
2017-05-07 03:45:34 +03:00
}
],
2020-12-14 10:06:34 +02:00
"updated": "2020-12-07 01:17:13 +0100",
"brakeman_version": "4.10.0"
2017-05-07 03:45:34 +03:00
}