Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid duplicate secret accessor conversion #6809

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Mar 4, 2024

Fixes regression from #6601, see discord discussion.

Essentially, it became possible to construct an input which would apply the secret accessor translation twice. If one of the frontend inputs was constructed from dagger, it could already have an accessor secret ID as part of it's build graph (if WithExec was used alongside a secret).

However, this input could appear inside the frontend request - which would result in double-wrapping the secret accessor to a secret that definitely can't exist, which presents the weird error.

The easiest solution to this is to just track the inputs for dagger calls to buildkit's Solve request, and to ensure that we avoid secret filtering for those inputs.

Fixes regression from 08cb122.

Essentially, it became possible to construct an input which would apply
the secret accessor translation twice. If one of the frontend inputs was
constructed from dagger, it could already have an accessor secret ID as
part of it's build graph (if `WithExec` was used alongside a secret).

However, this input could appear inside the frontend request - which
would result in double-wrapping the secret accessor to a secret that
definitely can't exist, which presents the weird error.

The easiest solution to this is to just track the inputs for dagger
calls to buildkit's Solve request, and to ensure that we avoid secret
filtering for those inputs.

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc added this to the v0.10.1 milestone Mar 4, 2024
@jedevc jedevc requested a review from sipsma March 4, 2024 12:47
Signed-off-by: Justin Chadwell <me@jedevc.com>
@@ -147,6 +153,8 @@ func (dag *OpDAG) walk(f func(*OpDAG) error, memo map[*OpDAG]struct{}) error {
return nil
}

var SkipInputs = fmt.Errorf("skip inputs") //nolint:stylecheck // Err prefix isn't convention for Walk control errors
Copy link

@spirulence spirulence Mar 5, 2024

Choose a reason for hiding this comment

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

Would it be beneficial to ignore just the style check rule that's flagging the Err prefix here instead of the whole style check linter? I'm not sure what the convention is for dagger but I have done this with terraform lint and security tools in private codebases before.

@jedevc jedevc merged commit 0364d3d into dagger:main Mar 5, 2024
43 checks passed
@jedevc jedevc deleted the fix-input-secret-ids branch March 5, 2024 09:24
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.

None yet

3 participants