Skip to content

Remove snyk-broker; gRPC tunnel is the only relay transport - #212

Merged
shawnburke merged 2 commits into
mainfrom
remove-snyk-broker
Dec 3, 2026
Merged

shawnburke merged 2 commits into
mainfrom
remove-snyk-broker

Conversation

@shawnburke

@shawnburke shawnburke commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Context

Rather than continue to fix snyk-broker vulns, this takes the much-anticipated step of just nuking it altogether. We are ready - there are no known problems with the grpc tunnel and we can fix forward.

Rollout flow for this is:

  1. Land on main which will cause it to be picked up by our internal agent deployments which are pinned to main => make sure thats fine
  2. Publish a build (latest) which will cause the prod agent instances to pick it up => at this point we've validated its all OK

Then as customers upgrade they'll pick this up naturally (note: all environments already default to grpc-tunnel so this should be a no-op.

Summary

The gRPC tunnel is now the default transport and works well, so this PR removes snyk-broker completely. After this merges, a release has no snyk-broker code, Node runtime or mode switch.

Removed

  • agent/server/snykbroker/: supervisor, relay instance manager, reflector, WebSocket proxy, event tracker, watchdog.sh, and their tests.
  • The startup tunnel switch/check: agent/server/relaymode, cmd/relay_mode.go (resolve at start, watch, re-exec on change), config.ForcedRelayMode, IsGRPCTunnel/RelayModePinned.
  • Config/env: AXON_RELAY_TRANSPORT/RELAY_MODE, ENABLE_RELAY_REFLECTOR, REFLECTOR_WEBSOCKET_UPGRADE, RELAY_IDLE_TIMEOUT, SNYK_BROKER_PORT. If these are set, the agent ignores them.
  • Docker: the Node + snyk-broker install, NODE_OPTIONS, and the VARIANT full/grpc split. The result is one go-only image.
  • The snyk E2E harness: the old relay_test.sh, its compose files, Dockerfile.snyk-broker-server, the nginx TLS proxy and the cert generation.
  • gorilla/websocket from go.mod, which is now unused.
  • AcceptFile.Render's extra render steps and SetOrigin, which only the reflector used.

Moved

  • agent/server/snykbroker/acceptfile → agent/server/acceptfile, with accept_files/ and plugins/ as children.
  • Registration (the /relay/register call) → agent/server/grpctunnel/registration.go. The tunnel is its only user. RegistrationInfoResponse.TunnelMode is dropped.
  • The gRPC E2E suite takes over the plain names: relay_test.grpc.sh → relay_test.sh, docker-compose.grpc*.yml → docker-compose*.yml, make grpc-relay-test* → make relay-test*.

CI / publishing

  • docker.yml builds one image. The -grpc tags (<version>-grpc, main-grpc, latest-grpc) are no longer published. Deployments pinned to them stop getting updates and must move to the plain tags.
  • ci.yml: docker-tests-grpc is folded into docker-tests, which now checks that the image has no Node or snyk-broker and runs the gRPC relay suite.
  • trivy.yml: the daily main-grpc scan is removed.

Kept on purpose

  • Wire names: the BrokerToken proto field, BROKER_SERVER_URL/BROKER_TOKEN, and the /__axon/broker/... paths. Changing them would break compatibility with the tunnel server and Cortex.
  • relay_mode in /__axon/info: the backend reads it, so it stays and is always "grpc-tunnel".
  • server/ (tunnel server): no changes. Its snyk-broker mentions document compatibility with the dispatcher API.
  • Parity comments in acceptfile: the accept-file format comes from snyk-broker, and many rules match its semantics on purpose. Comments that described the removed snyk-broker code path are rewritten. Comments that explain parity stay.
  • docs/design/grpc-tunnel-v2.md: a historical record. It gets a note at the top that says snyk-broker mode is removed.

Reviewer notes

  • docker-tests-grpc and Agent image (go-only) no longer exist. If branch protection requires them, update the required checks.
  • In README.relay.md, check that relay.cortex.io is the correct host to allowlist for the gRPC tunnel. The address comes from /register.
  • AcceptFileRuleWrapper.Origin() and AcceptFile.GetPrivateRules() now have no non-test callers. GetPrivateRules() was already unused before this PR. A follow-up can remove them, but tests use Origin(), so I did not remove them here.

Test plan

  • go build ./..., go vet ./... and go test ./... in agent/: all 13 packages pass.
  • go test -race on the race-clean package set, with server/acceptfile replacing server/snykbroker.
  • All workflow and compose YAML files parse.
  • CI: Docker image build, docker-tests (scaffold + relay E2E with and without proxy), helm render, Trivy.

🤖 Generated with Claude Code

The agent now always relays through the gRPC tunnel.

- Remove the snyk-broker package: supervisor, relay instance manager,
  reflector, WebSocket proxy, event tracker and watchdog.
- Remove the relay mode switch at startup: relaymode, the
  registration-driven restart, ForcedRelayMode, and the
  AXON_RELAY_TRANSPORT / RELAY_MODE, ENABLE_RELAY_REFLECTOR,
  REFLECTOR_WEBSOCKET_UPGRADE, RELAY_IDLE_TIMEOUT and SNYK_BROKER_PORT
  settings.
- Move agent/server/snykbroker/acceptfile to agent/server/acceptfile,
  with accept_files/ and plugins/ as children.
- Move Registration into grpctunnel, which is its only user.
- Build one go-only image: no Node, no snyk-broker, no VARIANT. Stop
  publishing the -grpc tags.
- Run the relay E2E suite (formerly relay_test.grpc.sh) as relay-test.
- /__axon/info keeps relay_mode, now always "grpc-tunnel".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Token string `json:"token"`
// TunnelMode is the relay mode Cortex selects for this tenant:
// "snyk-broker" or "grpc-tunnel". Empty when Cortex has no preference.
TunnelMode string `json:"tunnelMode,omitempty"`

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually here jsut hard code grpc-tunnel please

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 896e0b6: TunnelMode stays on RegistrationInfoResponse. Register always sets it to grpc-tunnel (TunnelModeGrpcTunnel) and ignores the value from Cortex. A new test covers the cases where Cortex sends grpc-tunnel, sends snyk-broker, or sends nothing.

Code that reads TunnelMode keeps getting a value. Register sets it to
grpc-tunnel and ignores the value from Cortex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shawnburke
shawnburke marked this pull request as ready for review December 3, 2026 02:28
@shawnburke
shawnburke merged commit e0b0882 into main Dec 3, 2026
19 checks passed
@shawnburke
shawnburke deleted the remove-snyk-broker branch December 3, 2026 20:08
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.

3 participants