Skip to content

Conversation

@Mohamad-Mortada
Copy link
Member

@Mohamad-Mortada Mohamad-Mortada commented Jan 17, 2026

Summary of the problem

This is causing grantees to not be able to freeze their cards as authorize fails on policy of update. So we authorize at something more acceptable such as show? and we handle policy per action (freeze, defrost, and activate). Ideally these shouldve been their own methods.

Describe your changes

change inital authorize

@Mohamad-Mortada Mohamad-Mortada requested a review from a team January 17, 2026 04:54
@Mohamad-Mortada Mohamad-Mortada marked this pull request as draft January 17, 2026 04:58
@Mohamad-Mortada Mohamad-Mortada changed the title [v4] remove redundant authorize on Stripe Card update [v4] allow freezing on Stripe Card update Jan 17, 2026
@Mohamad-Mortada Mohamad-Mortada changed the title [v4] allow freezing on Stripe Card update [v4] allow freezing on Stripe Card for grantees Jan 17, 2026
@Mohamad-Mortada Mohamad-Mortada changed the title [v4] allow freezing on Stripe Card for grantees [v4] allow freezing on stripe cards grantees Jan 17, 2026
@Mohamad-Mortada Mohamad-Mortada marked this pull request as ready for review January 17, 2026 05:05
@Mohamad-Mortada Mohamad-Mortada changed the title [v4] allow freezing on stripe cards grantees [v4] allow freezing on stripe cards as grantees Jan 17, 2026
Comment on lines +75 to +77
@stripe_card = StripeCard.find_by_public_id!(params[:id])
# we authorize by show as actions are handled by their own policies (update interferes with this)
authorize @stripe_card, :show?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels really unsafe. also, where are these policy calls being made?

Copy link
Member

@sampoder sampoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't be using the show? policy for updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants