logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 92992c022d454f9489ce54aa8f6189456435a48a
parent 5e8bedcca0ebac6fc92733c4e3a95842c850165b
Author: Mark Felder <feld@feld.me>
Date:   Wed, 31 Jan 2024 11:29:06 -0500

Pleroma.Web.OAuth.OAuthController: dialyzer error

validate_scopes/2 can never receive a map as it is only called in one place with a guard requiring a list

lib/pleroma/web/o_auth/o_auth_controller.ex:615:guard_fail
The guard test:

is_map(_params :: maybe_improper_list())

can never succeed.

Diffstat:

Mlib/pleroma/web/o_auth/o_auth_controller.ex7+------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/pleroma/web/o_auth/o_auth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex @@ -610,13 +610,8 @@ defmodule Pleroma.Web.OAuth.OAuthController do end end - @spec validate_scopes(App.t(), map() | list()) :: + @spec validate_scopes(App.t(), list()) :: {:ok, list()} | {:error, :missing_scopes | :unsupported_scopes} - defp validate_scopes(%App{} = app, params) when is_map(params) do - requested_scopes = Scopes.fetch_scopes(params, app.scopes) - validate_scopes(app, requested_scopes) - end - defp validate_scopes(%App{} = app, requested_scopes) when is_list(requested_scopes) do Scopes.validate(requested_scopes, app.scopes) end