-
Notifications
You must be signed in to change notification settings - Fork 37
move OAuth route to project group #473
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
move OAuth route to project group #473
Conversation
Signed-off-by: Michael Clifford <mcliffor@redhat.com>
Claude Code ReviewSummaryThis PR moves the OAuth URL generation endpoint from an unauthenticated route to the project group with proper authentication and authorization. This is a security improvement that adds user token validation and RBAC checks to the OAuth flow. Issues by Severity🚫 Blocker IssuesNone - the PR is safe to merge from a security perspective. 🔴 Critical IssuesNone identified. 🟡 Major Issues1. Missing Import for Location: The code uses gvr := schema.GroupVersionResource{
Group: "vteam.ambient-code",
Version: "v1alpha1",
Resource: "agenticsessions",
}However, looking at the imports (line 21), "k8s.io/apimachinery/pkg/runtime/schema"So this is actually not an issue - the import exists. My mistake on initial review. 🔵 Minor Issues1. Duplicate GVR Definition Location: The
Recommendation: Extract this to a helper function or use a shared constant pattern like in // In handlers/helpers.go or types/session.go
func GetAgenticSessionGVR() schema.GroupVersionResource {
return schema.GroupVersionResource{
Group: "vteam.ambient-code",
Version: "v1alpha1",
Resource: "agenticsessions",
}
}This follows the DRY principle and matches patterns in the operator code. 2. Error Handling Pattern Inconsistency Location: The code checks for if errors.IsForbidden(err) {
c.JSON(http.StatusForbidden, gin.H{"error": "Access denied to session"})
return
}However, when using user-scoped clients ( Pattern from CLAUDE.md (line 535-538): if errors.IsNotFound(err) {
c.JSON(http.StatusNotFound, gin.H{"error": "Session not found"})
return
}The current code is safer (checks both), so this is minor. Consider removing the explicit Positive Highlights✅ Excellent Security Improvement: Moving the OAuth endpoint behind authentication prevents unauthorized users from initiating OAuth flows for sessions they don't own. ✅ Follows User Token Authentication Pattern: Correctly uses ✅ Proper Error Handling: All error paths are logged with context and return appropriate HTTP status codes (matches error-handling.md patterns). ✅ RBAC-Compliant: By using user-scoped clients, the endpoint respects Kubernetes RBAC permissions automatically. ✅ Maintains Backward Compatibility: The route path stays the same ( ✅ Clear Logging: Line 132 logs failures with full context ( ✅ Type-Safe K8s Access: Uses proper RecommendationsHigh Priority
Medium Priority
Low Priority
Security Review✅ User Token Authentication: Correctly implemented Architectural AlignmentThis change aligns with:
Pre-Commit Checklist Status
Verdict✅ APPROVE - This is a solid security improvement that correctly implements user token authentication for the OAuth flow. The code follows established patterns from CLAUDE.md and the security standards. The minor issues noted are opportunities for future refactoring, not blockers. The PR successfully:
Recommended Action: Merge after addressing the GVR duplication in a follow-up PR if desired (not blocking). 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
Resolved merge conflicts from main's AG-UI refactor and OAuth route restructuring: Conflicts resolved: - routes.go: Removed duplicate OAuth route registration (PR ambient-code#473 moved OAuth routes into project group, conflicted with existing route) Major changes merged from main: - AG-UI protocol implementation (agui.go, agui_proxy.go, compaction.go) - Runner refactor: wrapper.py → adapter.py + main.py split - AGUI frontend hooks and streaming - Removed runner-shell framework - Updated dependencies No code changes to autoPush implementation (adapter.py, test_repo_autopush.py, Makefile test targets) - those remain from this branch. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
No description provided.