From f98634adfbb8e9dec7b4a75a5e47c643f885324d Mon Sep 17 00:00:00 2001 From: Sas Swart Date: Thu, 30 Apr 2026 09:19:40 +0000 Subject: [PATCH] feat(config,run): generate session ID at startup Add SessionID field to config.AppConfig and generate a UUIDv4 in Run (run_linux.go) at process startup. The session ID is logged once and will be used by future work to group all audit events from a single boundary invocation into a session. No consumers yet; this is the first step of the session correlation RFC. --- config/config.go | 5 +++++ go.mod | 1 + run/run_linux.go | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/config/config.go b/config/config.go index d688834..229cf35 100644 --- a/config/config.go +++ b/config/config.go @@ -85,6 +85,11 @@ type AppConfig struct { UserInfo *UserInfo DisableAuditLogs bool LogProxySocketPath string + + // SessionID is a UUIDv4 generated at process startup. It groups + // all audit events produced by this boundary invocation into a + // single session. Set by Run, not by configuration. + SessionID string } func NewAppConfigFromCliConfig(cfg CliConfig, targetCMD []string) (AppConfig, error) { diff --git a/go.mod b/go.mod index 0188e84..58e7944 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/cenkalti/backoff/v5 v5.0.3 github.com/coder/coder/v2 v2.10.1-0.20260303212958-f758443f44ac github.com/coder/serpent v0.14.0 + github.com/google/uuid v1.6.0 github.com/landlock-lsm/go-landlock v0.0.0-20251103212306-430f8e5cd97c github.com/miekg/dns v1.1.72 github.com/spf13/pflag v1.0.10 diff --git a/run/run_linux.go b/run/run_linux.go index f67d82b..357f5c1 100644 --- a/run/run_linux.go +++ b/run/run_linux.go @@ -10,9 +10,13 @@ import ( "github.com/coder/boundary/config" "github.com/coder/boundary/landjail" "github.com/coder/boundary/nsjail_manager" + "github.com/google/uuid" ) func Run(ctx context.Context, logger *slog.Logger, cfg config.AppConfig) error { + cfg.SessionID = uuid.New().String() + logger.Info("boundary session started", "session_id", cfg.SessionID) + switch cfg.JailType { case config.NSJailType: return nsjail_manager.Run(ctx, logger, cfg)