Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
Address review comments: pin busybox image version and fix token expiration timing relative to ResolvedAt
Antonio Ojea6c8992782227
diff --git a/.github/k8s/sam-control-plane-template.yaml b/.github/k8s/sam-control-plane-template.yamlindex 7c792dae..7aa5fec2 100644--- a/.github/k8s/sam-control-plane-template.yaml+++ b/.github/k8s/sam-control-plane-template.yaml@@ -87,7 +87,7 @@ spec:spec:initContainers:- name: wait-for-db- image: busybox:latest+ image: busybox:1.36.1command: ['sh', '-c', 'until nc -z -w3 sam-db-${ENV_NAME} 5432; do echo waiting for db; sleep 1; done']containers:- name: sam-control-planediff --git a/internal/controlplane/server.go b/internal/controlplane/server.goindex 1ee13f45..8aa74600 100644--- a/internal/controlplane/server.go+++ b/internal/controlplane/server.go@@ -907,7 +907,7 @@ func (s *Server) HandleEnroll(w http.ResponseWriter, r *http.Request) {// Request already exists, return statusvar resp *api.BootstrapEnrollResponseif existingReq.Status == api.EnrollmentStatus_ENROLLMENT_STATUS_APPROVED {- resp, err = s.buildApprovedBootstrapEnrollResponse(ctx, existingReq.BiscuitToken)+ resp, err = s.buildApprovedBootstrapEnrollResponse(ctx, existingReq.BiscuitToken, existingReq.ResolvedAt)if err != nil {logger.Errorf("Failed to build approved response: %v", err)http.Error(w, "Internal server error", http.StatusInternalServerError)@@ -993,7 +993,7 @@ func (s *Server) HandleEnroll(w http.ResponseWriter, r *http.Request) {logger.Errorf("Failed to increment token usage: %v", err)}- resp, err := s.buildApprovedBootstrapEnrollResponse(ctx, biscuitBytes)+ resp, err := s.buildApprovedBootstrapEnrollResponse(ctx, biscuitBytes, enrollReq.ResolvedAt)if err != nil {logger.Errorf("Failed to build approved response: %v", err)http.Error(w, "Internal server error", http.StatusInternalServerError)@@ -1043,7 +1043,7 @@ func (s *Server) HandleEnrollStatus(w http.ResponseWriter, r *http.Request) {var resp *api.BootstrapEnrollResponseif enrollReq.Status == api.EnrollmentStatus_ENROLLMENT_STATUS_APPROVED {- resp, err = s.buildApprovedBootstrapEnrollResponse(ctx, enrollReq.BiscuitToken)+ resp, err = s.buildApprovedBootstrapEnrollResponse(ctx, enrollReq.BiscuitToken, enrollReq.ResolvedAt)if err != nil {logger.Errorf("Failed to build approved response: %v", err)http.Error(w, "Internal server error", http.StatusInternalServerError)@@ -1350,7 +1350,7 @@ func (s *Server) HandleAdminRevoke(w http.ResponseWriter, r *http.Request) {_, _ = w.Write(respData)}-func (s *Server) buildApprovedBootstrapEnrollResponse(ctx context.Context, biscuitToken []byte) (*api.BootstrapEnrollResponse, error) {+func (s *Server) buildApprovedBootstrapEnrollResponse(ctx context.Context, biscuitToken []byte, resolvedAt *time.Time) (*api.BootstrapEnrollResponse, error) {_, pubKey, err := s.store.GetCurrentKey(ctx)if err != nil {return nil, fmt.Errorf("failed to retrieve signing key: %w", err)@@ -1367,6 +1367,9 @@ func (s *Server) buildApprovedBootstrapEnrollResponse(ctx context.Context, biscu}expiration := time.Now().Add(api.BiscuitTokenTTL).Unix()+ if resolvedAt != nil {+ expiration = resolvedAt.Add(api.BiscuitTokenTTL).Unix()+ }return &api.BootstrapEnrollResponse{Status: api.EnrollmentStatus_ENROLLMENT_STATUS_APPROVED,