Skip to content

server.c: block privileged protocols for sandboxed clients - #2398

Merged
johanmalm merged 1 commit into
labwc:masterfrom
Consolatis:fix/block_unpriv_protos_for_sandboxed_clients
Dec 3, 2024
Merged

server.c: block privileged protocols for sandboxed clients#2398
johanmalm merged 1 commit into
labwc:masterfrom
Consolatis:fix/block_unpriv_protos_for_sandboxed_clients

Conversation

@Consolatis

@Consolatis Consolatis commented Dec 2, 2024

Copy link
Copy Markdown
Member

In the longer term we want this to be user-configurable (and also depend on the sandbox engine, app_id and instance).

But dropping privileged protocols for sandboxed clients in the meantime seems like a sensible thing to do and matches user expectations.

Related: #2392


I think we should add this before 0.8.2.

When we implement a user config for this we can also move the new functions into its own file, they feel a bit hacked onto server.c with this PR.

Can be tested with https://gitlab.freedesktop.org/wlroots/wlr-clients/-/merge_requests/6

@Consolatis
Consolatis force-pushed the fix/block_unpriv_protos_for_sandboxed_clients branch 2 times, most recently from 2696581 to a946125 Compare December 2, 2024 03:01
@tokyo4j

tokyo4j commented Dec 2, 2024

Copy link
Copy Markdown
Contributor

I'm a bit confused with allow_for_sandbox() in this PR. Do you mean we will add user-configurable whitelist for protocols allowed for sandboxed apps, like <allowedProtocols>minimal|minimalEnhanced|minimalEnhancedPlus<allowedProtocols>?

@Consolatis

Copy link
Copy Markdown
Member Author

Do you mean we will add user-configurable whitelist for protocols allowed for sandboxed apps, like <allowedProtocols>minimal|minimalEnhanced|minimalEnhancedPlus<allowedProtocols>?

No, that was more for being able to comprehend the accept list in code, I could throw them all into one array instead if preferred.

In the longer term I think we should allow users to define the interface names themselves which then get allowed or blocked based on security-context engine, app_id and instance + have a default list in case its not configured by the user.

When we get to implement user defined block lists I think we still need some kind of profiles though to keep the user configs maintainable. Maybe roughly something along the lines of #1004 (comment) just with new selectors rather than socket names, based on the security-context protocol.

@tokyo4j

tokyo4j commented Dec 2, 2024

Copy link
Copy Markdown
Contributor

OK. I read through #1004 and I support basic ideas suggested there.

But I still wonder why allow_for_sandbox() is added in this PR as it just looks like an inverted version of protocol_is_privileged().

@Consolatis

Consolatis commented Dec 2, 2024

Copy link
Copy Markdown
Member Author

But I still wonder why allow_for_sandbox() is added in this PR as it just looks like an inverted version of protocol_is_privileged().

Yep, it is. For sandboxes we really don't want to accidentally expose a privileged protocol, thus allowing everything on an accept list and rejecting everything else. protocol_is_privileged() is basically useless (and only there to influence WLR_ERROR vs WLR_DEBUG logging). The idea was actually to not log in the WLR_ERROR case but instead outright crash via assert(protocol_is_privileged(iface)). That should make sure that our lists are matching the protocols implemented in the compositor. However, I didn't want to take that risk in a cool-down period before a release, thus the log rather than the assert().

I am open to improve the PR though if there are specific things that should be changed.

Comment thread src/server.c Outdated
Comment thread src/server.c Outdated
@johanmalm

Copy link
Copy Markdown
Member

LGTM. Not tested.

@tokyo4j

tokyo4j commented Dec 3, 2024

Copy link
Copy Markdown
Contributor

LGTM. I've checked all the globals we're exposing are listed.

In the longer term we want this to be user-configurable (and also depend
on the sandbox engine, app_id and instance).

But dropping privileged protocols for sandboxed clients in the meantime
seems like a sensible thing to do and matches user expectations.

Related: labwc#2392
@Consolatis
Consolatis force-pushed the fix/block_unpriv_protos_for_sandboxed_clients branch from a946125 to 267d05a Compare December 3, 2024 18:14
@johanmalm
johanmalm merged commit f1e4376 into labwc:master Dec 3, 2024
@Consolatis
Consolatis deleted the fix/block_unpriv_protos_for_sandboxed_clients branch December 3, 2024 19:57
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.

3 participants