From ae287f459afbe6af2af1ec7d97c7cac08fa0c70d Mon Sep 17 00:00:00 2001 From: Bart de Water <496367+bdewater@users.noreply.github.com> Date: Sat, 25 Feb 2023 16:39:57 -0500 Subject: [PATCH] Add signatures for Action Controller content_security_policy and permissions_policy The block for content_security_policy should have bind(T.attached_class) but that's not possible with modules at the moment --- rbi/annotations/actionpack.rbi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rbi/annotations/actionpack.rbi b/rbi/annotations/actionpack.rbi index c2bba859..dc185035 100644 --- a/rbi/annotations/actionpack.rbi +++ b/rbi/annotations/actionpack.rbi @@ -4,6 +4,17 @@ class ActionController::API MODULES = T.let(T.unsafe(nil), T::Array[T.untyped]) end +module ActionController::ContentSecurityPolicy::ClassMethods + sig do + params( + enabled: T.untyped, + options: T.untyped, + block: T.nilable(T.proc.params(policy: ActionDispatch::ContentSecurityPolicy).void) + ).void + end + def content_security_policy(enabled = true, **options, &block); end +end + module ActionController::Flash::ClassMethods sig { params(types: Symbol).void } def add_flash_types(*types); end @@ -210,6 +221,13 @@ class ActionController::Parameters def values_at(*keys); end end +module ActionController::PermissionsPolicy::ClassMethods + sig do + params(options: T.untyped, block: T.nilable(T.proc.params(policy: ActionDispatch::PermissionsPolicy).void)).void + end + def permissions_policy(**options, &block); end +end + module ActionController::RequestForgeryProtection private