@@ -26,7 +26,8 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1>
2626< summary >
2727< span > Expand source code</ span >
2828</ summary >
29- < pre > < code class ="python "> from logging import Logger
29+ < pre > < code class ="python "> import html
30+ from logging import Logger
3031from typing import Optional
3132from typing import Union
3233
@@ -60,7 +61,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1>
6061 debug_message = f"Handling an OAuth callback success (request: {request.query})"
6162 self._logger.debug(debug_message)
6263
63- html = self._redirect_uri_page_renderer.render_success_page(
64+ page_content = self._redirect_uri_page_renderer.render_success_page(
6465 app_id=installation.app_id,
6566 team_id=installation.team_id,
6667 is_enterprise_install=installation.is_enterprise_install,
@@ -72,7 +73,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1>
7273 "Content-Type": "text/html; charset=utf-8",
7374 "Set-Cookie": self._state_utils.build_set_cookie_for_deletion(),
7475 },
75- body=html ,
76+ body=page_content ,
7677 )
7778
7879 def _build_callback_failure_response( # type: ignore
@@ -88,14 +89,13 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1>
8889 # Adding a bit more details to the error code to help installers understand what's happening.
8990 # This modification in the HTML page works only when developers use this built-in failure handler.
9091 detailed_error = build_detailed_error(reason)
91- html = self._redirect_uri_page_renderer.render_failure_page(detailed_error)
9292 return BoltResponse(
9393 status=status,
9494 headers={
9595 "Content-Type": "text/html; charset=utf-8",
9696 "Set-Cookie": self._state_utils.build_set_cookie_for_deletion(),
9797 },
98- body=html ,
98+ body=self._redirect_uri_page_renderer.render_failure_page(detailed_error) ,
9999 )
100100
101101
@@ -113,7 +113,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1>
113113</head>
114114<body>
115115<h2>Slack App Installation</h2>
116- <p><a href="{url}"><img alt=""Add to Slack"" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/
[email protected] 2x" /></a></p>
116+ <p><a href="{
html.escape( url
) }"><img alt=""Add to Slack"" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/
[email protected] 2x" /></a></p>
117117</body>
118118</html>
119119""" # noqa: E501
@@ -170,7 +170,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1>
170170 elif reason == "storage_error":
171171 return f"{reason}: The app's server encountered an issue. Contact the app developer."
172172 else:
173- return f"{reason}: This error code is returned from Slack. Refer to the documents for details."</ code > </ pre >
173+ return f"{html.escape( reason) }: This error code is returned from Slack. Refer to the documents for details."</ code > </ pre >
174174</ details >
175175</ section >
176176< section >
@@ -203,7 +203,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
203203 elif reason == "storage_error":
204204 return f"{reason}: The app's server encountered an issue. Contact the app developer."
205205 else:
206- return f"{reason}: This error code is returned from Slack. Refer to the documents for details."</ code > </ pre >
206+ return f"{html.escape( reason) }: This error code is returned from Slack. Refer to the documents for details."</ code > </ pre >
207207</ details >
208208</ dd >
209209< dt id ="slack_bolt.oauth.internals.get_or_create_default_installation_store "> < code class ="name flex ">
@@ -292,7 +292,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
292292 debug_message = f"Handling an OAuth callback success (request: {request.query})"
293293 self._logger.debug(debug_message)
294294
295- html = self._redirect_uri_page_renderer.render_success_page(
295+ page_content = self._redirect_uri_page_renderer.render_success_page(
296296 app_id=installation.app_id,
297297 team_id=installation.team_id,
298298 is_enterprise_install=installation.is_enterprise_install,
@@ -304,7 +304,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
304304 "Content-Type": "text/html; charset=utf-8",
305305 "Set-Cookie": self._state_utils.build_set_cookie_for_deletion(),
306306 },
307- body=html ,
307+ body=page_content ,
308308 )
309309
310310 def _build_callback_failure_response( # type: ignore
@@ -320,14 +320,13 @@ <h2 class="section-title" id="header-classes">Classes</h2>
320320 # Adding a bit more details to the error code to help installers understand what's happening.
321321 # This modification in the HTML page works only when developers use this built-in failure handler.
322322 detailed_error = build_detailed_error(reason)
323- html = self._redirect_uri_page_renderer.render_failure_page(detailed_error)
324323 return BoltResponse(
325324 status=status,
326325 headers={
327326 "Content-Type": "text/html; charset=utf-8",
328327 "Set-Cookie": self._state_utils.build_set_cookie_for_deletion(),
329328 },
330- body=html ,
329+ body=self._redirect_uri_page_renderer.render_failure_page(detailed_error) ,
331330 )</ code > </ pre >
332331</ details >
333332</ dd >
0 commit comments