Skip to content

Conversation

@clbr-odoo
Copy link
Contributor

Remove the Sender/Receiver checkbox. This checkbox is useless, it can be computed by checking the Peppol network.

There are two possible flows:

  • Either the company is already receiver on Peppol through another access point than Odoo -> we need to register him as a sender.
  • Either the company is not registered anywhere -> we must register him as a receiver on Odoo.

task-4394408

@clbr-odoo clbr-odoo requested a review from smetl February 11, 2025 14:33
@clbr-odoo clbr-odoo self-assigned this Feb 11, 2025
@robodoo
Copy link
Contributor

robodoo commented Feb 11, 2025

Pull request status dashboard

@clbr-odoo clbr-odoo force-pushed the master-peppol_send_receive_revamp-clbr branch 2 times, most recently from 4b01ad2 to 17a1053 Compare February 11, 2025 14:41
@C3POdoo C3POdoo added the RD research & development, internal work label Feb 11, 2025
@clbr-odoo clbr-odoo force-pushed the master-peppol_send_receive_revamp-clbr branch 3 times, most recently from 0774a6d to eab2da6 Compare February 12, 2025 13:21
@clbr-odoo clbr-odoo force-pushed the master-peppol_send_receive_revamp-clbr branch 3 times, most recently from eb6aeb6 to 0a2579f Compare February 12, 2025 18:33
Copy link
Contributor Author

@clbr-odoo clbr-odoo Feb 12, 2025

Choose a reason for hiding this comment

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

@aboo-odoo Regarding the security warning on the call above moved in a separate method, I'm afraid we can't avoid it...
The href contains the URL. We retrieve it from the call done to
smp_url = f"http://B-{hash_participant}.iso6523-actorid-upis.{sml_zone}.tech.ec.europa.eu/{endpoint_participant}" above. This domain is handled by Peppol who certifies Access Points that are registered on the network. The href content is built by those Access Points so I think it can be considered safe-ish by design.

