mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-28 15:21:29 +05:30
Compare commits
24 Commits
ed71c9e95d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f6bc8ab27 | |||
| b0820e3a64 | |||
| f84e99174c | |||
| 65d13910ee | |||
| d21de35039 | |||
| c6ca626eb2 | |||
| 1d2dd3daa2 | |||
| 3a54b5c9b1 | |||
| b68f2ecf6d | |||
| 61072407aa | |||
| a277e525a9 | |||
| c4eb08c6b2 | |||
| b67141d884 | |||
| a25b89fc7b | |||
| 308a004bb3 | |||
| 869b277af1 | |||
| 312e321de7 | |||
| 6fd0550317 | |||
| d930f0631a | |||
| 777084b6aa | |||
| ca5e83c83a | |||
| 7cd63786cf | |||
| 5fcff353e7 | |||
| 390d43e7e4 |
+12
-12
@@ -18,7 +18,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
DESTDIR: ./bin
|
DESTDIR: ./bin
|
||||||
GO_VERSION: 1.25.9
|
GO_VERSION: 1.26.4
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate:
|
||||||
@@ -33,10 +33,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||||
-
|
-
|
||||||
name: Run
|
name: Run
|
||||||
run: |
|
run: |
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||||
@@ -113,7 +113,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
|
||||||
with:
|
with:
|
||||||
files: ${{ env.DESTDIR }}/coverage.txt
|
files: ${{ env.DESTDIR }}/coverage.txt
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
@@ -124,10 +124,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@a66e1c87e2eca0503c343edf1d208c716d54b8a8 # v7.1.0
|
uses: docker/bake-action@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
set: |
|
set: |
|
||||||
@@ -135,7 +135,7 @@ jobs:
|
|||||||
*.cache-to=type=gha,scope=test,mode=max
|
*.cache-to=type=gha,scope=test,mode=max
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
|
||||||
with:
|
with:
|
||||||
files: ${{ env.DESTDIR }}//coverage.txt
|
files: ${{ env.DESTDIR }}//coverage.txt
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
@@ -149,15 +149,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
|
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
run: |
|
run: |
|
||||||
@@ -196,7 +196,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
uses: crazy-max/.github/.github/workflows/zizmor.yml@d89fe92d808a15e2b2ed5cdb62db7c172c31410d # v1.6.0
|
uses: crazy-max/.github/.github/workflows/zizmor.yml@716fd1c51a46c5d93a41d44a94b439c9ee802536 # v1.10.0
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
security-events: write
|
security-events: write
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# GO_VERSION sets the version of the golang base image to use.
|
# GO_VERSION sets the version of the golang base image to use.
|
||||||
# It must be a valid tag in the docker.io/library/golang image repository.
|
# It must be a valid tag in the docker.io/library/golang image repository.
|
||||||
ARG GO_VERSION=1.25.9
|
ARG GO_VERSION=1.26.4
|
||||||
|
|
||||||
# BASE_DEBIAN_DISTRO sets the golang base image debian variant to use.
|
# BASE_DEBIAN_DISTRO sets the golang base image debian variant to use.
|
||||||
# It must be a valid variant in the docker.io/library/golang image repository.
|
# It must be a valid variant in the docker.io/library/golang image repository.
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# GO_VERSION sets the version of the golang base image to use.
|
# GO_VERSION sets the version of the golang base image to use.
|
||||||
# It must be a valid tag in the docker.io/library/golang image repository.
|
# It must be a valid tag in the docker.io/library/golang image repository.
|
||||||
ARG GO_VERSION=1.25.9
|
ARG GO_VERSION=1.26.4
|
||||||
|
|
||||||
# BASE_DEBIAN_DISTRO sets the golang base image debian variant to use.
|
# BASE_DEBIAN_DISTRO sets the golang base image debian variant to use.
|
||||||
# It must be a valid variant in the docker.io/library/golang image repository.
|
# It must be a valid variant in the docker.io/library/golang image repository.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build linux && cgo
|
//go:build (linux || openbsd) && cgo
|
||||||
|
|
||||||
package secretservice
|
package secretservice
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build linux && cgo
|
//go:build (linux || openbsd) && cgo
|
||||||
|
|
||||||
package secretservice
|
package secretservice
|
||||||
|
|
||||||
|
|||||||
+13
-17
@@ -5,7 +5,6 @@ package wincred
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
|
||||||
|
|
||||||
winc "github.com/danieljoos/wincred"
|
winc "github.com/danieljoos/wincred"
|
||||||
"github.com/docker/docker-credential-helpers/credentials"
|
"github.com/docker/docker-credential-helpers/credentials"
|
||||||
@@ -17,12 +16,14 @@ type Wincred struct{}
|
|||||||
|
|
||||||
// Add adds new credentials to the windows credentials manager.
|
// Add adds new credentials to the windows credentials manager.
|
||||||
func (h Wincred) Add(creds *credentials.Credentials) error {
|
func (h Wincred) Add(creds *credentials.Credentials) error {
|
||||||
credsLabels := []byte(credentials.CredsLabel)
|
|
||||||
g := winc.NewGenericCredential(creds.ServerURL)
|
g := winc.NewGenericCredential(creds.ServerURL)
|
||||||
g.UserName = creds.Username
|
g.UserName = creds.Username
|
||||||
g.CredentialBlob = []byte(creds.Secret)
|
g.CredentialBlob = []byte(creds.Secret)
|
||||||
g.Persist = winc.PersistLocalMachine
|
g.Persist = winc.PersistLocalMachine
|
||||||
g.Attributes = []winc.CredentialAttribute{{Keyword: "label", Value: credsLabels}}
|
g.Attributes = append(g.Attributes, winc.CredentialAttribute{
|
||||||
|
Keyword: "label",
|
||||||
|
Value: []byte(credentials.CredsLabel),
|
||||||
|
})
|
||||||
|
|
||||||
return g.Write()
|
return g.Write()
|
||||||
}
|
}
|
||||||
@@ -54,9 +55,7 @@ func (h Wincred) Get(serverURL string) (string, string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, attr := range g.Attributes {
|
for _, attr := range g.Attributes {
|
||||||
if strings.Compare(attr.Keyword, "label") == 0 &&
|
if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) {
|
||||||
bytes.Compare(attr.Value, []byte(credentials.CredsLabel)) == 0 {
|
|
||||||
|
|
||||||
return g.UserName, string(g.CredentialBlob), nil
|
return g.UserName, string(g.CredentialBlob), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,11 +74,10 @@ func getTarget(serverURL string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var targets []string
|
var targets []string
|
||||||
for i := range creds {
|
for _, cred := range creds {
|
||||||
attrs := creds[i].Attributes
|
for _, attr := range cred.Attributes {
|
||||||
for _, attr := range attrs {
|
|
||||||
if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) {
|
if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) {
|
||||||
targets = append(targets, creds[i].TargetName)
|
targets = append(targets, cred.TargetName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,16 +134,14 @@ func (h Wincred) List() (map[string]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp := make(map[string]string)
|
resp := make(map[string]string)
|
||||||
for i := range creds {
|
|
||||||
attrs := creds[i].Attributes
|
|
||||||
for _, attr := range attrs {
|
|
||||||
if strings.Compare(attr.Keyword, "label") == 0 &&
|
|
||||||
bytes.Compare(attr.Value, []byte(credentials.CredsLabel)) == 0 {
|
|
||||||
|
|
||||||
resp[creds[i].TargetName] = creds[i].UserName
|
for _, cred := range creds {
|
||||||
|
for _, attr := range cred.Attributes {
|
||||||
|
if attr.Keyword == "label" && bytes.Equal(attr.Value, []byte(credentials.CredsLabel)) {
|
||||||
|
resp[cred.TargetName] = cred.UserName
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user