Commit Graph

5 Commits

Author SHA1 Message Date
hc-github-team-secure-vault-core
2c6e89904c backport of commit 88dcb04623 (#19272)
Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-02-21 12:44:35 -05:00
hc-github-team-secure-vault-core
6e323b6a5a backport of commit 4c11d090cd (#19262)
Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-02-20 19:15:58 +00:00
hc-github-team-secure-vault-core
c9eb3c7251 events: WS protobuf messages should be binary (#19232) (#19256)
The [WebSockets spec](https://www.rfc-editor.org/rfc/rfc6455) states
that text messages must be valid UTF-8 encoded strings, which protobuf
messages virtually never are. This now correctly sends the protobuf events
as binary messages.

We change the format to correspond to CloudEvents, as originally intended,
and remove a redundant timestamp and newline.

We also bump the eventlogger to fix a race condition that this code triggers.

Co-authored-by: Christopher Swenson <christopher.swenson@hashicorp.com>
2023-02-17 20:14:48 +00:00
hc-github-team-secure-vault-core
13313d059c backport of commit 5ff44bd1cb (#19144)
Co-authored-by: Christopher Swenson <christopher.swenson@hashicorp.com>
2023-02-10 21:26:38 +00:00
Christopher Swenson
6e233e567b events: Add websockets and command (#19057)
Also updates the event receieved to include a timestamp.
Websockets support both JSON and protobuf binary formats.

This can be used by either `wscat` or the new
`vault events subscribe`:

e.g.,
```sh
$ wscat -H "X-Vault-Token: $(vault print token)" --connect ws://127.0.0.1:8200/v1/sys/events/subscribe/abc?json=true
{"event":{"id":"5c5c8c83-bf43-7da5-fe88-fc3cac814b2e", "note":"testing"}, "eventType":"abc", "timestamp":"2023-02-07T18:40:50.598408Z"}
...
```

and

```sh
$ vault events subscribe abc
{"event":{"id":"5c5c8c83-bf43-7da5-fe88-fc3cac814b2e", "note":"testing"}, "eventType":"abc", "timestamp":"2023-02-07T18:40:50.598408Z"}
...
```

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-02-09 13:18:58 -08:00