Skip to content

Conversation

@ssherar
Copy link
Contributor

@ssherar ssherar commented Jul 11, 2025

No description provided.

ssherar added 3 commits July 11, 2025 10:27
Remove the findings structure to follow the 0.2.0 SDK structure, with
gathering of inventory items alongside

No NIC information gathered at the moment wuth the new structure of
gathering data in a cleaner format and letting rego make decisions
across the whole data structure instead of making decisions in the
plugin code
@ssherar ssherar requested a review from Copilot July 11, 2025 14:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Azure VM plugin to use SDK version 0.2.0, refactors the main evaluation logic into reusable iterators, and enhances documentation.

  • Refactored Eval to use GetVMs and GetNetworkConfig iterator functions
  • Introduced GetVMs and GetNetworkConfig for streaming VM and network data
  • Bumped dependencies in go.mod and updated configuration instructions in README.md

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
main.go Refactored core logic to use Azure SDK v0.2.0, split VM and NIC collection into separate methods
go.mod Updated plugin and configuration-service SDK versions and indirect dependencies
README.md Added configuration table, build instructions, and data-structure reference
Comments suppressed due to low confidence (6)

main.go:154

  • The variable name compoents is misspelled and differs in type from the earlier components declaration. Rename it to components and ensure the correct type ([]*proto.ComponentReference).
		compoents := []*proto.Component{

main.go:234

  • Exported method GetVMs lacks a doc comment. Add a comment explaining its purpose, parameters, and return type.
func (l *CompliancePlugin) GetVMs(ctx context.Context, client *armcompute.VirtualMachinesClient) iter.Seq2[*AzureVMInstance, error] {

main.go:272

  • New method GetNetworkConfig contains significant logic for parsing and API calls. Consider adding unit tests to cover success and error paths.
func (l *CompliancePlugin) GetNetworkConfig(ctx context.Context, networkProfile *armcompute.NetworkProfile) ([]*AzureVMNetworkInterface, error) {

main.go:3

  • The unqualified import of "iter" will not compile; please use the correct module path or alias (e.g., "github.com/yourorg/iter").
import (

main.go:3

  • [nitpick] Using the standard library "slices" package requires Go 1.21+. Confirm your module's Go version or consider using "golang.org/x/exp/slices" for earlier Go versions.
import (

main.go:115

  • You cannot range over a function call. Refactor to properly invoke the iterator returned by GetVMs, for example by calling it in a loop that accepts a yield callback or channel.
	for vm, err := range l.GetVMs(ctx, vmClient) {

* Change slices.Concat to append(...)
* Add more labels from the VM for better searching
* Spelling mistake in the actors description
main.go Outdated
inventory := []*proto.InventoryItem{
{
Identifier: "azure-vm/" + vm.ID(),
Type: "virtual-machine",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Type: "virtual-machine",
Type: "web-server",

virtual machine is not in the list of accepted OSCAL types (yet).

@ssherar ssherar merged commit 3739996 into main Jul 15, 2025
1 check passed
@ssherar ssherar deleted the feature/evidence branch July 15, 2025 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants