Skip to content

Commit

Permalink
bug: Attack tactics and Platform enums were not parsed properly
Browse files Browse the repository at this point in the history
  • Loading branch information
christophetd committed Jan 19, 2022
1 parent 1be2715 commit a838ec1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions pkg/stratus/mitreattack/tactics.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package mitreattack

import "errors"
import (
"errors"
"strings"
)

type Tactic int

Expand Down Expand Up @@ -33,8 +36,9 @@ const (
)

func AttackTacticFromString(name string) (Tactic, error) {
lowerName := strings.ToLower(name)
for i := range tactics {
if tactics[i] == name {
if strings.ToLower(tactics[i]) == lowerName {
return Tactic(i), nil
}
}
Expand Down
9 changes: 6 additions & 3 deletions pkg/stratus/platform.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package stratus

import "errors"
import (
"errors"
"strings"
)

type Platform string

Expand All @@ -9,8 +12,8 @@ const (
)

func PlatformFromString(name string) (Platform, error) {
switch name {
case AWS:
switch strings.ToLower(name) {
case strings.ToLower(AWS):
return AWS, nil
default:
return "", errors.New("unknown platform: " + name)
Expand Down

0 comments on commit a838ec1

Please sign in to comment.