Skip to content

feat: Add outbound routing rules UI for authproxy-routes ConfigMap - #1176

Merged
mrsabath merged 2 commits into
rossoctl:mainfrom
mrsabath:feat/authproxy-routes-ui
Apr 9, 2026
Merged

mrsabath merged 2 commits into
rossoctl:mainfrom
mrsabath:feat/authproxy-routes-ui

Conversation

@mrsabath

@mrsabath mrsabath commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Add "Outbound Routing Rules" expandable section to both Import Agent and Import Tool pages
  • Users can define per-host token exchange rules: host pattern, target audience, and OAuth scopes
  • Backend creates/updates the authproxy-routes ConfigMap with a routes.yaml key
  • New upsert_configmap method on KubernetesService (create-or-replace semantics)
  • Shipwright build annotations and finalize flow propagate the routes

How it works

Import Agent page → "Outbound Routing Rules" section (when AuthBridge enabled):
  Host: github-tool-mcp | Audience: github-tool | Scopes: openid github-tool-aud
  [+ Add Route]

Backend → creates authproxy-routes ConfigMap:
  routes.yaml:
    routes:
    - host: github-tool-mcp
      target_audience: github-tool
      token_scopes: openid github-tool-aud

Test plan

  • Python syntax verified (py_compile on agents.py, tools.py, kubernetes.py)
  • TypeScript type-check passes for our files
  • Pre-commit hooks pass (ruff format auto-fixed)
  • CI pipeline passes
  • Manual verification: route table renders, routes persist to ConfigMap

Ref #1167, #1168
Depends on #1174, #1175

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! 🛠️

Comment thread kagenti/backend/app/routers/agents.py Resolved
Comment thread kagenti/backend/app/routers/agents.py Resolved
@mrsabath
mrsabath force-pushed the feat/authproxy-routes-ui branch from 62a0ec7 to c210e89 Compare April 8, 2026 22:23
Comment thread kagenti/backend/app/routers/agents.py Resolved
@mrsabath

mrsabath commented Apr 8, 2026

Copy link
Copy Markdown
Member Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 8, 2026
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @mrsabath
Commit: c210e892335c6e644e6ee7fffdf3d6f6258904b5
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: c210e892335c6e644e6ee7fffdf3d6f6258904b5
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

mrsabath added 2 commits April 8, 2026 21:03
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]>
@mrsabath
mrsabath force-pushed the feat/authproxy-routes-ui branch from c210e89 to e5c5451 Compare April 9, 2026 01:03
@github-actions github-actions Bot removed the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 9, 2026
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

New Commits Detected

The safe-to-test label has been automatically removed because new commits were pushed.

New HEAD: e5c5451

For maintainers: Please review the new changes and comment /run-e2e to trigger E2E tests.

Security checklist

Before running E2E tests, verify the PR does NOT contain:

  • Changes to .github/workflows/ that bypass security
  • Changes to .github/scripts/ that could exfiltrate secrets
  • curl, wget, or nc commands to external URLs in scripts
  • Base64 encoding of environment variables
  • Printing secrets to logs (echo $SECRET)
  • Suspicious package installations

This is an automated security measure to prevent TOCTOU attacks

@mrsabath

mrsabath commented Apr 9, 2026

Copy link
Copy Markdown
Member Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 9, 2026
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @mrsabath
Commit: e5c5451215e7b8985fe5d2d4bdec8004fd5e6e04
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@mrsabath
mrsabath merged commit 341307e into rossoctl:main Apr 9, 2026
21 of 22 checks passed
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: e5c5451215e7b8985fe5d2d4bdec8004fd5e6e04
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Maintainer reviewed - safe to run E2E tests

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants