Skip to content

Commit

Permalink
feat: esc10b composition (#384)
Browse files Browse the repository at this point in the history
* feat: esc10b composition

* wip

* added integration test

* updated loggin message

* fixed logging typo

---------

Co-authored-by: Wesley Robert Maffly-Kipp <[email protected]>
Co-authored-by: Rohan Vazarkar <[email protected]>
  • Loading branch information
3 people authored Feb 9, 2024
1 parent 5712835 commit e563545
Show file tree
Hide file tree
Showing 13 changed files with 1,365 additions and 1,551 deletions.
37 changes: 31 additions & 6 deletions cmd/api/src/analysis/ad/adcs_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1306,8 +1306,6 @@ func TestADCSESC6a(t *testing.T) {
operation.Operation.SubmitReader(func(ctx context.Context, tx graph.Transaction, outC chan<- analysis.CreatePostRelationshipJob) error {
if err := ad2.PostADCSESC6a(ctx, tx, outC, groupExpansions, innerEnterpriseCA, innerDomain, cache); err != nil {
t.Logf("failed post processing for %s: %v", ad.ADCSESC6a.String(), err)
} else {
return nil
}

return nil
Expand Down Expand Up @@ -1341,7 +1339,7 @@ func TestADCSESC6a(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6a edges in integration test; %v", err)
} else {
composition, err := ad2.GetADCSESC6aEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)
names := []string{}
for _, node := range composition.AllNodes() {
Expand All @@ -1367,7 +1365,7 @@ func TestADCSESC6a(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6a edges in integration test; %v", err)
} else {
composition, err := ad2.GetADCSESC6aEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)
names := []string{}
for _, node := range composition.AllNodes() {
Expand Down Expand Up @@ -1522,7 +1520,7 @@ func TestADCSESC6b(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6b edge in integration test: %v", err)
} else {
composition, err := ad2.GetADCSESC6bEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)

require.Equal(t, 8, len(composition.AllNodes()))
Expand All @@ -1547,7 +1545,7 @@ func TestADCSESC6b(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6b edge in integration test: %v", err)
} else {
composition, err := ad2.GetADCSESC6bEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)

require.Equal(t, 8, len(composition.AllNodes()))
Expand Down Expand Up @@ -2229,6 +2227,33 @@ func TestADCSESC10b(t *testing.T) {
}
return nil
})

db.ReadTransaction(context.Background(), func(tx graph.Transaction) error {
if results, err := ops.FetchRelationships(tx.Relationships().Filterf(func() graph.Criteria {
return query.Kind(query.Relationship(), ad.ADCSESC10b)
})); err != nil {
t.Fatalf("error fetching esc10b edges in integration test; %v", err)
} else {
assert.Equal(t, 1, len(results))
edge := results[0]

if edgeComp, err := ad2.GetEdgeCompositionPath(context.Background(), db, edge); err != nil {
t.Fatalf("error getting edge composition for esc10b: %v", err)
} else {
nodes := edgeComp.AllNodes().Slice()
assert.Contains(t, nodes, harness.ESC10bHarnessECA.Group1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.Computer1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.Domain1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.NTAuthStore1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.RootCA1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.ComputerDC1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.EnterpriseCA1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.CertTemplate1)
}
}

return nil
})
})

testContext.DatabaseTestWithSetup(func(harness *integration.HarnessDetails) error {
Expand Down
1 change: 1 addition & 0 deletions packages/cue/bh/ad/ad.cue
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,5 @@ EdgeCompositionRelationships: [
ADCSESC9a,
ADCSESC9b,
ADCSESC10a,
ADCSESC10b,
]
Loading

0 comments on commit e563545

Please sign in to comment.