-
Notifications
You must be signed in to change notification settings - Fork 31
WIP: Jwt vertex #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Jwt vertex #285
Conversation
Signed-off-by: Ryan Cook <rcook@redhat.com>
PR Review: JWT Vertex Credentials ArchitectureThis PR refactors Vertex AI credential management from filesystem-based to API-based authentication. This is a significant security improvement that aligns with zero-trust principles. Overall, the implementation is solid with excellent test coverage, but I've identified several critical issues that need attention before merge. 🔴 Critical Issues1. Backend Reads Secret from Wrong NamespaceLocation: Problem: The code comment says "Load Vertex credentials from ambient-vertex secret in the project namespace", but the production config comment ( // Load Vertex credentials from ambient-vertex secret in the project namespace
vertexSecretName := "ambient-vertex"
vertexSecret, err := K8sClient.CoreV1().Secrets(project).Get(c.Request.Context(), vertexSecretName, v1.GetOptions{})This reads from # Ensure ambient-vertex secret exists in backend namespace with:
# kubectl create secret generic ambient-vertex \
# -n <backend-namespace>Impact: This is a critical mismatch. The backend will fail to find the secret unless it's duplicated in every project namespace, defeating the security benefit of centralized credential management. Fix Required: Either:
Recommendation: Read from backend namespace for centralized management (matches original architecture goal). 2. Missing Token Length LoggingLocation: Problem: Token validation doesn't log token length, violating CLAUDE.md security pattern (line 932): token := strings.TrimSpace(parts[1])
if token == "" {
c.JSON(http.StatusUnauthorized, gin.H{"error": "empty token"})
return
}Per CLAUDE.md: // NEVER log the token itself
log.Printf("Processing request with token (len=%d)", len(token))Impact: Hinders debugging when token auth fails. Fix: Add: 3. Test Assumes Wrong Secret NamespaceLocation: Problem: Test creates secret in vertexSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "ambient-vertex",
Namespace: "backend-namespace", // ❌ Wrong namespace
},
// ...
}
// ...
req := httptest.NewRequest("POST", "/api/projects/test-project/agentic-sessions/test-session/vertex/credentials", nil)Impact: Test doesn't catch the namespace mismatch issue (#1), giving false confidence. Fix: Update test to match actual implementation (create secret in
|
Signed-off-by: Ryan Cook <rcook@redhat.com>
Pull Request Review: JWT/Vertex AI Credential ManagementThis PR refactors how Vertex AI credentials are managed, moving from a secret-copying approach to a backend-served JWT token pattern. This is a significant architectural improvement that enhances security and simplifies the RBAC model. ✅ Strengths
🔧 Issues to AddressCritical Issues
Medium Issues
Minor Issues
📋 Code Quality Checklist (from CLAUDE.md)
🚀 Recommendations
🎯 Priority Actions Before MergeMust Fix:
Should Fix:
Nice to Have:
📊 Overall AssessmentThis is a well-architected change that significantly improves the security posture of Vertex AI credential management. The approach of centralizing credentials in the backend and serving them via authenticated API is the right design pattern. The test coverage is excellent and follows Go testing best practices. The main issues are minor bugs in the test code and some opportunities to follow established type-safety patterns more closely. Recommendation: Approve after fixing the 3 must-fix issues. The should-fix issues can be addressed in a follow-up PR if time is constrained. Testing Checklist (run before merge): cd components/backend
go test -v ./handlers -run TestMintSessionVertexCredentials
gofmt -l .
go vet ./...
golangci-lint run |
Code Review: JWT Vertex Authentication ChangesThis PR implements a significant architectural improvement by moving Vertex AI credential management from operator-level secret copying to a centralized backend API service with JWT authentication. I've conducted a comprehensive review based on the project's CLAUDE.md guidelines. SummaryArchitecture Change: Transitions from operator copying Key Benefits:
Detailed Findings✅ Strengths1. Backend Implementation (
|
PR Review: JWT Vertex AI IntegrationI've reviewed PR #285 which implements Vertex AI credential management through a centralized backend service. Overall, this is a well-architected security improvement that follows the project's CLAUDE.md guidelines closely. Here's my detailed feedback: ✅ Strengths1. Excellent Security Architecture
2. CLAUDE.md Compliance
3. Comprehensive Test CoverageThe new test file (
4. RBAC Reduction
🔴 Critical Issues1. Interface Type Change Without Justification (High Priority)Files: // Changed from:
K8sClient *kubernetes.Clientset
// To:
K8sClient kubernetes.InterfaceProblem: This changes the concrete type to an interface across multiple files, but:
Recommendation:
2. Missing Documentation for New EndpointFile: The new endpoint
Recommendation:
|
PR Review: JWT Vertex Credential ManagementOverviewThis PR refactors Vertex AI credential management to use a JWT-based flow where runners authenticate to the backend API using their ServiceAccount tokens (BOT_TOKEN) to fetch GCP credentials dynamically. This is a significant security improvement over the previous approach. ✅ Strengths1. Security Improvements
2. Code Quality
3. RBAC Simplification
|
Pull Request Review: JWT Vertex AuthenticationOverviewThis PR implements Vertex AI credential distribution via backend API endpoints, improving security by centralizing credential management and eliminating the need for operators to directly access GCP service account keys. 🎯 Positive Highlights1. Security Architecture Improvements ✅
2. Code Quality & Best Practices ✅
3. Error Handling ✅
|
Code Review: JWT Vertex AI Credential ManagementThis PR refactors Vertex AI credential management to use a more secure, centralized approach. The backend now serves credentials via an authenticated API endpoint instead of the operator distributing secrets to project namespaces. ✅ Strengths1. Security Improvements
2. Code Quality
3. Architecture
|
Gkrumbach07
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
|
Sandboxing the pod better will help this be more secure too. |
This reverts commit 2f783a1.
Signed-off-by: Ryan Cook <rcook@redhat.com>
No description provided.