Skip to content

fix(console): read the web allowlist per channel, not once at startup - #44

Merged
traviswu-bigstack merged 1 commit into
developfrom
travis.wu/reload-web-allowlist
Sep 17, 2026
Merged

traviswu-bigstack merged 1 commit into
developfrom
travis.wu/reload-web-allowlist

Conversation

@traviswu-bigstack

@traviswu-bigstack traviswu-bigstack commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

/kind bug

What

The agent reads /etc/cube-advisor-agent/web-targets.json on every web channel now, instead of once at startup.

Why

The allowlist changes underneath a running agent, by design — advisor target_set writes it, and config_advisor's Commit seeds one on a node that had none. Reading it once meant every such change needed a restart, and the failure pointed away from the cause:

agent: web channel for "cube-cos-idp" ended:
  console: target is not in this node's web allowlist: "cube-cos-idp"

# ... while the file said:
{"cube-cos":"10.32.1.200:443","cube-cos-idp":"10.32.1.200:10443", …}

Three times on the 1cc r630 this session — cube-cos-idp, then cube-cos-skyline and cube-cos-ceph. Each one looked like a proxy bug until the file was read side by side with the agent's own startup line (serving … 3 web targets against four in the file). systemctl restart cube-advisor-agent fixed it every time, which is a step nobody should have to know to run.

How

WebHandler.Allow becomes a WebResolverWebAllowlist still satisfies it, so every existing test is unchanged, and FileAllowlist{Path} resolves against the file each time.

Re-reading costs one small read per channel, and a channel is opened by a person clicking a button. Startup still parses the file once, where an operator is watching, so a malformed one is refused before the agent claims to be serving anything.

A file that stops parsing later refuses rather than falling back to the last good copy. An allowlist nobody can read is not one to keep enforcing from memory — the allowlist is the node's veto over what the Advisor may dial, and the safe direction when it becomes unreadable is to dial nothing.

Testing

go test ./... clean.

Two cases added: a target added after startup resolves without a restart (before it is added, it refuses with ErrNotAllowed), and a file that stops parsing refuses rather than serving the last good copy.

Reviewer notes

WebHandler.Allow is now an interface, so a nil one refuses everything explicitly rather than panicking — the doc comment said "empty refuses everything" and that stays true of nil.

The other half of this — seeding the targets so an operator has fewer to set by hand — is bigstack-oss/cubecos#1482.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PZ5umjjCedZwWtbAbiMjfj


Tracked by #45.

The allowlist changes underneath a running agent: `advisor target_set`
writes the file, and config_advisor's Commit seeds one on a node that had
none. Reading it once at startup meant every such change needed a restart
to take effect, and the failure it produced pointed away from the cause --
a channel refused with "target is not in this node's web allowlist",
naming a target the file plainly contained.

Three times on the r630 this session: cube-cos-idp, then cube-cos-skyline
and cube-cos-ceph. Each looked like a proxy bug until the file was read
side by side with the agent's startup line.

Re-reading costs one small read per channel, and a channel is opened by a
person clicking a button. Startup still parses the file once, where an
operator is watching a malformed one. A file that stops parsing later
refuses rather than falling back to the last good copy: an allowlist
nobody can read is not one to keep enforcing from memory.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZ5umjjCedZwWtbAbiMjfj
Signed-off-by: Travis Wu <travis.wu@bigstack.co>
@traviswu-bigstack
traviswu-bigstack force-pushed the travis.wu/reload-web-allowlist branch from a2330c5 to 6393f6c Compare September 17, 2026 03:09
@traviswu-bigstack
traviswu-bigstack marked this pull request as ready for review September 17, 2026 03:14
@traviswu-bigstack
traviswu-bigstack merged commit eef6f54 into develop Sep 17, 2026
1 check passed
@traviswu-bigstack
traviswu-bigstack deleted the travis.wu/reload-web-allowlist branch September 17, 2026 03:14
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.

1 participant