MCPcopy Create free account
hub / github.com/dagger/dagger / remoteCacheScope

Method remoteCacheScope

core/git_remote.go:147–168  ·  view source on GitHub ↗

Pipelines could query the same remote with different creds (e.g. a pipeline checking that creds were properly rotated) instead of being too smart, we just scope the cache key to the auth configuration: less chance of cache poisoning

()

Source from the content-addressed store, hash-verified

145// Pipelines could query the same remote with different creds (e.g. a pipeline checking that creds were properly rotated)
146// instead of being too smart, we just scope the cache key to the auth configuration: less chance of cache poisoning
147func (repo *RemoteGitRepository) remoteCacheScope() []string {
148 scope := make([]string, 0, 4)
149 if token := repo.AuthToken; token.Self() != nil {
150 if tokenHandle := token.Self().Handle; tokenHandle != "" {
151 scope = append(scope, "token:"+string(tokenHandle))
152 }
153 }
154 if header := repo.AuthHeader; header.Self() != nil {
155 if headerHandle := header.Self().Handle; headerHandle != "" {
156 scope = append(scope, "header:"+string(headerHandle))
157 }
158 }
159 if repo.AuthUsername != "" {
160 scope = append(scope, "username:"+repo.AuthUsername)
161 }
162 if sshSock := repo.SSHAuthSocket; sshSock.Self() != nil {
163 if sshHandle := sshSock.Self().Handle; sshHandle != "" {
164 scope = append(scope, "ssh-auth-scope:"+string(sshHandle))
165 }
166 }
167 return scope
168}
169
170func (repo *RemoteGitRepository) runLsRemote(ctx context.Context) (*gitutil.Remote, error) {
171 query, err := CurrentQuery(ctx)

Callers 1

remoteCacheKeyMethod · 0.95

Calls 1

SelfMethod · 0.80

Tested by

no test coverage detected