Draft
Conversation
Contributor
|
Container images for this PR have been built successfully!
Built from commit 4637504 |
6b2f49e to
fef79d6
Compare
fef79d6 to
749af65
Compare
523b869 to
c9faa5a
Compare
c9faa5a to
4637504
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Checklist
mainbranchWhat This PR Implements
Fixes:
Changes Made
Testing Done
./scripts/development/dev.sh startjust lint all)just test backendAI Tool Used (if applicable)
AI Tool:
Assistance Level:
What AI helped with:
I reviewed and edited all AI-generated output:
I ran all required tests and manually verified changes:
Additional Context
Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.Greptile Summary
This PR adds mutual TLS (mTLS) authentication support for edge agents connecting to the Arcane manager. It introduces ECDSA P-384 certificate generation and validation, an auto-enrollment endpoint (
/api/tunnel/mtls/enroll) that issues per-environment client certificates, and enforcement of client certificate presence on the WebSocket, poll, and gRPC tunnel endpoints whenEDGE_MTLS_MODE=requiredis configured. A newarcane generateCLI subcommand provides tooling to manually generate mTLS and TLS asset bundles.Key changes:
backend/pkg/libarcane/edge/tls.go— new file; CA and client cert lifecycle (generate, validate, validate key-pair match, auto-enroll from manager)backend/pkg/libarcane/edge/server.go—HandleMTLSEnrollendpoint;requireClientCertificateInternalguard added to WebSocket connect handler and gRPC stream interceptorbackend/pkg/libarcane/edge/poll_control.go— samerequireClientCertificateInternalguard added to the poll handlerbackend/internal/bootstrap/bootstrap.go—prepareServerTLSInternalorchestrates CA auto-generation and manager-side validation in the correct orderbackend/internal/services/environment_service.go—GenerateEdgeDeploymentSnippetsnow emits mTLS-aware Docker run/compose snippets when auto-generated assets existcli/pkg/generate/certs.go— new CLI subcommandsarcane generate mtlsandarcane generate tlsIssues found:
EnsureAgentMTLSAssetsdoes not verify that the manager URL is HTTPS before downloading the agent's private key, allowing key material to be transmitted in plaintext if misconfigured (P1 security)ca.crtpath is never set incfg.EdgeMTLSCAFile, which can cause TLS verification failures on subsequent connections when the manager uses a custom CAcli/pkg/generate/certs.goare missing the requiredInternalsuffixConfidence Score: 3/5
EnsureAgentMTLSAssetstransmits the agent's private key before validating that the connection is HTTPS, which is a meaningful security gap even if it requires a misconfigured deployment to trigger. Additionally, the downloaded CA cert is not wired back into the config, which can silently break TLS verification in custom-CA deployments.backend/pkg/libarcane/edge/tls.go(auto-enrollment HTTPS guard and post-enrollment CA path),cli/pkg/generate/certs.go(naming convention violations)Important Files Changed
Internalsuffix.Prompt To Fix All With AI
Last reviewed commit: "feat: allow mTLS aut..."
Context used:
Senior Go developer with deep expert... (source)