MCPcopy Create free account
hub / github.com/github/gh-aw / findUnsafeEngineEnvSecretKeys

Function findUnsafeEngineEnvSecretKeys

pkg/cli/codemod_engine_env_secrets.go:131–151  ·  view source on GitHub ↗
(envMap map[string]any, allowed map[string]struct {
})

Source from the content-addressed store, hash-verified

129}
130
131func findUnsafeEngineEnvSecretKeys(envMap map[string]any, allowed map[string]struct {
132}) map[string]struct {
133} {
134 unsafe := make(map[string]struct {
135 })
136 for key, value := range envMap {
137 if setutil.Contains(allowed, key) {
138 continue
139 }
140 strVal, ok := value.(string)
141 if !ok {
142 continue
143 }
144 if len(workflow.ExtractSecretsFromMap(map[string]string{key: strVal})) > 0 {
145 unsafe[key] = struct {
146 }{}
147 }
148 }
149 engineEnvSecretsCodemodLog.Printf("Found %d unsafe engine.env secret keys out of %d total keys", len(unsafe), len(envMap))
150 return unsafe
151}
152
153func removeUnsafeEngineEnvKeys(lines []string, unsafeKeys map[string]struct {
154}) ([]string, bool) {

Callers 1

Calls 3

ContainsFunction · 0.92
ExtractSecretsFromMapFunction · 0.92
PrintfMethod · 0.45

Tested by

no test coverage detected