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

Use safe redirect paths in admin redirects #3129

Merged
merged 2 commits into from
Jan 6, 2025
Merged

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Jan 5, 2025

What is this pull request for?

This makes sure all redirects we do in the admin via do_redirect_to uses a safe redirect url.

Notable changes

Introduces safe_redirect_path method, that makes sure we only redirect internally
in the /admin routing context and redirect to a given safe fallback location or the
default admin route.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@tvdeyen tvdeyen self-assigned this Jan 5, 2025
@tvdeyen tvdeyen changed the title Use safe_redirect_path in admin redirects Use safe redirect paths in admin redirects Jan 5, 2025
This makes sure we only redirect internally in the /admin routing context
and redirect to a given safe fallback location or the default admin route.
@tvdeyen tvdeyen force-pushed the safe-redirect-path branch from e97046f to 6b064de Compare January 5, 2025 15:10
This makes sure all redirects we do in the admin via do_redirect_to uses a safe redirect url.
@tvdeyen tvdeyen force-pushed the safe-redirect-path branch from 6b064de to 7adefce Compare January 5, 2025 15:30
@tvdeyen tvdeyen added backport-to-7.0-stable Needs to be backported to 7.0-stable backport-to-7.1-stable Needs to be backported to 7.1-stable backport-to-7.2-stable Needs to be backported to 7.2-stable backport-to-7.3-stable Needs to be backported to 7.3-stable backport-to-7.4-stable Needs to be backported to 7.4-stable labels Jan 5, 2025
@tvdeyen tvdeyen marked this pull request as ready for review January 5, 2025 15:31
@tvdeyen tvdeyen requested a review from a team as a code owner January 5, 2025 15:31
Copy link

codecov bot commented Jan 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.58%. Comparing base (640486d) to head (7adefce).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3129   +/-   ##
=======================================
  Coverage   96.58%   96.58%           
=======================================
  Files         236      236           
  Lines        6347     6360   +13     
=======================================
+ Hits         6130     6143   +13     
  Misses        217      217           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tvdeyen tvdeyen added this to the 7.4 milestone Jan 5, 2025
@tvdeyen tvdeyen merged commit 17416ee into main Jan 6, 2025
57 of 58 checks passed
@tvdeyen tvdeyen deleted the safe-redirect-path branch January 6, 2025 16:24
@alchemycms-bot
Copy link
Collaborator

💔 Some backports could not be created

Status Branch Result
7.0-stable Backport failed because of merge conflicts

You might need to backport the following PRs to 7.0-stable:
- Add safe_redirect_path
7.1-stable Backport failed because of merge conflicts

You might need to backport the following PRs to 7.1-stable:
- Add safe_redirect_path
7.2-stable Backport failed because of merge conflicts

You might need to backport the following PRs to 7.2-stable:
- Add safe_redirect_path
7.3-stable Backport failed because of merge conflicts

You might need to backport the following PRs to 7.3-stable:
- Add safe_redirect_path
7.4-stable

Manual backport

To create the backport manually run:

backport --pr 3129

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@tvdeyen
Copy link
Member Author

tvdeyen commented Jan 7, 2025

💚 All backports created successfully

Status Branch Result
7.0-stable

Questions ?

Please refer to the Backport tool documentation

@tvdeyen
Copy link
Member Author

tvdeyen commented Jan 7, 2025

💚 All backports created successfully

Status Branch Result
7.1-stable

Questions ?

Please refer to the Backport tool documentation

@tvdeyen
Copy link
Member Author

tvdeyen commented Jan 7, 2025

💚 All backports created successfully

Status Branch Result
7.2-stable

Questions ?

Please refer to the Backport tool documentation

@tvdeyen
Copy link
Member Author

tvdeyen commented Jan 7, 2025

💚 All backports created successfully

Status Branch Result
7.3-stable

Questions ?

Please refer to the Backport tool documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-7.0-stable Needs to be backported to 7.0-stable backport-to-7.1-stable Needs to be backported to 7.1-stable backport-to-7.2-stable Needs to be backported to 7.2-stable backport-to-7.3-stable Needs to be backported to 7.3-stable backport-to-7.4-stable Needs to be backported to 7.4-stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants