liquidmetal-dev / liquidmetal-dev/brigade

M4 follow-up: exercise + test south-edge token/mTLS path in HostDriver.Local

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Elixir
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Context

M4 wired the south-edge auth/TLS path in `HostDriver.Local`: if a host carries an
auth token or TLS config, the driver attaches a `Bearer` header / gRPC credential to
the flintlock dial. But on topology A (loopback) both are `nil` by default, so the
path is **never exercised by any test** — it only really lands with the (still absent)
`Remote` driver. A regression in `put_headers`/`put_cred` would go unnoticed.

## Evidence

- `lib/brigade/host_driver/local.ex:21-22` — the connect pipeline:
`[] |> put_headers(host.auth_token) |> put_cred(host.tls)`.
- `lib/brigade/host_driver/local.ex:27-30` — `put_headers` attaches
`{"authorization", "Bearer " <> token}` (no-op on `nil`).
- `lib/brigade/host_driver/local.ex:32-40` — `put_cred` builds `GRPC.Credential` from
`%{cacertfile:, certfile:, keyfile:}` (no-op on `nil`).
- `lib/brigade/host_driver/local.ex:6-7` — moduledoc: *"No auth/TLS on the loopback hop
day 1; the token/mTLS path lands with the `Remote` driver."*
- `config/config.exs:22` `flintlock_auth_token: nil`, `config/config.exs:24`
`flintlock_tls: nil` — defaults leave the path dark.

## Scope

- Add hermetic tests that, with a token / TLS set on the `Brigade.Host`, assert the
driver attaches the basic-auth header / credential on the (loopback) dial and omits
them when `nil`.
- Have the fake flintlock (`test/support/fake_flintlock.ex`) accept/reject on the token
so the header is verified end-to-end, not just structurally.
- Document the `flintlock_auth_token` / `flintlock_tls` config keys.

## Acceptance

- Test asserts headers/credential present when configured, absent when `nil`.
- Fake flintlock accepts a correct token and rejects a wrong/missing one.
- The default tokenless/plaintext loopback path is unchanged.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading lib/brigade/host_driver/local.ex, test/support/fake_flintlock.ex, and the flintlock settings in config/config.exs. Add hermetic coverage for configured and nil token/TLS values, including fake-Flintlock acceptance and rejection of the token. Done means the configured credentials are verified end-to-end and the default tokenless/plaintext loopback path remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, grpc
Domain
backend, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.