ubus: propagate _luci_bg=1 query flag as session/access notouch - #39
Open
micpf wants to merge 1 commit into
Open
ubus: propagate _luci_bg=1 query flag as session/access notouch#39micpf wants to merge 1 commit into
micpf wants to merge 1 commit into
Conversation
LuCI's Poll callbacks issue XHRs continuously (typically every few
seconds) and each XHR goes through the /ubus/ endpoint. rpcd's
session/access ubus method refreshes the session idle timer on every
call, so the "sessiontime" idle timeout documented in /etc/config/rpcd
is never reached and the session lives forever.
Give LuCI a way to mark those background requests: when the request
URL carries "_luci_bg=1" (or "&_luci_bg=1"), forward the hint to rpcd
as the new "notouch" boolean on session/access.
Two paths reach session/access:
* uhttpd's internal permission check via uh_ubus_allowed(). Pass the
hint into the request when the flag is set.
* The JSON-RPC client can also invoke session/access directly (LuCI's
per-page callSessionAccess() ACL probes go this route). Inject the
hint into the RPC's own args in uh_ubus_send_request() when the
caller did not already set it, so the semantics match regardless
of how the browser reaches session/access.
The injected "notouch" key is a plain blobmsg attribute that any other
ubus object ignores via ordinary policy handling, so unrelated
services are unaffected. Requests without the query parameter behave
exactly as before, so behaviour is unchanged for callers that don't
opt in.
Depends on rpcd support for the "notouch" argument.
Signed-off-by: Michael Pfeifroth <micpf@westermo.com>
This was referenced Aug 7, 2026
Open
Contributor
|
I don't like the design, it's essentially hacking a LuCI specifc special case into the ubus HTTP gateway. My gut feeling is that this either should be an HTTP header (no query string, no ubus method call arg) or maybe even a property of the ubus ACL, shifting control entirely to the rpcd side and avoiding the need to expose any of that to uhttpd or LuCI while also paving the way for other potential flags in the future. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
LuCI's
Pollcallbacks issue XHRs every few seconds and each XHR goes through/ubus/. rpcd'ssession/accessrefreshes the session idle timer on every call, sooption sessiontimein/etc/config/rpcdnever fires while any LuCI page is open. See the rpcd PR (openwrt/rpcd#39) for the full write-up.Fix
Recognise a
_luci_bg=1query parameter on/ubus/and forward the hint to rpcd as the newnotouchboolean onsession/access.Two paths reach
session/access:uh_ubus_allowed(). Passnotouch=1into the request when the flag is set.callSessionAccess()ACL probes go this route. Injectnotouch=1into the RPC's own args inuh_ubus_send_request()when the caller did not already set it, so the semantics match regardless of how the browser reachessession/access.The injected
notouchkey is a plain blobmsg attribute that any other ubus object ignores via ordinary policy handling, so unrelated services are unaffected. Requests without_luci_bg=1are byte-for-byte identical to before.Dependencies
notouch(session: make rpc_session_get() a pure lookup and add "notouch" to session/access rpcd#39).On older rpcd the
notouchblob key is silently ignored, so it's safe to land this before the LuCI part.