1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Fix account param safety

This commit is contained in:
Rob Zolkos 2024-02-02 16:54:15 +00:00
parent 253ae29da0
commit 9aa9f99810
3 changed files with 11 additions and 7 deletions

View file

@ -33,8 +33,12 @@ class AccountsController < ApplicationController
end
def account_type_class
params[:type].constantize
rescue
Account # Default to Account if type is not provided or invalid
valid_account_types = %w[Checking CreditCard]
if params[:type].present? && valid_account_types.include?(params[:type])
params[:type].constantizes
else
Account # Default to Account if type is not provided or invalid
end
end
end