fix(cas-redirection): Avoid returning URL when CAS is not valid#2796
Merged
javirln merged 4 commits intochainloop-dev:mainfrom Mar 2, 2026
Merged
fix(cas-redirection): Avoid returning URL when CAS is not valid#2796javirln merged 4 commits intochainloop-dev:mainfrom
javirln merged 4 commits intochainloop-dev:mainfrom
Conversation
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
There was a problem hiding this comment.
3 issues found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/controlplane/internal/service/casredirect.go">
<violation number="1" location="app/controlplane/internal/service/casredirect.go:52">
P2: `casBackendUC` is injected into the struct and constructor but never used by any method. This adds an unnecessary dependency (including to the wire dependency-injection graph) with no benefit. Remove the field, the constructor parameter, and the assignment.
(Based on your team's feedback about removing unused code, methods, and variables.) [FEEDBACK_USED]</violation>
<violation number="2" location="app/controlplane/internal/service/casredirect.go:117">
P3: Grammar error in user-facing error message: "on a invalid state" should be "in an invalid state".</violation>
</file>
<file name="app/controlplane/internal/server/grpc.go">
<violation number="1" location="app/controlplane/internal/server/grpc.go:100">
P1: The new `CASRedirectService/DownloadRedirect` entry in `fullyConfiguredCASBackendRequireRegexp` is unreachable. This regexp is only checked inside a `selector.Server(…).Match(requireRobotAccountMatcher())` block (line 262), but `robotAccountRequireRegexp` does not include `CASRedirectService`. The outer selector never matches this operation, so the inner CAS-backend validation middlewares (`ValidateCASBackend` + `BlockIfCASBackendNotValid`) are never applied to `DownloadRedirect`.
To make this effective, `CASRedirectService/DownloadRedirect` also needs to be added to `robotAccountRequireRegexp`, or the CAS-backend validation needs to be wired through a different middleware path that covers this operation.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/controlplane/internal/service/casredirect.go">
<violation number="1" location="app/controlplane/internal/service/casredirect.go:115">
P3: Grammar fix is incomplete: `"in a invalid state"` should be `"in an invalid state"`. The word "invalid" starts with a vowel sound, so the article should be "an".</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Piskoo
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the two changes made:
CASBackendValidationOK, the handler now returns a 403ErrorCasBackendErrorReasonInvalidinstead of lettingGenerateTemporaryCredentialsfail with an opaque 500. This mirrors the pattern in attestation.go