Repository navigation
feat: Add outbound routing rules UI for authproxy-routes ConfigMap - #1176
Conversation
huang195
left a comment
There was a problem hiding this comment.
Cześć Mariusz, trzeci PR w jednym dniu — produkcja idzie pełną parą! This PR adds outbound routing rules (authproxy-routes ConfigMap) to both import pages. The architecture is clean: frontend route table, Pydantic model, upsert_configmap method, and Shipwright annotation propagation through the finalize flow.
However, CodeQL is failing with 4 high severity log injection alerts on the new f-string logger calls. The fix is mechanical (switch to %s-style formatting) but required to unblock CI.
Areas reviewed: Python (backend + kubernetes service), Frontend (React/TS), API types
Commits: 3 commits (1st & 2nd from dependency PRs #1174/#1175), all signed-off: ✅
CI status: CodeQL failing (4 high log injection alerts), all other checks pass including Deploy & Test
Fix the log injection and this is ready to go! Na razie! 🛠️
62a0ec7 to
c210e89
Compare
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
huang195
left a comment
There was a problem hiding this comment.
Re-review after fix commit c210e89. Wszystkie poprawki wyglądają świetnie, Mariusz!
All 5 original review comments addressed ✅
| Issue | Fix | Verdict |
|---|---|---|
| Log injection (f-string) | Switched to %s-style parametric logging |
✅ Done |
React key={index} |
crypto.randomUUID() + strip id before API send |
✅ Clean |
| Missing field validation | Field(..., min_length=1) on host/target_audience |
✅ Clean |
| Label asymmetry in upsert | Removed if labels: guard, always merges |
✅ Clean |
| Indentation (nit) | Low priority, not addressed | Fine |
CodeQL note
CodeQL still reports 5 py/log-injection alerts because it tracks data flow, not formatting style — %s doesn't prevent user data from reaching the logger. The values here are Kubernetes namespace/ConfigMap names (constrained by k8s API validation: alphanumeric, dashes, dots, max 253 chars). Real-world log injection risk is negligible. Options to silence: sanitize with .replace('\n','').replace('\r',''), or dismiss the alerts as false positives.
E2E HyperShift
Weather agent conversation tests failed (LLM-dependent) — unrelated to this PR's changes.
Dobra robota na szybkich poprawkach! 🎯
| self.core_api.replace_namespaced_config_map( | ||
| name=name, namespace=namespace, body=existing | ||
| ) | ||
| logger.info("Updated ConfigMap '%s' in %s", name, namespace) |
There was a problem hiding this comment.
note — CodeQL still flags %s-style logging as py/log-injection because it tracks data flow (user-controlled values reaching the logger), not formatting style. The %s approach prevents format string bugs but doesn't change CodeQL's analysis.
Since these values are Kubernetes names (constrained by k8s API validation: RFC 1123, max 253 chars, alphanumeric + dashes/dots), the real-world risk is negligible. To silence CodeQL if needed:
logger.info("Updated ConfigMap '%s' in %s", name.replace('\n',''), namespace.replace('\n',''))Or dismiss the alerts as false positives. Not blocking.
Add an expandable "Outbound Routing Rules" section to both Import Agent and Import Tool pages. Users can define per-host token exchange rules (host pattern, target audience, OAuth scopes) that are stored as the authproxy-routes ConfigMap in the workload namespace. - Frontend: route table with add/remove rows on both import pages - Backend: OutboundRoute model, _ensure_authproxy_routes helper that upserts the ConfigMap, stored in Shipwright build annotations - KubernetesService: new upsert_configmap method (create-or-replace) Ref #1167, #1168 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Mariusz Sabath <[email protected]>
- Switch f-string logger calls to %s-style in upsert_configmap and _ensure_authproxy_routes to resolve CodeQL high-severity log injection alerts - Always apply managed-by label on ConfigMap update path (was guarded by `if labels:`, creating asymmetry with create path) - Add stable UUIDs to outbound route objects so React key reconciliation works correctly when rows are removed from the middle - Strip internal id field before sending routes to backend - Add min_length=1 validation on OutboundRoute.host and target_audience to reject empty submissions at the API boundary Signed-off-by: Mariusz Sabath <[email protected]>
c210e89 to
e5c5451
Compare
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
Summary
authproxy-routesConfigMap with aroutes.yamlkeyupsert_configmapmethod on KubernetesService (create-or-replace semantics)How it works
Test plan
Ref #1167, #1168
Depends on #1174, #1175