Repository navigation
feat: Add advanced AuthBridge config -- port exclusions, outbound policy, audience - #1177
Conversation
huang195
left a comment
There was a problem hiding this comment.
Mariusz, czwarty PR w jednym dniu — produkcja idzie pełną parą, ale tu mamy kilka poważnych problemów!
Critical Issues
1. Data loss bug — kube.upsert_configmap(name="authbridge-config", data=extra_config) replaces the entire ConfigMap .data with just the 1-2 new keys. The existing authbridge-config has KEYCLOAK_URL, KEYCLOAK_REALM, ISSUER, and more — all wiped on upsert. The upsert_configmap method does existing.data = data (full replace). Fix: merge new keys into existing data.
2. Dead code — _build_common_annotations() is defined in agents.py but never called. Port exclusion annotations silently never reach agent pod templates.
3. Finalize inconsistency — tools.py finalize reads port exclusions from tool_config_dict.get(...) directly, skipping the request-override merge pattern used for all other fields. Finalize request overrides are ignored.
4. Cross-repo conflict — EXPECTED_AUDIENCE is being removed from the webhook and go-processor in rossoctl/cortex#282 (replaced by per-agent CLIENT_ID). Adding a UI field for it here would be dead on arrival. DEFAULT_OUTBOUND_POLICY is still valid.
5. CodeQL — 5 high severity log injection alerts (inherited from parent PRs + new).
Areas reviewed: Python (backend + kubernetes service), Frontend (React/TS), API types, Cross-repo (kagenti-extensions#282)
Commits: 4 (first 3 from dependency PRs), all signed-off: ✅
CI status: CodeQL failing (5 high log injection), all other checks pass
Dużo roboty, ale naprawienie tych bugów jest kluczowe — szczególnie ten upsert ConfigMap! 🔧
0875260 to
0ee4cda
Compare
|
Pushed Root cause: CodeQL's What changed:
|
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
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 |
huang195
left a comment
There was a problem hiding this comment.
Re-review after fix commits 0ee4cda, b9bd4f4, c943bcc. Wszystko naprawione — i to porządnie, Mariusz!
All 6 original issues resolved ✅
| Issue | Fix | Verdict |
|---|---|---|
Data loss: upsert_configmap replaces entire .data |
existing.data = {**(existing.data or {}), **data} (merge semantics) |
✅ Critical fix |
Dead code: _build_common_annotations never called |
Wired into all 3 manifest builders (deployment, statefulset, job) | ✅ Fixed |
| Tools finalize: port exclusions skip request override | Added proper request.x if not None else stored pattern |
✅ Fixed |
Cross-repo conflict: expectedAudience vs extensions#282 |
Removed entirely from backend, frontend, API types | ✅ Clean removal |
Suggestion: defaultOutboundPolicy as free text |
Literal["passthrough", "exchange"] + FormSelect dropdown |
✅ Better UX |
| CodeQL: log injection (5 high) | Removed user values from log messages | ✅ CodeQL now passing |
CI status: All checks passing ✅ (Deploy & Test pending)
Commits: 7 (4 original + 3 fixes), all signed-off
Szybkie i solidne poprawki — gotowe do merge! 🚀
c943bcc to
3d95e90
Compare
|
/run-e2e |
…icy, audience Add expandable "AuthBridge Advanced Configuration" section to both import pages with port exclusion annotations, default outbound policy, and expected audience override. - Port exclusion annotations (kagenti.io/outbound-ports-exclude, kagenti.io/inbound-ports-exclude) applied as pod template annotations - DEFAULT_OUTBOUND_POLICY and EXPECTED_AUDIENCE written to authbridge-config ConfigMap via upsert - Shipwright build annotations and finalize flow propagate all fields Ref #1167, #1168 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Mariusz Sabath <[email protected]>
…ience, CodeQL - Fix upsert_configmap to merge data keys instead of replacing entire ConfigMap, preventing wipe of KEYCLOAK_URL/REALM/ISSUER when writing DEFAULT_OUTBOUND_POLICY to authbridge-config - Wire _build_common_annotations() into all 3 agent manifest builders (deployment, statefulset, job) so port exclusion annotations reach pod templates - Fix tools.py finalize to use request-override-merge pattern for port exclusions and defaultOutboundPolicy (was reading stored config only) - Drop expectedAudience entirely -- being removed in extensions#282 in favor of per-agent CLIENT_ID from /shared/client-id.txt - Use Literal["passthrough","exchange"] for defaultOutboundPolicy and replace free-text input with FormSelect dropdown on both import pages - Fix label asymmetry in upsert_configmap update path - Switch all new f-string loggers to %s-style parametric logging Signed-off-by: Mariusz Sabath <[email protected]>
CodeQL traces taint through %s-style formatting and sanitizer functions. The only reliable fix is to remove user-provided values (name, namespace) from log format arguments entirely, matching the approach adopted on main (244fea3). Signed-off-by: Mariusz Sabath <[email protected]>
- create_tool: use request.defaultOutboundPolicy directly instead of undefined final_default_outbound_policy variable (F821) - finalize_tool_shipwright_build: wire final_default_outbound_policy into authbridge-config ConfigMap upsert (was defined but unused, F841) Signed-off-by: Mariusz Sabath <[email protected]>
3d95e90 to
742fac4
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 |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
Summary
New fields
Test plan
Ref #1167, #1168
Depends on #1174, #1175, #1176