Skip to content

Cloud accounts list route block parameter checking #24

@lifeBCE

Description

@lifeBCE

The route block that handles listing all cloud accounts has a logic issue. It attempt to do some input parameter validation and supposed to return an error condition if required params are not found but this logic falls through to happy path logic every time because there is no use of 'halt'.

if params[:org_id].nil?
  message = Error.new.extend(ErrorRepresenter)
  message.message = "Must provide org_id with request for cloud accounts."
  [BAD_REQUEST, message.to_json]
elsif params[:account_id].nil?
  message = Error.new.extend(ErrorRepresenter)
  message.message = "Must provide account_id with request for cloud accounts."
  [BAD_REQUEST, message.to_json]
end

In a few other route blocks in this class, a return call is used in this case instead of a halt. All should be addressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions