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

16.0 - Migration mail_embed_image #1402

Closed
wants to merge 18 commits into from

Conversation

imlopes
Copy link

@imlopes imlopes commented Jun 17, 2024

No description provided.

@imlopes imlopes marked this pull request as ready for review June 17, 2024 17:21
Copy link

@cyrilmanuel cyrilmanuel left a comment

Choose a reason for hiding this comment

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

not an expert but LGTM

).decode("utf-8")
image_content = response.content
filepart = MIMEImage(image_content)
filepart.add_header("Content-ID", f"<{cid}>")

Choose a reason for hiding this comment

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

ask : shall not be the cid.encode("utf-8") ?

@imlopes imlopes force-pushed the 16.0-mig-mail_embed_image branch from b7b8a38 to 8fcc1b9 Compare June 18, 2024 13:52
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

src = img.get("src")
if src and not src.startswith("data:") and not src.startswith("base64:"):
try:
response = requests.get(src, timeout=10)
Copy link
Member

Choose a reason for hiding this comment

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

the reason the original did the fetching in a somewhat roundabout way is that what you do here allows malicious users to craft emails to themselves and have Odoo fetch arbitrary resources from the internal network. Can be harmless, can be catastrophic depending on what's accessible from there

Copy link

@fliot fliot Aug 16, 2024

Choose a reason for hiding this comment

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

May be harmless or catastrophic...
Yes, probably.
Is functionally really expected, yes too.
Thanks @imlopes for this code.

Copy link
Author

Choose a reason for hiding this comment

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

thanks for the feedback @hbrunn @fliot
Im really not very comfortable with this kind of module. I've tried to keep as much as I could the original code but lot of changes between the original version and the new one on odoo side.

Copy link
Member

Choose a reason for hiding this comment

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

well as it is I really don't think it should be published.

But what was the problem? Currently you'd call https://github.com/OCA/OCB/blob/16.0/odoo/addons/base/models/ir_http.py#L95 which relieves you from constructing the routing map yourself, and you only need to create a dummy request bound to the public user in a pretty similar way the v10 version does it

@StephaneMangin
Copy link
Contributor

superseeded by #1499

@imlopes
Copy link
Author

imlopes commented Dec 12, 2024

Thanks a lot @StephaneMangin 🫶

@imlopes imlopes closed this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants