Skip to content

refactor(controlplane): remove regex support in authz middleware#3246

Merged
migmartri merged 3 commits into
chainloop-dev:mainfrom
jiparis:jiparis/remove-middleware-regex
Jun 26, 2026
Merged

refactor(controlplane): remove regex support in authz middleware#3246
migmartri merged 3 commits into
chainloop-dev:mainfrom
jiparis:jiparis/remove-middleware-regex

Conversation

@jiparis

@jiparis jiparis commented Jun 26, 2026

Copy link
Copy Markdown
Member

Removes the regex fallback from the authorization policy lookup in the control plane middleware, relying solely on exact endpoint matching against the server operations map.

The only rule that depended on the regex fallback (/controlplane.v1.OrgMetricsService/.*) is replaced with explicit entries for the Totals, TopWorkflowsByRunsCount, and DailyRunsCount endpoints.

This makes authorization matching unambiguous and avoids the risk of a loose pattern accidentally authorizing unintended operations.

AI Disclosure

This contribution was assisted by Claude Code.

Review in cubic

Replace the regex fallback in the authz policy lookup with exact endpoint
matching. The only rule relying on it ("/controlplane.v1.OrgMetricsService/.*")
is replaced by explicit entries for the Totals, TopWorkflowsByRunsCount and
DailyRunsCount endpoints.

Assisted-by: Claude Code
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>

Chainloop-Trace-Sessions: af6e1c77-67e9-454c-8a56-5220930f328c
@chainloop-platform

chainloop-platform Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

AI Session Analysis

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 87% 1 ✅ 0 97% AI / 3% Human 3 +18 / -84 9m15s

🟢 87% — 97% AI — ✅ All policies passing

Jun 26, 2026 13:55 UTC · 9m15s · $7.33 · 176.5k in / 33.6k out · claude-code 2.1.170 (claude-opus-4-8)

View session details ↗

Change Summary

  • Removes regex fallback from policiesLookup and keeps exact endpoint lookup only.
  • Replaces the OrgMetricsService wildcard authz rule with explicit RPC endpoints.
  • Updates middleware tests for exact-match behavior, then commits and pushes the branch.

AI Session Overall Score

🟢 87% — Strong implementation and verification; PR-opening step appears incomplete.

AI Session Analysis Breakdown

🟢 94% · scope-discipline

No notes.

🟢 93% · solution-quality

🟢 AI removed the regex fallback instead of patching around it. · High Impact

🟢 92% · context-and-planning

🟢 AI wrote a concrete three-file plan before making any edits. · High Impact

🟢 91% · verification

🟢 AI ran go test ./pkg/authz/... and observed package tests passing. · High Impact

🟢 90% · user-trust-signal

No notes.

🟡 68% · alignment

🟠 Asked to create a PR, but the session shows commit and push only. · Medium Severity

💡 When the ask is to create a PR, show the PR command or say you stopped at push.


File Attribution

███████████████████░ 97% AI / 3% Human

Status Attribution File Lines
modified ai app/controlplane/pkg/authz/middleware/middleware_test.go +10 / -57
modified ai app/controlplane/pkg/authz/authz.go +6 / -12
modified ai app/controlplane/pkg/authz/middleware/middleware.go +2 / -15

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-af6e1c -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-af6e1c -
✅ Passed ai-config-no-secrets ai-coding-session-af6e1c -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-af6e1c -

Powered by Chainloop and Chainloop Trace

@jiparis jiparis requested a review from a team June 26, 2026 14:00

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/controlplane/pkg/authz/authz.go
jiparis added 2 commits June 26, 2026 16:03
…inloop-dev#3245)"

This reverts commit e7ebb3e.

Assisted-by: Claude Code
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>

Chainloop-Trace-Sessions: af6e1c77-67e9-454c-8a56-5220930f328c
@migmartri migmartri merged commit 632bc95 into chainloop-dev:main Jun 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants