-
Notifications
You must be signed in to change notification settings - Fork 839
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 content renderer not to embed external parameters as-is #1352
Conversation
@@ -90,13 +91,11 @@ The redirection gives you a ``code`` parameter. You can exchange the value for a | |||
redirect_uri=redirect_uri, | |||
code=request.args["code"] | |||
) | |||
|
|||
installed_enterprise = oauth_response.get("enterprise", {}) | |||
installed_enterprise = oauth_response.get("enterprise") or {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated improvements on the document example code
@@ -65,7 +66,7 @@ def render_failure_page(self, reason: str) -> str: | |||
</head> | |||
<body> | |||
<h2>Oops, Something Went Wrong!</h2> | |||
<p>Please try again from <a href="{self.install_path}">here</a> or contact the app owner (reason: {reason})</p> | |||
<p>Please try again from <a href="{html.escape(self.install_path)}">here</a> or contact the app owner (reason: {html.escape(reason)})</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the essential change in this PR. Only this pattern actually has issues.
… parameters as-is
b0c1e80
to
530acf9
Compare
Codecov Report
@@ Coverage Diff @@
## main #1352 +/- ##
=======================================
Coverage ? 85.37%
=======================================
Files ? 111
Lines ? 11557
Branches ? 0
=======================================
Hits ? 9867
Misses ? 1690
Partials ? 0
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Summary
This pull request improves the default OAuth page content renderer not to embed any external parameters without escaping them. It updates the document pages and example code under integration_tests/samples too.
Category (place an
x
in each of the[ ]
)/docs-src
(Documents, have you run./scripts/docs.sh
?)/docs-src-v2
(Documents, have you run./scripts/docs-v2.sh
?)/tutorial
(PythOnBoardingBot tutorial)tests
/integration_tests
(Automated tests for this library)Requirements (place an
x
in each[ ]
)python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh
after making the changes.