The compact_blank method returns a new ActionController::Parameters object, but that new object retains the permitted status from our earlier call to permit. There is a list of permitted method calls defined here but compact_blank is not listed there. It probably shouldn't be, because compact_blank on its own does not make the call safe, but being chained after permit ought to.
Is there a way to mark methods that are chained after permit as safe?
Background
Brakeman version: 6.2.2 Rails version: 8.0.0 Ruby version: 3.3.5
False Positive
Full warning from Brakeman:
Relevant code:
The
compact_blank
method returns a newActionController::Parameters
object, but that new object retains thepermitted
status from our earlier call topermit
. There is a list of permitted method calls defined here butcompact_blank
is not listed there. It probably shouldn't be, becausecompact_blank
on its own does not make the call safe, but being chained afterpermit
ought to.Is there a way to mark methods that are chained after
permit
as safe?