regex fixes for environment variables
This commit is contained in:
6
main.go
6
main.go
@@ -21,7 +21,7 @@ const (
|
||||
ROOT_USER = "1000"
|
||||
ROOT_GROUP = "1000"
|
||||
//this is an insane regex to detect IP:PORT:PORT in port configuration but also supports the ability to detect secrets.* and vars.* from workflows
|
||||
IM_SO_SORRY = `^(\${{\s*(vars|secrets)\.[[:alnum:]]+\s*}}|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}:(\${{\s*(vars|secrets)\.[[:alnum:]]+\s*}}|[0-9]+){1}:(\${{\s*(vars|secrets)\.[[:alnum:]]+\s*}}|[0-9]+){1}$`
|
||||
IM_SO_SORRY = `^(\${\s*\w+\s*}|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}){1}:(\${\s*\w+\s*}|[0-9]+){1}:(\${\s*\w+\s*}|[0-9]+){1}$`
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -173,7 +173,7 @@ func SecurityOptCheck(srv compose.ServiceConfig) *issue.Issue {
|
||||
for _, opt := range *srv.SecOpts {
|
||||
if strings.EqualFold(opt, PRIVILEGE_OPT) {
|
||||
i.Passed()
|
||||
i.Messages = append(i.Messages, "security option are safe")
|
||||
i.Messages = append(i.Messages, "security options are safe")
|
||||
return i
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ func PortCheck(srv compose.ServiceConfig) ([]*issue.Issue, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
ms, err := regexp.Match(`^\${{\s*(vars|secrets)\.[[:alnum:]]+\s*}}{1}:\${{\s*(vars|secrets)\.[[:alnum:]]+\s*}}{1}$`, []byte(prt))
|
||||
ms, err := regexp.Match(`^\${\s*\w+\s*}{1}:\${\s*\w+\s*}{1}$`, []byte(prt))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user