-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
events: WebSocket subscriptions support go-bexpr expressions #22835
Conversation
b328d7a
to
2aaf6ec
Compare
Build Results: |
CI Results: |
2aaf6ec
to
4f9db8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! This came out in fewer lines than I expected
go.mod
Outdated
@@ -380,6 +380,7 @@ require ( | |||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect | |||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect | |||
github.com/hashicorp/cronexpr v1.1.1 // indirect | |||
github.com/hashicorp/go-bexpr v0.1.12 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Indirect seems weird, does this need a go mod tidy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I re-ran go mod tidy
and it moved it to a direct dependency.
sdk/logical/events.go
Outdated
EventType string `bexpr:"event_type"` | ||
Operation string `bexpr:"operation"` | ||
SourcePluginMount string `bexpr:"source_plugin_mount"` | ||
FullSecretPath string `bexpr:"full_secret_path"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to use data_path
for consistency? I know data_path
starts its life from the plugin as not a full path, but from an end user's point of view it always ends up being a full path once we've updated it right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I was mostly just copy-pasting from the RFC, but we should strive for consistency.
4f9db8b
to
f496554
Compare
Subscribing to events through a WebSocket now support boolean expressions to filter only the events wanted based on the fields * `event_type` * `operation` * `source_plugin_mount` * `full_secret_path` * `namespace` Example expressions: These can be passed to `vault events subscribe`, e.g.,: * `event_type == abc` * `source_plugin_mount == secret/` * `event_type != def and operation != write` ```sh vault events subscribe -filter='source_plugin_mount == secret/' 'kv*' ``` The docs for the `vault events subscribe` command and API endpoint will be coming shortly in a different PR, and will include a better specification for these expressions, similar to (or linking to) https://developer.hashicorp.com/boundary/docs/concepts/filtering
f496554
to
23b9d41
Compare
Thanks! |
Not sure how, but it looks like the build in http/events_test.go broke since this got merged: https://github.com/hashicorp/vault/actions/runs/6114328001/job/16595812688 |
When #22835 was merged, it was auto-squashed, so the `experiments` import was removed, but the test still referenced it. This removes the (now unnecessary) experiment from the test.
When #22835 was merged, it was auto-squashed, so the `experiments` import was removed, but the test still referenced it. This removes the (now unnecessary) experiment from the test.
When #22835 was merged, it was auto-squashed, so the `experiments` import was removed, but the test still referenced it. This removes the (now unnecessary) experiment from the test.
…ons into release/1.15.x (#22872) * backport of commit 022469d * Fix auto-squash events experiments (#22876) When #22835 was merged, it was auto-squashed, so the `experiments` import was removed, but the test still referenced it. This removes the (now unnecessary) experiment from the test. --------- Co-authored-by: Christopher Swenson <[email protected]>
* Ignore nonces when encrypting without convergence or with convergence versions > 1 * Honor nonce use warning in non-FIPS modes * Revert "Honor nonce use warning in non-FIPS modes" This reverts commit 2aee3db. * Add a test func that removes a nonce when not needed * err out rather than ignore the nonce * Alter unit test to cover, also cover convergent version 3 * More unit test work * Fix test 14 * changelog * tests not already in a nonce present path * Update unit test to not assume warning when nonce provided incorrectly * remove unused test field * Fix auto-squash events experiments When #22835 was merged, it was auto-squashed, so the `experiments` import was removed, but the test still referenced it. This removes the (now unnecessary) experiment from the test. * Allow nonces for managed keys, because we have no way of knowing if the backing cipher/mode needs one --------- Co-authored-by: Christopher Swenson <[email protected]>
Subscribing to events through a WebSocket now support boolean expressions to filter only the events wanted based on the fields
event_type
operation
source_plugin_mount
data_path
namespace
Example expressions:
These can be passed to
vault events subscribe
, e.g.,:event_type == abc
source_plugin_mount == secret/
event_type != def and operation != write
The docs for the
vault events subscribe
command and API endpoint will be coming shortly in a different PR, and will include a better specification for these expressions, similar to (or linking to) https://developer.hashicorp.com/boundary/docs/concepts/filtering