Skip to content

chore: tunnel auth#4588

Merged
MasterPtato merged 1 commit intomainfrom
04-08-chore_tunnel_auth
Apr 8, 2026
Merged

chore: tunnel auth#4588
MasterPtato merged 1 commit intomainfrom
04-08-chore_tunnel_auth

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@claude
Copy link
Copy Markdown

claude bot commented Apr 8, 2026

PR Review: Tunnel Authorization

This PR implements tunnel authorization for pegboard-envoy and pegboard-runner by tracking authorized tunnel routes and validating incoming messages against the authorized set. It also adds trust boundary documentation to CLAUDE.md and cleans up unused dependencies.

Strengths:

  • Authorization enforced at tunnel message boundary before publishing to UPS
  • Lock-free scc::HashMap prevents race conditions (follows CLAUDE.md pattern for concurrent containers)
  • Trust boundaries clearly documented in CLAUDE.md
  • insert_async and contains_async do not hold locks across await points
  • Authorization logic mirrored in both mk1 and mk2 handlers in both packages

Issues (Should Fix):

  1. Disabled tests in pegboard-envoy. engine/packages/pegboard-envoy/tests/support/ws_to_tunnel_task.rs is entirely commented out with TODO: Use TestCtx. pegboard-runner has 4 comprehensive tests for mk1/mk2 auth but the envoy has none enabled. This gap should be resolved or tracked with a .agent/todo/ entry.

  2. Missing design comment on authorization key. The key uses (gateway_id, request_id) but not message_index. This appears intentional but a short comment in handle_tunnel_message_mk2 / handle_tunnel_message_mk1 would clarify the intent for future maintainers.

Minor:
3. let _ = insert_async() in tunnel_to_ws_task.rs (both packages) discards the result without a comment explaining why (duplicate inserts for the same key are benign but this is not obvious).
4. Test helpers use magic byte arrays like [1, 2, 3, 4] for IDs. Named constants would improve readability.
5. pegboard-runner refactored handlers to accept max_payload_size as an explicit parameter; pegboard-envoy still reads it from config directly inside the function. Minor inconsistency that could confuse future maintenance.

Security Assessment:

  • Authorization check correctly placed before UPS publish
  • No bypass vector identified: authorized_tunnel_routes is only populated via the trusted tunnel_to_ws path
  • Error messages intentionally generic to avoid leaking routing details

Overall: Core security logic is well-implemented and follows existing conventions. Main gap is the disabled envoy tests. Good to merge once that is tracked or resolved.

@NathanFlurry NathanFlurry force-pushed the 04-08-chore_tunnel_auth branch 2 times, most recently from 6de6776 to cfcac6f Compare April 8, 2026 09:39
@NathanFlurry NathanFlurry changed the base branch from 04-07-chore_remove_udb_as_a_dependency_of_envoy-client to graphite-base/4588 April 8, 2026 10:37
@NathanFlurry NathanFlurry mentioned this pull request Apr 8, 2026
11 tasks
@NathanFlurry NathanFlurry force-pushed the 04-08-chore_tunnel_auth branch from cfcac6f to 2f4d372 Compare April 8, 2026 11:07
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4588 to 04-07-chore_remove_udb_as_a_dependency_of_envoy-client April 8, 2026 11:07
@NathanFlurry NathanFlurry force-pushed the 04-08-chore_tunnel_auth branch from 2f4d372 to 85d514f Compare April 8, 2026 11:12
@MasterPtato MasterPtato changed the base branch from 04-07-chore_remove_udb_as_a_dependency_of_envoy-client to graphite-base/4588 April 8, 2026 20:11
@MasterPtato MasterPtato force-pushed the 04-08-chore_tunnel_auth branch from 85d514f to e629058 Compare April 8, 2026 20:11
@MasterPtato MasterPtato force-pushed the 04-08-chore_tunnel_auth branch from e629058 to ec89f2e Compare April 8, 2026 20:14
@MasterPtato MasterPtato changed the base branch from graphite-base/4588 to 04-07-chore_revert_actor_v2_hack April 8, 2026 20:14
@MasterPtato MasterPtato force-pushed the 04-07-chore_revert_actor_v2_hack branch from 8262c65 to d758690 Compare April 8, 2026 20:30
@MasterPtato MasterPtato force-pushed the 04-08-chore_tunnel_auth branch from ec89f2e to 4bea0d4 Compare April 8, 2026 20:30
@MasterPtato MasterPtato changed the base branch from 04-07-chore_revert_actor_v2_hack to graphite-base/4588 April 8, 2026 20:46
@MasterPtato MasterPtato force-pushed the 04-08-chore_tunnel_auth branch from 4bea0d4 to d7b0668 Compare April 8, 2026 20:46
@MasterPtato MasterPtato changed the base branch from graphite-base/4588 to 04-07-chore_remove_udb_as_a_dependency_of_envoy-client April 8, 2026 20:46
@MasterPtato MasterPtato marked this pull request as ready for review April 8, 2026 20:50
Copy link
Copy Markdown
Contributor

MasterPtato commented Apr 8, 2026

Merge activity

  • Apr 8, 8:52 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 8, 9:33 PM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 8, 9:34 PM UTC: @MasterPtato merged this pull request with Graphite.

@MasterPtato MasterPtato changed the base branch from 04-07-chore_remove_udb_as_a_dependency_of_envoy-client to graphite-base/4588 April 8, 2026 21:29
@MasterPtato MasterPtato changed the base branch from graphite-base/4588 to main April 8, 2026 21:31
@MasterPtato MasterPtato force-pushed the 04-08-chore_tunnel_auth branch from d7b0668 to b46c969 Compare April 8, 2026 21:32
@MasterPtato MasterPtato merged commit 5dba5de into main Apr 8, 2026
4 of 8 checks passed
@MasterPtato MasterPtato deleted the 04-08-chore_tunnel_auth branch April 8, 2026 21:34
@MasterPtato MasterPtato mentioned this pull request Apr 9, 2026
11 tasks
@NathanFlurry NathanFlurry mentioned this pull request Apr 9, 2026
11 tasks
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.

2 participants