chore(daemon): remove untrusted socket #361
Merged
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.
As part of working on #358, we found out that the untrusted socket is not used, and so can be removed (in preparation for porting the
AccessChecker
changes from snapd in #358).Indicators that it's not used:
If we look at how
canAccess
works, if we match onuntrustedSocketPath
(isUntrusted
), the only way forcanAccess
to allow the request is whenc.UntrustedOK
istrue
(otherwise it unconditionally returnsaccessUnauthorized
immediately):So in order for any API calls to be allowed with the untrusted socket (assuming all API calls go through
canAccess
), we would need to have aCommand
defined withUntrustedOK: true
. Checking the Pebble codebase, no suchCommand
definition exists, which means that even if any application would use the untrusted socket currently, all API calls would returnaccessUnauthorized
unconditionally for this socket.The untrusted socket as well as
UntrustedOK
inCommand
were already part of the initial import commit (50466ba), so seem to be an inheritance from snapd that haven't seen use in Pebble since then. The corresponding snapd sources from around November 10th, 2020 seem to call theseSnapOK
(UntrustedOK
),dirs.SnapSocket
(untrustedSocketPath
) andsnapListener
(untrustedListener
).Due to
gofmt
and removal of struct members with the longest names, this PR is best reviewed with the "hide whitespace" option.