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

[FW][FIX] *: use request.redirect instead of werkzeug.utils.redirect #94608

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Jun 24, 2022

It allows to always have a OdooResponse Object and don't allow redirect
to external except when you allow it explicitly with local=False.

Always return to a local url:
/website/add
/slides/slide/<model("slide.slide"):slide>
/microsoft_outlook/confirm

Allow previously external redirect without reason, now blocked
/website/lang/ -> open redirect

Allow external redirect for good reason and url is controlled by code.
/social_facebook/redirect_to_profile/

PS: HTTP Code 303 is a better default for generic redirects. It's not historically the default for werkzeug.utils, but it is what we want in general. Contrary to 302, there is no browser-dependent behavior, and no risk of asking the user whether they want to accept the redirect if the original method wasn't GET. It's always a non-permanent GET on the target location.

Forward-Port-Of: #93929

It allows to always have a OdooResponse Object and don't allow redirect
to external except when you allow it explicitly with local=False.

Always return to a local url:
    /website/add
    /slides/slide/<model("slide.slide"):slide>
    /microsoft_outlook/confirm

Allow previously external redirect without reason, now blocked
   /website/lang/<lang> -> open redirect

Allow external redirect for good reason and url is controlled by code.
   /social_facebook/redirect_to_profile/

PS: HTTP Code 303 is a better default for generic redirects. It's not
historically the default for werkzeug.utils, but it is what we want in
general. Contrary to 302, there is no browser-dependent behavior, and
no risk of asking the user whether they want to accept the redirect if
the original method wasn't GET. It's always a non-permanent GET on the
target location.

X-original-commit: f4cfa22
@robodoo
Copy link
Contributor

robodoo commented Jun 24, 2022

@fw-bot
Copy link
Contributor Author

fw-bot commented Jun 24, 2022

This PR targets saas-15.1 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Jun 24, 2022
@C3POdoo C3POdoo added the RD research & development, internal work label Jun 24, 2022
robodoo pushed a commit that referenced this pull request Jun 29, 2022
It allows to always have a OdooResponse Object and don't allow redirect
to external except when you allow it explicitly with local=False.

Always return to a local url:
    /website/add
    /slides/slide/<model("slide.slide"):slide>
    /microsoft_outlook/confirm

Allow previously external redirect without reason, now blocked
   /website/lang/<lang> -> open redirect

Allow external redirect for good reason and url is controlled by code.
   /social_facebook/redirect_to_profile/

PS: HTTP Code 303 is a better default for generic redirects. It's not
historically the default for werkzeug.utils, but it is what we want in
general. Contrary to 302, there is no browser-dependent behavior, and
no risk of asking the user whether they want to accept the redirect if
the original method wasn't GET. It's always a non-permanent GET on the
target location.

closes #94608

X-original-commit: f4cfa22
Related: odoo/enterprise#28874
Signed-off-by: Olivier Dony <odo@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
@robodoo
Copy link
Contributor

robodoo commented Jun 29, 2022

Linked pull request(s) odoo/enterprise#28874 not ready. Linked PRs are not staged until all of them are ready.

robodoo pushed a commit that referenced this pull request Jul 1, 2022
It allows to always have a OdooResponse Object and don't allow redirect
to external except when you allow it explicitly with local=False.

Always return to a local url:
    /website/add
    /slides/slide/<model("slide.slide"):slide>
    /microsoft_outlook/confirm

Allow previously external redirect without reason, now blocked
   /website/lang/<lang> -> open redirect

Allow external redirect for good reason and url is controlled by code.
   /social_facebook/redirect_to_profile/

PS: HTTP Code 303 is a better default for generic redirects. It's not
historically the default for werkzeug.utils, but it is what we want in
general. Contrary to 302, there is no browser-dependent behavior, and
no risk of asking the user whether they want to accept the redirect if
the original method wasn't GET. It's always a non-permanent GET on the
target location.

closes #94608

X-original-commit: f4cfa22
Related: odoo/enterprise#28874
Signed-off-by: Olivier Dony <odo@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
@robodoo robodoo closed this Jul 1, 2022
@robodoo robodoo temporarily deployed to merge July 1, 2022 15:35 Inactive
@fw-bot fw-bot deleted the saas-15.1-15.0-req-redirect-jke-KaGb-fw branch July 15, 2022 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwardport This PR was created by @fw-bot RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants