MCPcopy Create free account
hub / github.com/docker/secrets-engine / GetSecrets

Method GetSecrets

plugins/pass/plugin.go:36–61  ·  view source on GitHub ↗
(ctx context.Context, pattern plugin.Pattern)

Source from the content-addressed store, hash-verified

34}
35
36func (m *passPlugin) GetSecrets(ctx context.Context, pattern plugin.Pattern) ([]plugin.Envelope, error) {
37 list, err := m.kc.Filter(ctx, pattern)
38 if err != nil {
39 return nil, err
40 }
41
42 var result []plugin.Envelope
43 for id, value := range list {
44 // Skip secrets-engine's own secrets so plugin callers never see internal state.
45 if realms.SecretsEngine.Match(id) {
46 continue
47 }
48 s, err := unpackValue(id, value)
49 if err != nil {
50 m.logger.Errorf("unwrapping secret '%s': %s", id, err)
51 continue
52 }
53 result = append(result, *s)
54 }
55
56 if len(result) == 0 {
57 return nil, plugin.ErrNotFound
58 }
59
60 return result, nil
61}
62
63func unpackValue(id store.ID, secret store.Secret) (*plugin.Envelope, error) {
64 impl, ok := secret.(*pass.PassValue)

Callers 1

Test_passPluginFunction · 0.95

Calls 4

unpackValueFunction · 0.85
FilterMethod · 0.65
MatchMethod · 0.65
ErrorfMethod · 0.65

Tested by 1

Test_passPluginFunction · 0.76