Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the default OAuth page renderers not to embed any params without escaping them #882

Merged
merged 1 commit into from
Apr 13, 2023

Conversation

seratch
Copy link
Member

@seratch seratch commented Apr 13, 2023

In the same way with slackapi/python-slack-sdk#1352 , this pull request improves the default OAuth page renderers to escape any parameters when generating the page content.

Category (place an x in each of the [ ])

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements (place an x in each [ ])

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@seratch seratch added the bug Something isn't working label Apr 13, 2023
@seratch seratch added this to the 1.17.1 milestone Apr 13, 2023
@seratch seratch self-assigned this Apr 13, 2023
@seratch seratch force-pushed the improve-default-renderer branch from b634ba9 to bc61768 Compare April 13, 2023 03:05
@@ -58,7 +58,7 @@
),
include_package_data=True, # MANIFEST.in
install_requires=[
"slack_sdk>=3.20.2,<4",
"slack_sdk>=3.21.1,<4",
Copy link
Member Author

Choose a reason for hiding this comment

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

Set the version to use slackapi/python-slack-sdk#1352 for sure

@@ -32,7 +33,7 @@ def _build_callback_success_response( # type: ignore
debug_message = f"Handling an OAuth callback success (request: {request.query})"
self._logger.debug(debug_message)

html = self._redirect_uri_page_renderer.render_success_page(
page_content = self._redirect_uri_page_renderer.render_success_page(
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed the variable to avoid the name conflict with the module

@@ -142,4 +142,4 @@ def build_detailed_error(reason: str) -> str:
elif reason == "storage_error":
return f"{reason}: The app's server encountered an issue. Contact the app developer."
else:
return f"{reason}: This error code is returned from Slack. Refer to the documents for details."
return f"{html.escape(reason)}: This error code is returned from Slack. Refer to the documents for details."
Copy link
Member Author

Choose a reason for hiding this comment

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

for safety of custom renderers by developers

@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Merging #882 (bc61768) into main (eae0d4e) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #882   +/-   ##
=======================================
  Coverage   91.74%   91.74%           
=======================================
  Files         181      181           
  Lines        6285     6285           
=======================================
  Hits         5766     5766           
  Misses        519      519           
Impacted Files Coverage Δ
slack_bolt/oauth/internals.py 98.21% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@seratch seratch merged commit 7b4b082 into slackapi:main Apr 13, 2023
@seratch seratch deleted the improve-default-renderer branch April 13, 2023 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant