Skip to content

Commit

Permalink
bug: fixed #225
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Apr 24, 2024
1 parent 166979d commit b851c3e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/scanners/synw/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (a *SynapseWorkspaceScanner) getWorkspaceRules() map[string]scanners.AzureR
Impact: scanners.ImpactHigh,
Eval: func(target interface{}, scanContext *scanners.ScanContext) (bool, string) {
c := target.(*armsynapse.Workspace)
return *c.Properties.ManagedVirtualNetwork != "default", ""
return c.Properties.ManagedVirtualNetwork == nil || strings.ToLower(*c.Properties.ManagedVirtualNetwork) != "default", ""
},
Url: "https://learn.microsoft.com/en-us/security/benchmark/azure/baselines/azure-synapse-analytics-security-baseline?toc=%2Fazure%2Fsynapse-analytics%2Ftoc.json",
},
Expand Down
19 changes: 18 additions & 1 deletion internal/scanners/synw/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestSynapseWorkspaceScanner_WorkspaceRules(t *testing.T) {
},
},
{
name: "SynapseWorkspaceScanner Security Profile",
name: "SynapseWorkspaceScanner ManagedVirtualNetwork default",
fields: fields{
rule: "synw-006",
target: &armsynapse.Workspace{
Expand All @@ -108,6 +108,23 @@ func TestSynapseWorkspaceScanner_WorkspaceRules(t *testing.T) {
result: "",
},
},
{
name: "SynapseWorkspaceScanner ManagedVirtualNetwork null",
fields: fields{
rule: "synw-006",
target: &armsynapse.Workspace{
Name: to.Ptr("synw-test"),
Properties: &armsynapse.WorkspaceProperties{
ManagedVirtualNetwork: nil,
},
},
scanContext: &scanners.ScanContext{},
},
want: want{
broken: true,
result: "",
},
},
{
name: "SynapseWorkspaceScanner Security Profile",
fields: fields{
Expand Down

0 comments on commit b851c3e

Please sign in to comment.