Here is what those urls could look like:
First call that list services accepted by the user (which we can't know in advance):
http://b-b7a1e8b32951d519bbef26d9ac24804c.iso6523-actorid-upis.edelivery.tech.ec.europa.eu/iso6523-actorid-upis::0208:0246697724
Second (problematic) call done on the first href found above (in this case the Access Point is Odoo, but could be any Access Point validated by Open Peppol):
https://iap-services.odoo.com/iso6523-actorid-upis%3A%3A0208%3A0246697724/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-2%3A%3AInvoice%23%23urn%3Acen.eu%3Aen16931%3A2017%23compliant%23urn%3Afdc%3Apeppol.eu%3A2017%3Apoacc%3Abilling%3A3.0%3A%3A2.1

@aboo-odoo
Copy link
Contributor

aboo-odoo commented Feb 13, 2025

Hello @odoo/rd-security ,

Could we have your opinion on this ?

The method requests a URL that is given through an LXML etree element. The problem is see is if a user manages to find a way to generate any etree element elsewhere in Odoo, he can create a demo db on Odoo (he'll be admin), create a server action and use both the etree generator and this method to call any service through us.

What would be the best way to deal with that ? URLs in the etree element have no common part and can be anything returned to us by the PEPPOL service, so there is no way to make sure the URLs has a certain format. We could always make the method standalone. What do you think ?

@clbr-odoo clbr-odoo force-pushed the master-peppol_send_receive_revamp-clbr branch 3 times, most recently from b4f9854 to 635d10d Compare February 13, 2025 11:16
@smetl smetl requested a review from a team February 13, 2025 11:16
@clbr-odoo clbr-odoo added the 18.2 label Feb 13, 2025
@xmo-odoo
Copy link
Collaborator

The method requests a URL that is given through an LXML etree element. The problem is see is if a user manages to find a way to generate any etree element elsewhere in Odoo, he can create a demo db on Odoo (he'll be admin), create a server action and use both the etree generator and this method to call any service through us.

What would be the best way to deal with that ? URLs in the etree element have no common part and can be anything returned to us by the PEPPOL service, so there is no way to make sure the URLs has a certain format. We could always make the method standalone. What do you think ?

Why is it a separate method on a separate model in a separate file? It's called from just one location, and doesn't even use self. If you restrict (or remove) its access scope, it becomes hard or impossible to misuse.

Even better would be to have a separate object which is never returned from any method, and mediates all peppol interactions.

@clbr-odoo clbr-odoo force-pushed the master-peppol_send_receive_revamp-clbr branch 3 times, most recently from 61c9d7b to efeebbc Compare February 13, 2025 12:34
@clbr-odoo
Copy link
Contributor Author

clbr-odoo commented Feb 13, 2025

Hello, thank you for the review @xmo-odoo

Well in theory we could want to get that information for any partner, not just the company but you're right, for the moment we only use it in the context of the company, so why not encapsulate it.
We'll see later if the needs come.

Even better would be to have a separate object which is never returned from any method, and mediates all peppol interactions.

I don't get a clear idea of what you mean here. Do you suggest to move this kind of call in a separate Python (not Odoo model) class ? We could but that would only work for this call and the precedent call, which are the only two calls made to Peppol Network directly. The rest of the Peppol traffic happens trough the account_edi_proxy_user model + IAP so I don't think it will work that well 🤔 We're refactoring a lot of things around Peppol so I'm really open to discussion on a better design security-wise.

Can you please check again if the change is correct ? This task should be in the freeze 🙂
https://github.com/odoo/odoo/pull/197353/files#diff-eb787f70e3eec203d4a99f336cf054ee98ccf59de6c8e6b10a7ad722afec8ad2R281

Copy link
Collaborator

@xmo-odoo xmo-odoo left a comment

Choose a reason for hiding this comment

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

@robodoo override=ci/security

@clbr-odoo clbr-odoo force-pushed the master-peppol_send_receive_revamp-clbr branch from efeebbc to 3203ff3 Compare February 13, 2025 14:59
@xmo-odoo
Copy link
Collaborator

Do you suggest to move this kind of call in a separate Python (not Odoo model) class ?

Yes. IIRC the payment modules do that sort of things.

The rest of the Peppol traffic happens trough the account_edi_proxy_user model + IAP so I don't think it will work that well 🤔

Maybe it should not do that, and while that model can be used to store configuration it should not mediate the interactions themselves? Generally speaking, the issue is that models can be called directly from server actions or even over RPC, so there's not much separating the untrusted user from calls through. Free functions or non-model objects still require significant care in their use, but they can encapsulate and abstract the calls and provide less opportunity to leak out capabilities.

@clbr-odoo
Copy link
Contributor Author

I see, thank you for the insight. I was considering removing/decoupling that model for other good reasons, that's one more "pro" 👍

Remove the Sender/Receiver checkbox. This checkbox is useless, it can
be computed by checking the Peppol network.

There are two possible flows:
- Either the company is already receiver on Peppol through another access
point than Odoo -> we need to register him as a sender.
- Either the company is not registered anywhere -> we must register him
as a receiver on Odoo.

task-4394408
@clbr-odoo clbr-odoo force-pushed the master-peppol_send_receive_revamp-clbr branch from 3203ff3 to 6f8961d Compare February 13, 2025 15:19
@smetl
Copy link
Contributor

smetl commented Feb 13, 2025

@robodoo r+

robodoo pushed a commit that referenced this pull request Feb 13, 2025
Remove the Sender/Receiver checkbox. This checkbox is useless, it can
be computed by checking the Peppol network.

There are two possible flows:
- Either the company is already receiver on Peppol through another access
point than Odoo -> we need to register him as a sender.
- Either the company is not registered anywhere -> we must register him
as a receiver on Odoo.

task-4394408

closes #197353

Related: odoo/enterprise#79088
Related: odoo/upgrade#7206
Signed-off-by: Laurent Smet (las) <las@odoo.com>
@robodoo robodoo closed this Feb 13, 2025
@fw-bot fw-bot deleted the master-peppol_send_receive_revamp-clbr branch February 27, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

18.2 RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants