Skip to content

Commit 8a0561a

Browse files
resolved ahrav comments
1 parent 143947a commit 8a0561a

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

pkg/analyzer/analyzers/launchdarkly/launchdarkly.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,16 @@ func secretInfoResourceToAnalyzerResource(resource Resource) *analyzers.Resource
129129

130130
// getPermissionType return what type of permission is assigned to token
131131
func getPermissionType(token Token) string {
132-
permission := ""
133-
134-
if token.Role != "" {
135-
permission = token.Role
136-
} else if token.hasInlineRole() {
137-
permission = "Inline Policy"
138-
} else if token.hasCustomRoles() {
139-
permission = "Custom Roles"
132+
switch {
133+
case token.Role != "":
134+
return token.Role
135+
case token.hasInlineRole():
136+
return "Inline Policy"
137+
case token.hasCustomRoles():
138+
return "Custom Roles"
139+
default:
140+
return ""
140141
}
141-
142-
return permission
143142
}
144143

145144
// printUser print User information from secret info to cli

pkg/analyzer/analyzers/launchdarkly/models.go

+4-13
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ var (
2323
type SecretInfo struct {
2424
User User
2525
Permissions []string
26-
Resources []Resource
27-
// to concurrently read and write
28-
mu sync.RWMutex
26+
27+
mu sync.RWMutex
28+
Resources []Resource
2929
}
3030

3131
// User is the information about the user to whom the token belongs
@@ -60,16 +60,7 @@ type CustomRole struct {
6060
AssignedToTeams int
6161
}
6262

63-
/*
64-
policy is a set of statements
65-
66-
Jargon:
67-
- Resource: List of resources
68-
- NotResources: Except this list of resources
69-
- Actions: List of actions
70-
- NotActions: Except this list of actions
71-
- Effect: Allowed or Denied
72-
*/
63+
// policy is a set of statements
7364
type Policy struct {
7465
Resources []string
7566
NotResources []string

0 commit comments

Comments
 (0)