Skip to content

[19.0][FIX] endpoint: validate registry sync - #152

Open
le-goff-benoit wants to merge 1 commit into
OCA:19.0from
le-goff-benoit:validate-endpoint-registry-sync
Open

[19.0][FIX] endpoint: validate registry sync#152
le-goff-benoit wants to merge 1 commit into
OCA:19.0from
le-goff-benoit:validate-endpoint-registry-sync

Conversation

@le-goff-benoit

@le-goff-benoit le-goff-benoit commented Aug 18, 2026

Copy link
Copy Markdown

What changed

  • validate active endpoint records before scheduling a registry synchronization
  • compile dynamic routes with the exact converters exposed by ir.http
  • validate endpoint snippets against safe_eval syntax and detect unavailable global variables
  • derive accepted variables from the actual evaluation context and Odoo built-ins
  • keep invalid endpoints editable while preventing them from reaching endpoint_route
  • keep invalid inactive endpoints synchronizable so stale registry rules can be removed
  • repeat validation in controller registration methods as a defense for programmatic callers

Why

Werkzeug compiles every registered URL rule while Odoo builds its global routing map. A dynamic endpoint using an unknown converter, such as <date:value>, raises a LookupError and prevents the entire routing map from being built. This makes every application route return an error, not only the invalid endpoint.

Endpoint code snippets can also reference names that are not part of the safe_eval context. For example, date(...) is not available, while datetime is.

The endpoint model already separates editing from publication through the registry_sync action. This change uses that boundary to report actionable errors without preventing users from saving an invalid draft.

User impact

When an active invalid endpoint is synchronized, the user now receives a UserError listing the affected endpoint and its route or code errors. No invalid rule is written to the registry. After correcting the endpoint, the same synchronization action publishes it normally.

Validation

  • OCA pre-commit suite: passed
  • Odoo 19.0 CI image (py3.10-odoo19.0): 102 tests, 0 failures, 0 errors
  • regression tests cover unknown and malformed route converters, invalid safe_eval syntax, unavailable system variables, accepted built-ins, draft persistence, successful synchronization after correction, and removal of an invalid inactive route

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @simahawk,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added series:19.0 mod:endpoint Module endpoint mod:endpoint_route_handler Module endpoint_route_handler labels Aug 18, 2026
An unknown URL converter prevents Odoo from building the global routing map.
Validate active endpoints before they can be synchronized to the registry.

Also check endpoint snippets for safe_eval syntax and unavailable global
variables. Keep invalid endpoints editable and allow inactive records to
sync so stale registry rules can be removed.
@le-goff-benoit
le-goff-benoit force-pushed the validate-endpoint-registry-sync branch from 312e5c7 to 7f4722c Compare August 18, 2026 14:26
@le-goff-benoit
le-goff-benoit marked this pull request as ready for review August 18, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:endpoint_route_handler Module endpoint_route_handler mod:endpoint Module endpoint series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants