From 3c1bfaddb3a503fde392349a2726ff9e9d66738a Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 14 Jan 2024 12:15:46 -0800 Subject: [PATCH] Fix a few minor types in variables/log messages (#3024) Minor spelling cleanup Signed-off-by: Tim Smith --- providers/aws/provider/provider.go | 2 +- .../azureinstancesnapshot/provider_test.go | 6 +++--- .../connection/azureinstancesnapshot/snapshot.go | 4 ++-- providers/azure/resources/compute.go | 2 +- providers/azure/resources/resourceid.go | 2 +- .../gcp/connection/gcpinstancesnapshot/snapshot.go | 2 +- providers/os/resources/vulnmgmt.go | 12 ++++++------ providers/terraform/provider/provider.go | 2 +- providers/vsphere/resources/vulnmgmt.go | 8 ++++---- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/providers/aws/provider/provider.go b/providers/aws/provider/provider.go index 284af0a057..4ffc664988 100644 --- a/providers/aws/provider/provider.go +++ b/providers/aws/provider/provider.go @@ -256,7 +256,7 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba func (s *Service) detect(asset *inventory.Asset, conn plugin.Connection) error { if len(asset.Connections) > 0 && asset.Connections[0].Type == "ssh" { - // workaround to make sure we dont assign the aws platform to ec2 instances + // workaround to make sure we don't assign the aws platform to ec2 instances return nil } if c, ok := conn.(*connection.AwsConnection); ok { diff --git a/providers/azure/connection/azureinstancesnapshot/provider_test.go b/providers/azure/connection/azureinstancesnapshot/provider_test.go index f4f11f3436..a3db6bb635 100644 --- a/providers/azure/connection/azureinstancesnapshot/provider_test.go +++ b/providers/azure/connection/azureinstancesnapshot/provider_test.go @@ -74,7 +74,7 @@ func TestParseTarget(t *testing.T) { assert.Equal(t, target, scanTarget.Target) assert.Equal(t, DiskTargetType, scanTarget.TargetType) }) - t.Run("parse snapshot target with a fully qualifed Azure resource id", func(t *testing.T) { + t.Run("parse snapshot target with a fully qualified Azure resource ID", func(t *testing.T) { scanner := &azureScannerInstance{ instanceInfo: instanceInfo{ resourceGroup: "my-rg", @@ -95,7 +95,7 @@ func TestParseTarget(t *testing.T) { assert.Equal(t, "test-snp", scanTarget.Target) assert.Equal(t, SnapshotTargetType, scanTarget.TargetType) }) - t.Run("parse instance target with a fully qualifed Azure resource id", func(t *testing.T) { + t.Run("parse instance target with a fully qualified Azure resource ID", func(t *testing.T) { scanner := &azureScannerInstance{ instanceInfo: instanceInfo{ resourceGroup: "my-rg", @@ -116,7 +116,7 @@ func TestParseTarget(t *testing.T) { assert.Equal(t, "debian", scanTarget.Target) assert.Equal(t, InstanceTargetType, scanTarget.TargetType) }) - t.Run("parse disk target with a fully qualifed Azure resource id", func(t *testing.T) { + t.Run("parse disk target with a fully qualified Azure resource ID", func(t *testing.T) { scanner := &azureScannerInstance{ instanceInfo: instanceInfo{ resourceGroup: "my-rg", diff --git a/providers/azure/connection/azureinstancesnapshot/snapshot.go b/providers/azure/connection/azureinstancesnapshot/snapshot.go index 79b2f5cda7..06148566b0 100644 --- a/providers/azure/connection/azureinstancesnapshot/snapshot.go +++ b/providers/azure/connection/azureinstancesnapshot/snapshot.go @@ -168,7 +168,7 @@ func (sc *snapshotCreator) createDisk(disk compute.Disk, resourceGroupName, disk } // createSnapshotDisk creates a new disk from a snapshot -func (sc *snapshotCreator) createSnapshotDisk(sourceSnaphotId, resourceGroupName, diskName, location string, zones []*string) (compute.Disk, error) { +func (sc *snapshotCreator) createSnapshotDisk(sourceSnapshotId, resourceGroupName, diskName, location string, zones []*string) (compute.Disk, error) { // create a new disk from snapshot createOpt := compute.DiskCreateOptionCopy disk := compute.Disk{ @@ -177,7 +177,7 @@ func (sc *snapshotCreator) createSnapshotDisk(sourceSnaphotId, resourceGroupName Name: &diskName, Properties: &compute.DiskProperties{ CreationData: &compute.CreationData{ - SourceResourceID: &sourceSnaphotId, + SourceResourceID: &sourceSnapshotId, CreateOption: &createOpt, }, }, diff --git a/providers/azure/resources/compute.go b/providers/azure/resources/compute.go index 8e6cc6fd1e..1ceb0dc1a5 100644 --- a/providers/azure/resources/compute.go +++ b/providers/azure/resources/compute.go @@ -81,7 +81,7 @@ func (a *mqlAzureSubscriptionComputeService) vms() ([]interface{}, error) { func (a *mqlAzureSubscriptionComputeServiceVm) extensions() ([]interface{}, error) { conn := a.MqlRuntime.Connection.(*connection.AzureConnection) - // id is a azure resource id + // id is a Azure resource ID id := a.Id.Data resourceID, err := ParseResourceID(id) if err != nil { diff --git a/providers/azure/resources/resourceid.go b/providers/azure/resources/resourceid.go index 1e73714f3f..cda1c9289c 100644 --- a/providers/azure/resources/resourceid.go +++ b/providers/azure/resources/resourceid.go @@ -26,7 +26,7 @@ func ParseResourceID(id string) (*ResourceID, error) { // sanitize resource id idURL, err := url.ParseRequestURI(id) if err != nil { - return nil, fmt.Errorf("cannot parse azure resource id: %s", err) + return nil, fmt.Errorf("cannot parse Azure resource ID: %s", err) } path := idURL.Path path = strings.TrimPrefix(path, "/") diff --git a/providers/gcp/connection/gcpinstancesnapshot/snapshot.go b/providers/gcp/connection/gcpinstancesnapshot/snapshot.go index bddd5bb5e0..06af95f2c5 100644 --- a/providers/gcp/connection/gcpinstancesnapshot/snapshot.go +++ b/providers/gcp/connection/gcpinstancesnapshot/snapshot.go @@ -243,7 +243,7 @@ func (sc *SnapshotCreator) cloneDisk(sourceDisk, projectID, zone, diskName strin return sc.createDisk(disk, projectID, zone, diskName) } -// attachDisk attaches a disk to an instanc +// attachDisk attaches a disk to an instance func (sc *SnapshotCreator) attachDisk(projectID, zone, instanceName, sourceDiskUrl, deviceName string) error { ctx := context.Background() diff --git a/providers/os/resources/vulnmgmt.go b/providers/os/resources/vulnmgmt.go index b684fd3b36..3dcb0e8445 100644 --- a/providers/os/resources/vulnmgmt.go +++ b/providers/os/resources/vulnmgmt.go @@ -103,7 +103,7 @@ func (v *mqlVulnmgmt) populateData() error { mqlVulAdvisories := make([]interface{}, len(vulnReport.Advisories)) for i, a := range vulnReport.Advisories { var parsedPublished *time.Time - var parsedModifed *time.Time + var parsedModified *time.Time var err error published, err := time.Parse(time.RFC3339, a.PublishedAt) if err != nil { @@ -115,7 +115,7 @@ func (v *mqlVulnmgmt) populateData() error { if err != nil { log.Debug().Str("date", a.ModifiedAt).Str("advisory", a.Id).Msg("could not parse modified date") } else { - parsedModifed = &modified + parsedModified = &modified } cvssScore, err := CreateResource(v.MqlRuntime, "audit.cvss", map[string]*llx.RawData{ "score": llx.FloatData(float64(a.CvssScore.Value) / 10), @@ -129,7 +129,7 @@ func (v *mqlVulnmgmt) populateData() error { "title": llx.StringData(a.Title), "description": llx.StringData(a.Description), "published": llx.TimeDataPtr(parsedPublished), - "modified": llx.TimeDataPtr(parsedModifed), + "modified": llx.TimeDataPtr(parsedModified), "worstScore": llx.ResourceData(cvssScore, "audit.cvss"), }) if err != nil { @@ -141,7 +141,7 @@ func (v *mqlVulnmgmt) populateData() error { mqlVulnCves := make([]interface{}, len(vulnReport.Cves)) for i, c := range vulnReport.Cves { var parsedPublished *time.Time - var parsedModifed *time.Time + var parsedModified *time.Time var err error published, err := time.Parse(time.RFC3339, c.PublishedAt) if err != nil { @@ -153,7 +153,7 @@ func (v *mqlVulnmgmt) populateData() error { if err != nil { log.Debug().Str("date", c.ModifiedAt).Str("cve", c.Id).Msg("could not parse modified date") } else { - parsedModifed = &modified + parsedModified = &modified } cvssScore, err := CreateResource(v.MqlRuntime, "audit.cvss", map[string]*llx.RawData{ "score": llx.FloatData(float64(c.CvssScore.Value) / 10), @@ -166,7 +166,7 @@ func (v *mqlVulnmgmt) populateData() error { "id": llx.StringData(c.Id), "worstScore": llx.ResourceData(cvssScore, "audit.cvss"), "published": llx.TimeDataPtr(parsedPublished), - "modified": llx.TimeDataPtr(parsedModifed), + "modified": llx.TimeDataPtr(parsedModified), }) if err != nil { return err diff --git a/providers/terraform/provider/provider.go b/providers/terraform/provider/provider.go index ed76913f64..62172d7ad9 100644 --- a/providers/terraform/provider/provider.go +++ b/providers/terraform/provider/provider.go @@ -54,7 +54,7 @@ func (s *Service) ParseCLI(req *plugin.ParseCLIReq) (*plugin.ParseCLIRes, error) } // TODO: somewhere here, parse the args for the previous sub-commands - // perhaps set the conn.Type here dependeing on the args (like in the os provider) + // perhaps set the conn.Type here depending on the args (like in the os provider) // and later on decide which thing to call based on the conn.Type // below in this file we already have something similar: // tc.Options["asset-type"] == "state" diff --git a/providers/vsphere/resources/vulnmgmt.go b/providers/vsphere/resources/vulnmgmt.go index 6c1de8cb10..883c5cd52c 100644 --- a/providers/vsphere/resources/vulnmgmt.go +++ b/providers/vsphere/resources/vulnmgmt.go @@ -94,7 +94,7 @@ func (v *mqlVulnmgmt) populateData() error { if err != nil { return err } - parsedModifed, err := time.Parse(time.RFC3339, a.ModifiedAt) + parsedModified, err := time.Parse(time.RFC3339, a.ModifiedAt) if err != nil { return err } @@ -110,7 +110,7 @@ func (v *mqlVulnmgmt) populateData() error { "title": llx.StringData(a.Title), "description": llx.StringData(a.Description), "published": llx.TimeData(parsedPublished), - "modified": llx.TimeData(parsedModifed), + "modified": llx.TimeData(parsedModified), "worstScore": llx.ResourceData(cvssScore, "audit.cvss"), }) if err != nil { @@ -125,7 +125,7 @@ func (v *mqlVulnmgmt) populateData() error { if err != nil { return err } - parsedModifed, err := time.Parse(time.RFC3339, c.ModifiedAt) + parsedModified, err := time.Parse(time.RFC3339, c.ModifiedAt) if err != nil { return err } @@ -140,7 +140,7 @@ func (v *mqlVulnmgmt) populateData() error { "id": llx.StringData(c.Id), "worstScore": llx.ResourceData(cvssScore, "audit.cvss"), "published": llx.TimeData(parsedPublished), - "modified": llx.TimeData(parsedModifed), + "modified": llx.TimeData(parsedModified), }) if err != nil { return err