fix(controlplane): fallback CAS downloads from invalid backends#3255
fix(controlplane): fallback CAS downloads from invalid backends#3255waveywaves wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
1 issue found across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
40beb87 to
c896cf4
Compare
|
Updated tests for Cubic's edge-case feedback: nil mapped backend, missing default, missing fallback, and invalid fallback. Validation: SKIP_INTEGRATION=true go test ./app/controlplane/pkg/biz -run TestCASBackend -count=1 |
| } | ||
|
|
||
| // FindDownloadBackend returns the mapped backend, or the org default/fallback when the mapped backend is invalid. | ||
| func (uc *CASBackendUseCase) FindDownloadBackend(ctx context.Context, mapped *CASBackend) (*CASBackend, error) { |
There was a problem hiding this comment.
I am not sure this meethod is correct since it checks default, not just fallback, do we want to also check default?
There was a problem hiding this comment.
Yes, default-first is intentional here.
CAS mappings are historical (digest -> backend ID). The issue scenario is credential rotation by creating a new backend pointing at the same storage location and making it the org default, while old mappings still point at the backend with revoked credentials.
So for downloads, when the mapped backend is invalid, we try the org's current default backend first, then the configured fallback. This is safe because the CAS download path verifies the content digest; if the default backend does not contain the exact artifact, the download fails.
I added a code comment to make this intent explicit.
Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
c896cf4 to
036cd20
Compare
Summary
Fixes #3190
Tests
SKIP_INTEGRATION=true go test ./app/controlplane/pkg/biz -run TestCASBackend -count=1SKIP_INTEGRATION=true go test ./app/controlplane/internal/service -count=1SKIP_INTEGRATION=true go test ./app/controlplane/internal/service ./app/controlplane/cmd -run TestDoesNotExist -count=1git diff --check