Skip to content

firewall: session-dependent privacy flags #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Apr 30, 2024

Conversation

bitromortac
Copy link
Contributor

This PR adds functionality for the autopilot privacy mapper that enables to selectively reveal data that otherwise is obfuscated by default. This is necessary in order to support more advanced autopilot features, such as the soon to be added automatic channel open service. In this case it is necessary to communicate litd's node pubkey to the service (via GetInfo) in order for it to be able to make high-quality node suggestions, taking the nodes's position within the graph into account. Uncovering pubkeys will also be necessary in order to know the peers with which force closes have happened, to not open new channels, or to check whether channels with liquidity already exist. It is nevertheless important to still obfuscate precise channel balances and other information. This is why privacy flags are introduced (in the auto open example it is the ClearPubkeys flag), which define the precise deobfuscation within a session for the following interaction points:

  • Feature configuration:
    Features can be configured (not used yet by any feature) to define algorithmic behavior, for example one can imagine to specify peers to preferentially open channels with. Currently, those node ids are obfuscated, but for automatic channel opens it will be important to know the identity of the nodes in order to respect the user's preference.

  • Feature rules:
    Feature rules define the boundaries within which autopilot is allowed to operate. This includes a peer restriction rule. In the example of automatic channel opens, the service needs to know the pubkeys for nodes not to open channels with.

  • Firewall intercepted calls from autopilot to litd:
    As explained above, certain APIs need to reveal the pubkeys of peers in order for the autopilot to function correctly.

Privacy obfuscation remains on by default and AutoFee's privacy properties remain unaltered. Features can be registered together in a single session, whereby the session's privacy flags will be the union of privacy flags of all the features (which is why feature registration is recommended to be done in individual sessions). When linking sessions, privacy flags must be preserved accross the linked sessions, which is checked by autopilot.

Copy link
Contributor

@ViktorTigerstrom ViktorTigerstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK LGTM 🚀🔥🚀!!! Really awesome work 🎉🎉🎉!!!

Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nicely structured PR 🙏

Almost there

Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 🚀 LGTM!

@bitromortac bitromortac force-pushed the privacy-flags branch 2 times, most recently from 1e4d710 to 2601af8 Compare April 25, 2024 10:15
Fixes the timeout keyword.

Also enable speedups by mounting go caches as well as a golangci-lint
cache that caches linter data accross runs.
We add a privacy flag type that can be used to serialize/deserialize
from a uint64. This is the source for which privacy flags are
available.
Privacy flags are stored within the session.
SessionDB is an interface that gives helper methods for how privacy
mapping should be done. A mock for SessionDB is added to save on some
code repetition, the privacy flags functionality is used in a later
test.
We change the rule mapping to accept the newly added privacy flags. Peer
and channel restrictions can be controlled with privacy flags.
We change the rule mapping to accept the newly added privacy flags. Peer
and channel restrictions can be controlled with privacy flags.
gRPC message interception depends now on privacy flags.
* to Features to know about default privacy flags in `autopilot features`
* to RegisterAutopilotSession in order to communicate to the autopilot
  which privacy flags are being used after `autopilot add`
* to sessions in order to get details when running `autopilot list`
* to the autopilot rpc to be able to register features with privacy
  flags via cli `autopilot add`
For autopilot session registration, we accept default recommendations
from autopilot in order to weaken privacy obfuscation for the requested
features. Default privacy flags are supplied by ListFeatures and by
flags passed to the AddAutopilotSession request.

Privacy flags are ORed to combine to the weakest aggregated privacy
obfuscation in order to allow for multiple feature registration. In
order to preserve high privacy settings for a feature it should be
registered in an isolated manner.
Adds support for overriding defaul privacy flags for non-default feature
configurations.
@bitromortac bitromortac force-pushed the privacy-flags branch 2 times, most recently from 25e5811 to 497e42c Compare April 25, 2024 14:50
This is to tolerate unknown rules sent from the autopilot for the
`autopilot features` command.

Otherwise, when trying to register a feature that requires an upgrade, a
more user friendly error is returned.
@bitromortac bitromortac merged commit 7168da5 into lightninglabs:master Apr 30, 2024
13 checks passed
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