Skip to content

Conversation

@bitromortac
Copy link
Contributor

In this PR we add support for configuration of features within autopilot. Feature configuration can signal preferences to autopilot which are not enforceable by the litd firewall.

  • Default configurations for each feature are available via the ListFeatures call
  • Support for feature configuration is added to litcli
  • Pubkeys in configuration strings are obfuscated

This commit adds a field to the autopilot server rpc that transports
default configurations from autopilot to litd.
We pass on default configuration to litrpc in order to display them in
the list features call.
We add a command line flag to litcli in order to be able to submit a
feature configuration when registering a session.
We obfuscate pubkeys entered in configurations.
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.

Nice nice niiiiice 🔥

Comment on lines +839 to +841
// ObfuscateConfig alters the config string by replacing pubkeys with random
// values and updates the privacy pair map.
func ObfuscateConfig(privacyPairs map[string]string, configB []byte) ([]byte,
Copy link
Member

Choose a reason for hiding this comment

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

very cool! should we also match on channel IDs/outpoints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will add that 👍!

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.

Looking good! A few notes from my side:

  • currently looks like we are persisting the obfuscated config values. We should instead persist the un-obfuscated configs.
  • the PR needs to be opened from upstream branch instead as discussed offline
  • make protos must be run.
  • we should obfuscate a few more things like outpoints/channel ids
  • (more a comment for the autopilot side) currently, I can set a config struct that is not valid for the feature. This means users can make mistakes (they think they are setting config for 1 feature but then it gets used for another). Instead, on the autopilot side, we should verify that the feature config sent is valid for the given feature. This can be done by: unmarshaling the sent data into the expected struct for that version, then re-marshal. If the re-marshaled struct is not equal to what the user sent, throw an error.

Comment on lines +238 to +239
// We allow empty configs, to signal the usage of the default
// configuration when the session is registered.
Copy link
Member

Choose a reason for hiding this comment

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

awesome 😎

Copy link
Member

Choose a reason for hiding this comment

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

can we add this to the flag description too? also should mention the importance of the order used when specifying the config flags

Copy link
Member

Choose a reason for hiding this comment

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

btw - I'd say this is a breaking change since users now have to set the new flag. Not a bad thing since I think most users dont register for autopilot sessions through the CLI but we should at least mention this in the release notes.

perhaps worth adding a tracking issue for things like this so that we can just post a comment there if we want to remind ourselves about anything that should be added to the readme or release notes for the next release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added all the suggestions, hope we have a better description now :). is it a breaking change? we can leave out all config flags and it will use the defaults

Copy link
Member

Choose a reason for hiding this comment

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

ah - you are right. Sorry about that 🙈

configs := ctx.StringSlice("configuration")
features := ctx.StringSlice("feature")

if len(configs) > 0 && len(features) != len(configs) {
Copy link
Member

Choose a reason for hiding this comment

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

can we just add a comment here explaining that as soon as one config flag is set, we need all of them set as else we dont know which config goes with which feature

Comment on lines +994 to +999
configB, err = firewall.ObfuscateConfig(
privacyMapPairs, configB,
)
if err != nil {
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

this means that featureConfig given to NewSession and thus persisted, will be the obfuscated one right? Dont think we want to do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

very good point 👍 ! the new version persists the unobfuscated data

@bitromortac
Copy link
Contributor Author

Replaced by #629 (PR from upstream branch)

@bitromortac bitromortac deleted the 2305-persist-config branch April 17, 2024 12: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.

2 participants