Skip to content

fix: handle nil NSG in VMSS NIC parseNetworkInterfaceConfig#6795

Open
mateenali66 wants to merge 1 commit intospiffe:mainfrom
mateenali66:fix/azure-imds-nil-nsg-panic
Open

fix: handle nil NSG in VMSS NIC parseNetworkInterfaceConfig#6795
mateenali66 wants to merge 1 commit intospiffe:mainfrom
mateenali66:fix/azure-imds-nil-nsg-panic

Conversation

@mateenali66
Copy link
Copy Markdown

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality

Azure IMDS node attestation for VMSS instances.

Description of change

VMSS NICs don't always have a Network Security Group attached. parseNetworkInterfaceConfig was dereferencing NetworkSecurityGroup.ID unconditionally, causing a plugin panic when attesting VMSS nodes with no NSG on their NIC.

added nil checks for Properties, NetworkSecurityGroup, and NetworkSecurityGroup.ID. if there's no NSG the SecurityGroup field is left as zero-value. also guard ipconfig.Properties and Subnet against nil in the IP config loop.

added a test case for the no-NSG path in utils_test.go.

Which issue this PR fixes

fixes #6630

VMSS network interface configurations don't always have a Network
Security Group attached. parseNetworkInterfaceConfig was dereferencing
NetworkSecurityGroup.ID without nil checks, causing a plugin panic
during attestation for VMSS nodes without an NSG.

added nil checks for Properties, NetworkSecurityGroup, and
NetworkSecurityGroup.ID. if NSG is absent the SecurityGroup field
is left as zero-value. also guard ipconfig.Properties and Subnet
against nil in the IP config loop.

Fixes spiffe#6630

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
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.

Node attestor azure_imds runtime error / plugin panic

2 participants