Skip to content

Commit 410ae00

Browse files
committed
Remove JSON pre-processing for "SECRET:*" values
1 parent 98a1d79 commit 410ae00

2 files changed

Lines changed: 1 addition & 24 deletions

File tree

engine/appconfig.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"os"
77

88
"github.com/project-flogo/core/app"
9-
"github.com/project-flogo/core/engine/secret"
109
"github.com/project-flogo/core/support"
1110
)
1211

@@ -58,13 +57,8 @@ func LoadAppConfig(flogoJson string, compressed bool) (*app.Config, error) {
5857
}
5958
}
6059

61-
updated, err := secret.PreProcessConfig(jsonBytes)
62-
if err != nil {
63-
return nil, err
64-
}
65-
6660
appConfig := &app.Config{}
67-
err = json.Unmarshal(updated, &appConfig)
61+
err := json.Unmarshal(jsonBytes, &appConfig)
6862
if err != nil {
6963
return nil, err
7064
}

engine/secret/config.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
package secret
22

33
import (
4-
"regexp"
54
"strings"
65
)
76

8-
func PreProcessConfig(appJson []byte) ([]byte, error) {
9-
10-
// For now decode secret values
11-
re := regexp.MustCompile("SECRET:[^\\\\\"]*")
12-
for _, match := range re.FindAll(appJson, -1) {
13-
decodedValue, err := resolveSecretValue(string(match))
14-
if err != nil {
15-
return nil, err
16-
}
17-
appstring := strings.Replace(string(appJson), string(match), decodedValue, -1)
18-
appJson = []byte(appstring)
19-
}
20-
21-
return appJson, nil
22-
}
23-
247
func resolveSecretValue(encrypted string) (string, error) {
258
encodedValue := string(encrypted[7:])
269
decodedValue, err := GetSecretValueHandler().DecodeValue(encodedValue)

0 commit comments

Comments
 (0)