Skip to content

Commit

Permalink
feat: esc6a edge composition (#359)
Browse files Browse the repository at this point in the history
* feat: esc6a edge composition

* chore: allow composition accordion to show for 6a

* fix: add trustedby rel to path4 pattern, use outboundwithdepth for optional memberof traversal

* chore: update dcfor pattern to use outboundwithdepth for optional group membership
  • Loading branch information
urangel authored Jan 30, 2024
1 parent d15c53a commit e43b0d3
Show file tree
Hide file tree
Showing 8 changed files with 408 additions and 8 deletions.
52 changes: 52 additions & 0 deletions cmd/api/src/analysis/ad/adcs_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,58 @@ func TestADCSESC6a(t *testing.T) {
require.Contains(t, names, "Group1", "Group2")
}

if edge, err := tx.Relationships().Filterf(func() graph.Criteria {
return query.And(
query.Kind(query.Relationship(), ad.ADCSESC6a),
query.Equals(query.StartProperty(common.Name.String()), "Group1"),
)
}).First(); err != nil {
t.Fatalf("error fetching esc6a edges in integration test; %v", err)
} else {
composition, err := ad2.GetADCSESC6aEdgeComposition(context.Background(), db, edge)
require.Nil(t, err)
names := []string{}
for _, node := range composition.AllNodes() {
name, _ := node.Properties.Get(common.Name.String()).String()
names = append(names, name)
}
require.Equal(t, 8, len(composition.AllNodes()))
require.Contains(t, names, "Group1")
require.Contains(t, names, "Group0")
require.Contains(t, names, "CertTemplate1")
require.Contains(t, names, "EnterpriseCA")
require.Contains(t, names, "RootCA")
require.Contains(t, names, "NTAuthStore")
require.Contains(t, names, "DC")
require.Contains(t, names, "Domain")
}

if edge, err := tx.Relationships().Filterf(func() graph.Criteria {
return query.And(
query.Kind(query.Relationship(), ad.ADCSESC6a),
query.Equals(query.StartProperty(common.Name.String()), "Group2"),
)
}).First(); err != nil {
t.Fatalf("error fetching esc6a edges in integration test; %v", err)
} else {
composition, err := ad2.GetADCSESC6aEdgeComposition(context.Background(), db, edge)
require.Nil(t, err)
names := []string{}
for _, node := range composition.AllNodes() {
name, _ := node.Properties.Get(common.Name.String()).String()
names = append(names, name)
}
require.Equal(t, 8, len(composition.AllNodes()))
require.Contains(t, names, "Group2")
require.Contains(t, names, "Group0")
require.Contains(t, names, "CertTemplate2")
require.Contains(t, names, "EnterpriseCA")
require.Contains(t, names, "RootCA")
require.Contains(t, names, "NTAuthStore")
require.Contains(t, names, "DC")
require.Contains(t, names, "Domain")
}

return nil
})
})
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/src/test/integration/harnesses.go
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,7 @@ func initHarnessNodeProperties(c *GraphTestContext, nodeMap map[string]*graph.No
}

//This is an exception for schemaVersion which should not be a boolean
if value == "1" || value == "0" {
if value == "1" || value == "0" || value == "2" {
intValue, _ := strconv.ParseInt(value, 10, 32)
nodeMap[node.ID].Properties.Set(strings.ToLower(key), float64(intValue))
} else if boolValue, err := strconv.ParseBool(value); err != nil {
Expand Down
4 changes: 3 additions & 1 deletion cmd/ui/src/views/Explore/EdgeInfo/EdgeInfoContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ const EdgeInfoContent: FC<{ selectedEdge: NonNullable<SelectedEdge> }> = ({ sele
const sendOnChange =
(selectedEdge.name === 'GoldenCert' ||
selectedEdge.name === 'ADCSESC1' ||
selectedEdge.name === 'ADCSESC3' || selectedEdge.name === 'ADCSESC9a') &&
selectedEdge.name === 'ADCSESC3' ||
selectedEdge.name === 'ADCSESC6a' ||
selectedEdge.name === 'ADCSESC9a') &&
section[0] === 'composition';

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ const ExploreSearchCombobox: React.FC<{
},
startAdornment: selectedItem?.type && <NodeIcon nodeType={selectedItem?.type} />,
}}
{...getInputProps({ onFocus: openMenu, refKey: 'inputRef', onChange: (e) => {handleNodeEdited(e.currentTarget.value)} })}
{...getInputProps({
onFocus: openMenu,
refKey: 'inputRef',
onChange: (e) => {
handleNodeEdited(e.currentTarget.value);
},
})}
data-testid='explore_search_input-search'
/>
<div
Expand Down
Loading

0 comments on commit e43b0d3

Please sign in to comment.