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
()
| 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 |
| 147 | func (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 | |
| 170 | func (repo *RemoteGitRepository) runLsRemote(ctx context.Context) (*gitutil.Remote, error) { |
| 171 | query, err := CurrentQuery(ctx) |