Skip to content

core: lend credentials to a module's declared git clients - #14493

Merged
eunomie merged 5 commits into
eunomie/module-clients-4-git-commit-keyfrom
eunomie/module-clients-5-private-git-clients
Oct 6, 2026
Merged

eunomie merged 5 commits into
eunomie/module-clients-4-git-commit-keyfrom
eunomie/module-clients-5-private-git-clients

Conversation

@eunomie

@eunomie eunomie commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Module code reaches a client through serveModule, not as a dependency, so a private git client failed for lack of credentials.

Boundary change

Module runtime code may borrow the session's main-client git credentials only for git addresses declared in the module's governing config. When the calling module's own config declares the address, the engine resolves it as it resolves a declared dependency. An undeclared address still fails, now with a hint to declare it as a client. Plain programs are unchanged.

The governing config is the nearest dagger.toml between the module's directory and the root of its own tree; for a host module it is read from the host at serveModule time.

Caching

Calls depending on declared git clients are cached per session: the declared git clients are part of the module call's cache key, so a result computed while a client was declared is not served from cache after the declaration changes or disappears without the authorization check running again.

Tests

core/integration/module_serve_git_trust_test.go adds TestServeModuleDeclaredGitClient (five subtests), plus a cache-key subtest that checks a call misses the cache after the declaration changes while the module's own source digest is unchanged.

Cost

The key now reads the governing config on each call of a module that has a tree. The cost is not measured.

Known gap

generate through moduleSource(refString:) on a private ref still fails; that path is out of scope here.

Open questions for the engine owners

  • whose credentials to lend (the session's main client today);
  • whether a third-party module may borrow the user's credentials for repos its own config declares;
  • match granularity (ignores ref and scheme);
  • whether moduleSource(refString:) should get the same check;
  • whether to cache the declarations.

Depends on

#14489 and #14490 (stack positions 1 and 2).

@eunomie
eunomie added this pull request to stack #14495 October 5, 2026 16:00
@eunomie eunomie changed the title eunomie/module clients 5 private git clients core: lend credentials to a module's declared git clients Oct 5, 2026
@eunomie
eunomie force-pushed the eunomie/module-clients-5-private-git-clients branch from bda4f4f to 37f625a Compare October 5, 2026 16:10
@eunomie
eunomie marked this pull request as ready for review October 5, 2026 16:31
@eunomie
eunomie force-pushed the eunomie/module-clients-5-private-git-clients branch 2 times, most recently from 44b60c0 to de4d808 Compare October 6, 2026 11:05
@eunomie
eunomie force-pushed the eunomie/module-clients-5-private-git-clients branch from de4d808 to 2c0ebe4 Compare October 6, 2026 12:26
Extends the mapping of module scopes to local clients; local clients,
and the call key built from them, are unchanged.

Signed-off-by: Yves Brissaud <[email protected]>
Reads the dagger.toml that governs a module in the tree its local
clients resolve in, so a client is trusted on the module's own config.

Signed-off-by: Yves Brissaud <[email protected]>
Module code reaches a client through serveModule, not as a dependency,
so a private client it declares failed for lack of credentials.

Signed-off-by: Yves Brissaud <[email protected]>
The config that declares them can sit outside the module's source, so a
result computed with lent credentials outlived a removed declaration and
reached sessions that cannot lend them.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie force-pushed the eunomie/module-clients-5-private-git-clients branch from 2c0ebe4 to 0aa75b9 Compare October 6, 2026 13:02
@eunomie
eunomie merged commit 47b9295 into main Oct 6, 2026
90 checks passed
@eunomie
eunomie deleted the eunomie/module-clients-5-private-git-clients branch October 6, 2026 14:02
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