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

core: fix custom CA certs in modules + add integ test coverage #7356

Merged
merged 2 commits into from May 13, 2024

Conversation

sipsma
Copy link
Contributor

@sipsma sipsma commented May 10, 2024

A recent commit that changed client IDs to be random again accidentally made it so that commands run to update CA certificates (when a custom engine has those installed) hit errors about client tokens not matching when the exec being run was nested, which includes module function calls.

This was due to the fact that those commands run in the same container with the same client ID but the secret token was generated by the client each time it ran, which resulted in mismatches.

The fix here just updates those extra CA commands to never be nested execs since there's no purpose in that anyways and it's nothing but overhead.

This was missed because I forgot to include integ tests that invoke module functions amongst all the other many tests that were added for custom CA support. Those have been added now for go, python and typescript.

When adding the test for typescript functions, I also learned that nodejs will by default only use a CA bundle compiled into the node binary. So this also updates the typescript SDK to tell nodejs to use the system CAs instead (while also making sure they include the default Mozilla CA set, which is what nodejs is compiled with anyways).

A recent commit that changed client IDs to be random again accidentally
made it so that commands run to update CA certificates (when a custom
engine has those installed) hit errors about client tokens not matching
when the exec being run was nested, which includes module function
calls.

This was due to the fact that those commands run in the same container
with the same client ID but the secret token was generated by the client
each time it ran, which resulted in mismatches.

The fix here just updates those extra CA commands to never be nested
execs since there's no purpose in that anyways and it's nothing but
overhead.
* We just unset the relevant env var for those commands, which is a bit
  ugly but not any more than the existing ugliness. Fortunately the
  other ongoing effort to clean all this up should help a lot here.

This was missed because I forgot to include integ tests that invoke
module functions amongst all the other many tests that were added for
custom CA support. Those have been added now for go, python and
typescript.

When adding the test for typescript functions, I also learned that
nodejs will by default only use a CA bundle compiled into the node
binary. So this also updates the typescript SDK to tell nodejs to use
the system CAs instead (which also making sure they include the default
Mozilla CA set, which is what nodejs is compiled with anyways).

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
@sipsma sipsma added this to the v0.11.4 milestone May 10, 2024
@sipsma sipsma requested review from vito, jedevc and TomChv May 10, 2024 20:49
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
@gerhard gerhard modified the milestones: v0.11.4, next May 12, 2024
require.Equal(t, "hello", strings.TrimSpace(out))
}},

caCertsTest{"typescript module", func(t *testing.T, c *dagger.Client, f caCertsTestFixtures) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty cool seeing all these side-by-side!

@sipsma sipsma merged commit 2ae9f4d into dagger:main May 13, 2024
63 checks passed
@dagger dagger deleted a comment May 14, 2024
@gerhard gerhard modified the milestones: next, v0.11.5 May 16, 2024
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

4 participants