@@ -89,6 +89,47 @@ def command_handler(ack):
8989 assert response .headers .get ("content-type" ) == "text/plain;charset=utf-8"
9090 assert_auth_test_count (self , 1 )
9191
92+ def test_ssl_check_param_does_not_bypass_request_verification (self ):
93+ app = App (
94+ client = self .web_client ,
95+ signing_secret = self .signing_secret ,
96+ ssl_check_enabled = False ,
97+ )
98+ command_called = False
99+
100+ def command_handler (ack ):
101+ nonlocal command_called
102+ command_called = True
103+ ack ()
104+
105+ app .command ("/hello-world" )(command_handler )
106+
107+ body = (
108+ "token=verification_token"
109+ "&team_id=T111"
110+ "&team_domain=test-domain"
111+ "&channel_id=C111"
112+ "&channel_name=random"
113+ "&user_id=W111"
114+ "&user_name=primary-owner"
115+ "&command=%2Fhello-world"
116+ "&text=Hi"
117+ "&enterprise_id=E111"
118+ "&enterprise_name=Org+Name"
119+ "&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%2FT111%2F111%2Fxxxxx"
120+ "&trigger_id=111.111.xxx"
121+ "&ssl_check=1"
122+ )
123+ headers = self .build_raw_headers ("0" , body )
124+ headers ["x-slack-signature" ] = "v0=invalid"
125+
126+ wsgi_server = WsgiTestServer (SlackRequestHandler (app ))
127+ response = wsgi_server .http (method = "POST" , headers = headers , body = body )
128+
129+ assert response .status == "401 Unauthorized"
130+ assert response .body == """{"error": "invalid request"}"""
131+ assert command_called is False
132+
92133 def test_events (self ):
93134 app = App (
94135 client = self .web_client ,
0 commit comments