From 21b38cd7ccbc8c1ca7ee339090b4a7f27f8c2b18 Mon Sep 17 00:00:00 2001 From: Martin Emde Date: Sat, 21 Dec 2024 14:25:11 -0800 Subject: [PATCH] Fix places expecting arrays where it wasn't explicit --- app/controllers/api/v1/github_secret_scanning_controller.rb | 2 +- app/controllers/notifiers_controller.rb | 2 +- app/controllers/sendgrid_events_controller.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/github_secret_scanning_controller.rb b/app/controllers/api/v1/github_secret_scanning_controller.rb index 3200e0dcffb..8ef713a91c5 100644 --- a/app/controllers/api/v1/github_secret_scanning_controller.rb +++ b/app/controllers/api/v1/github_secret_scanning_controller.rb @@ -24,7 +24,7 @@ def revoke return render plain: "Can't fetch public key from GitHub", status: :unauthorized if key.empty_public_key? return render plain: "Invalid GitHub Signature", status: :unauthorized unless key.valid_github_signature?(signature, request.body.read.chomp) - tokens = params.expect(_json: %i[token type url]).index_by { |t| hashed_key(t.require(:token)) } + tokens = params.expect(_json: [%i[token type url]]).index_by { |t| hashed_key(t.require(:token)) } api_keys = ApiKey.where(hashed_key: tokens.keys).index_by(&:hashed_key) resp = tokens.map do |hashed_key, t| api_key = api_keys[hashed_key] diff --git a/app/controllers/notifiers_controller.rb b/app/controllers/notifiers_controller.rb index 0d7b5ca6318..d8d83f899a0 100644 --- a/app/controllers/notifiers_controller.rb +++ b/app/controllers/notifiers_controller.rb @@ -25,7 +25,7 @@ def update private def notifier_params - params.expect(ownerships: %i[push owner ownership_request]) + params.expect(ownerships: [%i[push owner ownership_request]]) end def notifier_options(param) diff --git a/app/controllers/sendgrid_events_controller.rb b/app/controllers/sendgrid_events_controller.rb index 5ed3c627d73..64e956e92e6 100644 --- a/app/controllers/sendgrid_events_controller.rb +++ b/app/controllers/sendgrid_events_controller.rb @@ -3,11 +3,11 @@ class SendgridEventsController < ApplicationController # Safelist documented SendGrid Event attributes # https://sendgrid.com/docs/API_Reference/Event_Webhook/event.html#-Event-objects - SENDGRID_EVENT_ATTRIBUTES = %i[ + SENDGRID_EVENT_ATTRIBUTES = [%i[ email timestamp smtp-id event category sg_event_id sg_message_id reason status response attempt useragent ip url asm_group_id tls unique_args marketing_campaign_id marketing_campaign_name pool type - ].freeze + ]].freeze skip_before_action :verify_authenticity_token, only: :create