99designs / 99designs/keyring

[bug] WinCred kr.Keys() return empty when kr.Set() doesn't call before

Aperta
#97 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
657
Fork
155
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have set `keyring:default:key1`, `keyring:default:key2` already, and can be found in windows Credential Manager.
then test following code:

```
kr, err := keyring.Open(keyring.Config{
AllowedBackends: []keyring.BackendType{keyring.WinCredBackend},
})
if err != nil {
t.Fatal(err)
}
keys, err := kr.Keys()
if err != nil {
t.Fatal(err)
}
```

it would return empty keys. but if I call kr.Set() before kr.Keys(), it would return `keyring:default:key1` and `keyring:default:key2`

```
kr, err := keyring.Open(keyring.Config{
AllowedBackends: []keyring.BackendType{keyring.WinCredBackend},
})
if err != nil {
t.Fatal(err)
}
item1 := keyring.Item{
Key: "test3",
Data: []byte("loose lips sink ships"),
}
err = kr.Set(item1)
if err != nil {
t.Fatal(err)
}
keys, err := kr.Keys()
if err != nil {
t.Fatal(err)
}
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Look at the WinCred backend implementation in the keyring library, likely in a file like wincred.go. The bug is that kr.Keys() returns empty unless kr.Set() is called first. Start by examining how the Windows Credential Manager is queried for existing keys and how the keyring instance caches or initializes its state. Run the provided test code on a Windows system to reproduce the issue, then trace through the Keys() method to see where it fails to retrieve pre-existing credentials.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
go
Ambito
cli, security
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.