open-nomad/.semgrep
Tim Gross 32f6ce1c54
Authenticate method improvements (#15734)
This changeset covers a sidebar discussion that @schmichael and I had around the
design for pre-forwarding auth. This includes some changes extracted out of
#15513 to make it easier to review both and leave a clean history.

* Remove fast path for NodeID. Previously-connected clients will have a NodeID
  set on the context, and because this is a large portion of the RPCs sent we
  fast-pathed it at the top of the `Authenticate` method. But the context is
  shared for all yamux streams over the same yamux session (and TCP
  connection). This lets an authenticated HTTP request to a client use the
  NodeID for authentication, which is a privilege escalation. Remove the fast
  path and annotate it so that we don't break it again.

* Add context to decisions around AuthenticatedIdentity. The `Authenticate`
  method taken on its own looks like it wants to return an `acl.ACL` that folds
  over all the various identity types (creating an ephemeral ACL on the fly if
  neccessary). But keeping these fields idependent allows RPC handlers to
  differentiate between internal and external origins so we most likely want to
  avoid this. Leave some docstrings as a warning as to why this is built the way
  it is.

* Mutate the request rather than returning. When reviewing #15513 we decided
  that forcing the request handler to call `SetIdentity` was repetitive and
  error prone. Instead, the `Authenticate` method mutates the request by setting
  its `AuthenticatedIdentity`.
2023-01-10 09:46:38 -05:00
..
api_errorf.yml api: use errors.New not fmt.Errorf when error doesn't have format. (#14027) 2022-08-05 17:05:47 +02:00
changelog.yml
fsm_time.yml semgrep: add MeasureSinceWithLabels to FSM time rule (#14812) 2022-10-06 10:59:53 -04:00
go_tests.yml ci: do not exclude Parallel semgrep rule 2022-03-17 13:45:56 -05:00
http_endpoint.yml api: ensure ACL role upsert decode error returns a 400 status code. (#15253) 2022-11-18 17:47:43 +01:00
loopclosure.yml Data race fixes in tests and a new semgrep rule (#14594) 2022-09-15 10:35:08 -07:00
rpc_endpoint.yml Authenticate method improvements (#15734) 2023-01-10 09:46:38 -05:00
time_after.yml
ui.yml ci: add semgrep rule to catch usage of invalid string extensions (#12509) 2022-04-08 10:58:32 -04:00