Repository navigation
Refuse input from sessions without host permission - #30
Open
masnwilliams wants to merge 1 commit into
Open
masnwilliams wants to merge 1 commit into
masnwilliams wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Summary
Refuse input from sessions whose member profile doesn't have host permission (
can_host: false), so a view-only member can watch without controlling the desktop.LegacyIsHost()returnsfalsewhen the profile can't host. Otherwise it keeps its existing behavior: true under implicit hosting, or when the session is the host.clipboardSet,keyboardMapandkeyboardModifiersrequirecan_host(clipboard set also requirescan_access_clipboard).controlReleaserequirescan_host.The checks use the profile's
can_hostrather thanIsHost(), because with legacy implicit hosting a session that may control isn't necessarily registered as the host.Sessions that can host behave as before, including the default admin and user profiles.
Tests
New unit tests:
internal/session:LegacyIsHostwith and without implicit hosting, for profiles that can and can't host.internal/websocket/handler: a session without host permission is refused for control request/release, move, key press, clipboard set, keyboard map and keyboard modifiers, with no desktop calls and no host change. A host-capable session still reaches the desktop for each.internal/webrtc: legacy data-channel move, key down and button down are dropped for a session without host permission and applied for a host-capable one.go vet ./internal/...andgo test ./...pass in the server build image.