fix: handle nil NSG in VMSS NIC parseNetworkInterfaceConfig#6795
Open
mateenali66 wants to merge 1 commit intospiffe:mainfrom
Open
fix: handle nil NSG in VMSS NIC parseNetworkInterfaceConfig#6795mateenali66 wants to merge 1 commit intospiffe:mainfrom
mateenali66 wants to merge 1 commit intospiffe:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request check list
Affected functionality
Azure IMDS node attestation for VMSS instances.
Description of change
VMSS NICs don't always have a Network Security Group attached.
parseNetworkInterfaceConfigwas dereferencingNetworkSecurityGroup.IDunconditionally, causing a plugin panic when attesting VMSS nodes with no NSG on their NIC.added nil checks for
Properties,NetworkSecurityGroup, andNetworkSecurityGroup.ID. if there's no NSG theSecurityGroupfield is left as zero-value. also guardipconfig.PropertiesandSubnetagainst 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