Evaluate all applied posture checks on source peers only

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga 2024-12-27 23:28:34 +03:00
parent 076d6d8a87
commit feb8e90ae1
No known key found for this signature in database
GPG Key ID: 511EED5C928AD547

View File

@ -1319,15 +1319,16 @@ func (a *Account) GetNetworkResourcesRoutesToSync(ctx context.Context, peerID st
} }
} }
var peerPostureChecks []string if !addSourcePeers {
for _, policy := range resourcePolicies[resource.ID] { var peerPostureChecks []string
peerPostureChecks = append(peerPostureChecks, policy.SourcePostureChecks...) for _, policy := range resourcePolicies[resource.ID] {
} peerPostureChecks = append(peerPostureChecks, policy.SourcePostureChecks...)
}
// validate the peer based on policy posture checks applied isValid := a.validatePostureChecksOnPeer(ctx, peerPostureChecks, peerID)
isValid := a.validatePostureChecksOnPeer(ctx, peerPostureChecks, peerID) if !isValid {
if !isValid { continue
continue }
} }
for _, policy := range resourcePolicies[resource.ID] { for _, policy := range resourcePolicies[resource.ID] {