Skip to content

[18.0][FIX] base_remote: skip ensure_one on empty remotes during RPC auth#3611

Open
fsmw wants to merge 1 commit into
OCA:18.0from
fsmw:18.0-fix-base-remote-rpc-auth
Open

[18.0][FIX] base_remote: skip ensure_one on empty remotes during RPC auth#3611
fsmw wants to merge 1 commit into
OCA:18.0from
fsmw:18.0-fix-base-remote-rpc-auth

Conversation

@fsmw
Copy link
Copy Markdown

@fsmw fsmw commented May 16, 2026

Closes #3458

When authenticating via XML-RPC or JSON-RPC (no HTTP context), the
remote property returns an empty recordset. Calling ensure_one() on
it crashes with ValueError: Expected singleton: res.remote().

Web browser logins continue to work because httprequest.remote_addr
is always present and returns a single record.

Fix: add a truthiness guard so we only call ensure_one() when a
remote record exists, matching the same pattern already used for
test mode.

This is exactly the fix proposed in the issue report.

XML-RPC and JSON-RPC calls have no HTTP context, so remote
property returns an empty recordset. Calling ensure_one() on
it crashes with 'Expected singleton: res.remote()'.

Fix: add a truthiness guard, only enforce ensure_one when the
remote recordset is not empty, matching how the code already
handles test mode.

Fixes OCA#3458
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

base_remote: API authentication broken due to missing HTTP context check

2 participants