Skip to content

Commit

Permalink
Fix gosec errors
Browse files Browse the repository at this point in the history
* Use `int32` for ports (Gateway API ports use that type)
* Use `int32` for timeouts, desired instances (pod healtcheck timeout is
  `int32`)
* Use `int64` for limits (k8s resources limits are `int64`

Thus we do not have to cast ints all over the place and fix gosec issues

Co-authored-by: Yusmen Zabanov <yusmen.zabanov@sap.com>
  • Loading branch information
danail-branekov and uzabanov committed Sep 9, 2024
1 parent 9fb4745 commit 12e6c64
Show file tree
Hide file tree
Showing 41 changed files with 203 additions and 197 deletions.
22 changes: 11 additions & 11 deletions api/actions/manifest/applier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,22 @@ var _ = Describe("Applier", func() {
Command: tools.PtrTo("echo foo"),
DiskQuota: tools.PtrTo("512M"),
HealthCheckHTTPEndpoint: tools.PtrTo("foo/bar"),
HealthCheckInvocationTimeout: tools.PtrTo(int64(10)),
HealthCheckInvocationTimeout: tools.PtrTo(int32(10)),
HealthCheckType: tools.PtrTo("http"),
Instances: tools.PtrTo(2),
Instances: tools.PtrTo[int32](2),
Memory: tools.PtrTo("756M"),
Timeout: tools.PtrTo(int64(31)),
Timeout: tools.PtrTo(int32(31)),
},
{
Type: "ben",
Command: tools.PtrTo("echo bar"),
DiskQuota: tools.PtrTo("256M"),
HealthCheckHTTPEndpoint: tools.PtrTo("bar/foo"),
HealthCheckInvocationTimeout: tools.PtrTo(int64(20)),
HealthCheckInvocationTimeout: tools.PtrTo(int32(20)),
HealthCheckType: tools.PtrTo("port"),
Instances: tools.PtrTo(3),
Instances: tools.PtrTo[int32](3),
Memory: tools.PtrTo("1024M"),
Timeout: tools.PtrTo(int64(45)),
Timeout: tools.PtrTo(int32(45)),
},
}
})
Expand All @@ -188,7 +188,7 @@ var _ = Describe("Applier", func() {
Expect(createMsg.Command).To(Equal("echo foo"))
Expect(createMsg.DiskQuotaMB).To(BeEquivalentTo(512))
Expect(createMsg.MemoryMB).To(BeEquivalentTo(756))
Expect(createMsg.DesiredInstances).To(PointTo(Equal(2)))
Expect(createMsg.DesiredInstances).To(PointTo(BeEquivalentTo(2)))
Expect(createMsg.HealthCheck).To(Equal(repositories.HealthCheck{
Type: "http",
Data: repositories.HealthCheckData{
Expand All @@ -205,7 +205,7 @@ var _ = Describe("Applier", func() {
Expect(createMsg.Command).To(Equal("echo bar"))
Expect(createMsg.DiskQuotaMB).To(BeEquivalentTo(256))
Expect(createMsg.MemoryMB).To(BeEquivalentTo(1024))
Expect(createMsg.DesiredInstances).To(PointTo(Equal(3)))
Expect(createMsg.DesiredInstances).To(PointTo(BeEquivalentTo(3)))
Expect(createMsg.HealthCheck).To(Equal(repositories.HealthCheck{
Type: "port",
Data: repositories.HealthCheckData{
Expand Down Expand Up @@ -244,11 +244,11 @@ var _ = Describe("Applier", func() {
Expect(patchMsg.Command).To(Equal(tools.PtrTo("echo bar")))
Expect(patchMsg.DiskQuotaMB).To(Equal(tools.PtrTo(int64(256))))
Expect(patchMsg.MemoryMB).To(Equal(tools.PtrTo(int64(1024))))
Expect(patchMsg.DesiredInstances).To(Equal(tools.PtrTo(3)))
Expect(patchMsg.DesiredInstances).To(PointTo(BeEquivalentTo(3)))
Expect(patchMsg.HealthCheckType).To(Equal(tools.PtrTo("port")))
Expect(patchMsg.HealthCheckHTTPEndpoint).To(Equal(tools.PtrTo("bar/foo")))
Expect(patchMsg.HealthCheckInvocationTimeoutSeconds).To(Equal(tools.PtrTo(int64(20))))
Expect(patchMsg.HealthCheckTimeoutSeconds).To(Equal(tools.PtrTo(int64(45))))
Expect(patchMsg.HealthCheckInvocationTimeoutSeconds).To(Equal(tools.PtrTo(int32(20))))
Expect(patchMsg.HealthCheckTimeoutSeconds).To(Equal(tools.PtrTo(int32(45))))
})

When("patching the process fails", func() {
Expand Down
72 changes: 36 additions & 36 deletions api/actions/manifest/normalizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ type prcParams struct {
Command *string
Memory *string
DiskQuota *string
Instances *int
Instances *int32
HealthCheckHTTPEndpoint *string
HealthCheckInvocationTimeout *int64
HealthCheckInvocationTimeout *int32
HealthCheckType *string
Timeout *int64
Timeout *int32
}

type (
Expand Down Expand Up @@ -206,57 +206,57 @@ var _ = Describe("Normalizer", func() {
appParams{DiskQuota: tools.PtrTo("2G")}, prcParams{},
expParams{DiskQuota: tools.PtrTo("2G")}),
Entry("app-level instances only",
appParams{Instances: tools.PtrTo(3)}, prcParams{},
expParams{Instances: tools.PtrTo(3)}),
appParams{Instances: tools.PtrTo[int32](3)}, prcParams{},
expParams{Instances: tools.PtrTo[int32](3)}),
Entry("app-level healthcheck endpoint only",
appParams{HealthCheckHTTPEndpoint: tools.PtrTo("/health")}, prcParams{},
expParams{HealthCheckHTTPEndpoint: tools.PtrTo("/health")}),
Entry("app-level healthcheck type only",
appParams{HealthCheckType: tools.PtrTo("typo")}, prcParams{},
expParams{HealthCheckType: tools.PtrTo("typo")}),
Entry("app-level healthcheck invocation timeout only",
appParams{HealthCheckInvocationTimeout: tools.PtrTo(int64(64))}, prcParams{},
expParams{HealthCheckInvocationTimeout: tools.PtrTo(int64(64))}),
appParams{HealthCheckInvocationTimeout: tools.PtrTo(int32(64))}, prcParams{},
expParams{HealthCheckInvocationTimeout: tools.PtrTo(int32(64))}),
Entry("app-level timeout only",
appParams{Timeout: tools.PtrTo(int64(12))}, prcParams{},
expParams{Timeout: tools.PtrTo(int64(12))}),
appParams{Timeout: tools.PtrTo(int32(12))}, prcParams{},
expParams{Timeout: tools.PtrTo(int32(12))}),
Entry("a combination of fields",
appParams{Memory: tools.PtrTo("512M"), DiskQuota: tools.PtrTo("2G")}, prcParams{},
expParams{Memory: tools.PtrTo("512M"), DiskQuota: tools.PtrTo("2G")}),

// with an explicit web process in the manifest, but without the app-level value set
Entry("empty proc with app memory",
appParams{Memory: tools.PtrTo("512M")},
prcParams{Instances: tools.PtrTo(3)},
expParams{Memory: tools.PtrTo("512M"), Instances: tools.PtrTo(3)}),
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{Memory: tools.PtrTo("512M"), Instances: tools.PtrTo[int32](3)}),
Entry("empty proc with disk quota",
appParams{DiskQuota: tools.PtrTo("2G")},
prcParams{Instances: tools.PtrTo(3)},
expParams{DiskQuota: tools.PtrTo("2G"), Instances: tools.PtrTo(3)}),
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{DiskQuota: tools.PtrTo("2G"), Instances: tools.PtrTo[int32](3)}),
Entry("empty proc with instances",
appParams{Instances: tools.PtrTo(3)},
appParams{Instances: tools.PtrTo[int32](3)},
prcParams{Memory: tools.PtrTo("512M")},
expParams{Instances: tools.PtrTo(3), Memory: tools.PtrTo("512M")}),
expParams{Instances: tools.PtrTo[int32](3), Memory: tools.PtrTo("512M")}),
Entry("empty proc with command",
appParams{Command: tools.PtrTo("echo foo")},
prcParams{Instances: tools.PtrTo(3)},
expParams{Command: tools.PtrTo("echo foo"), Instances: tools.PtrTo(3)}),
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{Command: tools.PtrTo("echo foo"), Instances: tools.PtrTo[int32](3)}),
Entry("empty proc with healthcheck endpoint",
appParams{HealthCheckHTTPEndpoint: tools.PtrTo("/health")},
prcParams{Instances: tools.PtrTo(3)},
expParams{HealthCheckHTTPEndpoint: tools.PtrTo("/health"), Instances: tools.PtrTo(3)}),
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{HealthCheckHTTPEndpoint: tools.PtrTo("/health"), Instances: tools.PtrTo[int32](3)}),
Entry("empty proc with healthcheck type",
appParams{HealthCheckType: tools.PtrTo("type1")},
prcParams{Instances: tools.PtrTo(3)},
expParams{HealthCheckType: tools.PtrTo("type1"), Instances: tools.PtrTo(3)}),
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{HealthCheckType: tools.PtrTo("type1"), Instances: tools.PtrTo[int32](3)}),
Entry("empty proc with healthcheck invocation timeout",
appParams{HealthCheckInvocationTimeout: tools.PtrTo(int64(45))},
prcParams{Instances: tools.PtrTo(3)},
expParams{HealthCheckInvocationTimeout: tools.PtrTo(int64(45)), Instances: tools.PtrTo(3)}),
appParams{HealthCheckInvocationTimeout: tools.PtrTo(int32(45))},
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{HealthCheckInvocationTimeout: tools.PtrTo(int32(45)), Instances: tools.PtrTo[int32](3)}),
Entry("empty proc with timeout",
appParams{Timeout: tools.PtrTo(int64(32))},
prcParams{Instances: tools.PtrTo(3)},
expParams{Timeout: tools.PtrTo(int64(32)), Instances: tools.PtrTo(3)}),
appParams{Timeout: tools.PtrTo(int32(32))},
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{Timeout: tools.PtrTo(int32(32)), Instances: tools.PtrTo[int32](3)}),

// with an existing web process with the given value set
Entry("value from proc memory used",
Expand All @@ -268,9 +268,9 @@ var _ = Describe("Normalizer", func() {
prcParams{DiskQuota: tools.PtrTo("3G")},
expParams{DiskQuota: tools.PtrTo("3G")}),
Entry("value from proc instances used",
appParams{Instances: tools.PtrTo(2)},
prcParams{Instances: tools.PtrTo(3)},
expParams{Instances: tools.PtrTo(3)}),
appParams{Instances: tools.PtrTo[int32](2)},
prcParams{Instances: tools.PtrTo[int32](3)},
expParams{Instances: tools.PtrTo[int32](3)}),
Entry("value from proc command used",
appParams{Command: tools.PtrTo("echo bar")},
prcParams{Command: tools.PtrTo("echo foo")},
Expand All @@ -284,13 +284,13 @@ var _ = Describe("Normalizer", func() {
prcParams{HealthCheckType: tools.PtrTo("proctype")},
expParams{HealthCheckType: tools.PtrTo("proctype")}),
Entry("value from proc healthcheck invocation timeout used",
appParams{HealthCheckInvocationTimeout: tools.PtrTo(int64(345))},
prcParams{HealthCheckInvocationTimeout: tools.PtrTo(int64(34))},
expParams{HealthCheckInvocationTimeout: tools.PtrTo(int64(34))}),
appParams{HealthCheckInvocationTimeout: tools.PtrTo(int32(345))},
prcParams{HealthCheckInvocationTimeout: tools.PtrTo(int32(34))},
expParams{HealthCheckInvocationTimeout: tools.PtrTo(int32(34))}),
Entry("value from proc timeout used",
appParams{Timeout: tools.PtrTo(int64(25))},
prcParams{Timeout: tools.PtrTo(int64(2))},
expParams{Timeout: tools.PtrTo(int64(2))}),
appParams{Timeout: tools.PtrTo(int32(25))},
prcParams{Timeout: tools.PtrTo(int32(2))},
expParams{Timeout: tools.PtrTo(int32(2))}),
)
})

Expand Down
2 changes: 1 addition & 1 deletion api/handlers/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ func (h *App) restartInstance(r *http.Request) (*routing.Response, error) {
"InstanceID", instanceID,
)
}
if process.DesiredInstances <= instance {
if int(process.DesiredInstances) <= instance {
return nil, apierrors.LogAndReturn(logger,
apierrors.NewNotFoundError(nil, fmt.Sprintf("Instance %d of process %s", instance, processType)), "Instance not found", "AppGUID", appGUID, "InstanceID", instanceID, "Process", process)
}
Expand Down
4 changes: 2 additions & 2 deletions api/handlers/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ var _ = Describe("App", func() {
}, nil)

payload = &payloads.ProcessScale{
Instances: tools.PtrTo(5),
Instances: tools.PtrTo[int32](5),
MemoryMB: tools.PtrTo[int64](256),
DiskMB: tools.PtrTo[int64](1024),
}
Expand Down Expand Up @@ -1116,7 +1116,7 @@ var _ = Describe("App", func() {
GUID: "process-1-guid",
SpaceGUID: spaceGUID,
ProcessScaleValues: repositories.ProcessScaleValues{
Instances: tools.PtrTo(5),
Instances: tools.PtrTo[int32](5),
MemoryMB: tools.PtrTo[int64](256),
DiskMB: tools.PtrTo[int64](1024),
},
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (h *Process) restartProcessInstance(r *http.Request) (*routing.Response, er
"InstanceID", instanceID,
)
}
if process.DesiredInstances <= instance {
if int(process.DesiredInstances) <= instance {
return nil, apierrors.LogAndReturn(logger,
apierrors.NewNotFoundError(nil, fmt.Sprintf("Instance %d of process %s", instance, process.Type)), "Instance not found", "AppGUID", process.AppGUID, "InstanceID", instanceID, "Process", process.Type)
}
Expand Down
12 changes: 6 additions & 6 deletions api/handlers/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ var _ = Describe("Process", func() {
}, nil)

requestValidator.DecodeAndValidateJSONPayloadStub = decodeAndValidatePayloadStub(&payloads.ProcessScale{
Instances: tools.PtrTo(3),
Instances: tools.PtrTo[int32](3),
MemoryMB: tools.PtrTo[int64](512),
DiskMB: tools.PtrTo[int64](256),
})
Expand Down Expand Up @@ -177,7 +177,7 @@ var _ = Describe("Process", func() {
GUID: "process-guid",
SpaceGUID: spaceGUID,
ProcessScaleValues: repositories.ProcessScaleValues{
Instances: tools.PtrTo(3),
Instances: tools.PtrTo[int32](3),
MemoryMB: tools.PtrTo(int64(512)),
DiskMB: tools.PtrTo(int64(256)),
},
Expand Down Expand Up @@ -380,9 +380,9 @@ var _ = Describe("Process", func() {
HealthCheck: &payloads.HealthCheck{
Type: tools.PtrTo("port"),
Data: &payloads.Data{
Timeout: tools.PtrTo[int64](5),
Timeout: tools.PtrTo[int32](5),
Endpoint: tools.PtrTo("http://myapp.com/health"),
InvocationTimeout: tools.PtrTo[int64](2),
InvocationTimeout: tools.PtrTo[int32](2),
},
},
})
Expand All @@ -403,8 +403,8 @@ var _ = Describe("Process", func() {
_, actualAuthInfo, actualMsg := processRepo.PatchProcessArgsForCall(0)
Expect(actualAuthInfo).To(Equal(authInfo))
Expect(actualMsg.ProcessGUID).To(Equal("process-guid"))
Expect(actualMsg.HealthCheckInvocationTimeoutSeconds).To(Equal(tools.PtrTo(int64(2))))
Expect(actualMsg.HealthCheckTimeoutSeconds).To(Equal(tools.PtrTo(int64(5))))
Expect(actualMsg.HealthCheckInvocationTimeoutSeconds).To(Equal(tools.PtrTo(int32(2))))
Expect(actualMsg.HealthCheckTimeoutSeconds).To(Equal(tools.PtrTo(int32(5))))
Expect(actualMsg.HealthCheckHTTPEndpoint).To(Equal(tools.PtrTo("http://myapp.com/health")))
Expect(actualMsg.HealthCheckType).To(Equal(tools.PtrTo("port")))
Expect(actualMsg.MetadataPatch.Labels).To(Equal(map[string]*string{"foo": tools.PtrTo("value1")}))
Expand Down
4 changes: 2 additions & 2 deletions api/handlers/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ var _ = Describe("Route", func() {
Type: "queue",
},
},
Port: tools.PtrTo(1234),
Port: tools.PtrTo[int32](1234),
Protocol: tools.PtrTo("http1"),
},
},
Expand Down Expand Up @@ -612,7 +612,7 @@ var _ = Describe("Route", func() {
MatchFields(IgnoreExtras, Fields{
"AppGUID": Equal("app-2-guid"),
"ProcessType": Equal("queue"),
"Port": PointTo(Equal(1234)),
"Port": PointTo(BeEquivalentTo(1234)),
"Protocol": PointTo(Equal("http1")),
}),
))
Expand Down
12 changes: 6 additions & 6 deletions api/handlers/space_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ var _ = Describe("SpaceManifest", func() {
Command: tools.PtrTo("start-web.sh"),
DiskQuota: tools.PtrTo("512M"),
HealthCheckHTTPEndpoint: tools.PtrTo("/healthcheck"),
HealthCheckInvocationTimeout: tools.PtrTo[int64](5),
HealthCheckInvocationTimeout: tools.PtrTo[int32](5),
HealthCheckType: tools.PtrTo("http"),
Instances: tools.PtrTo(1),
Instances: tools.PtrTo[int32](1),
Memory: tools.PtrTo("256M"),
Timeout: tools.PtrTo[int64](10),
Timeout: tools.PtrTo[int32](10),
}},
}},
})
Expand Down Expand Up @@ -99,11 +99,11 @@ var _ = Describe("SpaceManifest", func() {
Expect(payload.Applications[0].Processes[0].Command).To(PointTo(Equal("start-web.sh")))
Expect(payload.Applications[0].Processes[0].DiskQuota).To(PointTo(Equal("512M")))
Expect(payload.Applications[0].Processes[0].HealthCheckHTTPEndpoint).To(PointTo(Equal("/healthcheck")))
Expect(payload.Applications[0].Processes[0].HealthCheckInvocationTimeout).To(PointTo(Equal(int64(5))))
Expect(payload.Applications[0].Processes[0].HealthCheckInvocationTimeout).To(PointTo(Equal(int32(5))))
Expect(payload.Applications[0].Processes[0].HealthCheckType).To(PointTo(Equal("http")))
Expect(payload.Applications[0].Processes[0].Instances).To(PointTo(Equal(1)))
Expect(payload.Applications[0].Processes[0].Instances).To(PointTo(BeEquivalentTo(1)))
Expect(payload.Applications[0].Processes[0].Memory).To(PointTo(Equal("256M")))
Expect(payload.Applications[0].Processes[0].Timeout).To(PointTo(Equal(int64(10))))
Expect(payload.Applications[0].Processes[0].Timeout).To(PointTo(Equal(int32(10))))
})

When("the manifest is invalid", func() {
Expand Down
34 changes: 16 additions & 18 deletions api/payloads/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ManifestApplication struct {
RandomRoute bool `yaml:"random-route"`
NoRoute bool `yaml:"no-route"`
Command *string `yaml:"command"`
Instances *int `json:"instances" yaml:"instances"`
Instances *int32 `json:"instances" yaml:"instances"`
Memory *string `json:"memory" yaml:"memory"`
DiskQuota *string `json:"disk_quota" yaml:"disk_quota"`
// AltDiskQuota supports `disk-quota` with a hyphen for backwards compatibility.
Expand All @@ -35,9 +35,9 @@ type ManifestApplication struct {
// Deprecated: Use DiskQuota instead
AltDiskQuota *string `json:"disk-quota" yaml:"disk-quota"`
HealthCheckHTTPEndpoint *string `yaml:"health-check-http-endpoint"`
HealthCheckInvocationTimeout *int64 `json:"health-check-invocation-timeout" yaml:"health-check-invocation-timeout"`
HealthCheckInvocationTimeout *int32 `json:"health-check-invocation-timeout" yaml:"health-check-invocation-timeout"`
HealthCheckType *string `json:"health-check-type" yaml:"health-check-type"`
Timeout *int64 `json:"timeout" yaml:"timeout"`
Timeout *int32 `json:"timeout" yaml:"timeout"`
Processes []ManifestApplicationProcess `json:"processes" yaml:"processes"`
Routes []ManifestRoute `json:"routes" yaml:"routes"`
Buildpacks []string `yaml:"buildpacks"`
Expand All @@ -60,11 +60,11 @@ type ManifestApplicationProcess struct {
// Deprecated: Use DiskQuota instead
AltDiskQuota *string `json:"disk-quota" yaml:"disk-quota"`
HealthCheckHTTPEndpoint *string `yaml:"health-check-http-endpoint"`
HealthCheckInvocationTimeout *int64 `json:"health-check-invocation-timeout" yaml:"health-check-invocation-timeout"`
HealthCheckInvocationTimeout *int32 `json:"health-check-invocation-timeout" yaml:"health-check-invocation-timeout"`
HealthCheckType *string `json:"health-check-type" yaml:"health-check-type"`
Instances *int `json:"instances" yaml:"instances"`
Instances *int32 `json:"instances" yaml:"instances"`
Memory *string `json:"memory" yaml:"memory"`
Timeout *int64 `json:"timeout" yaml:"timeout"`
Timeout *int32 `json:"timeout" yaml:"timeout"`
}

type ManifestApplicationService struct {
Expand Down Expand Up @@ -172,15 +172,11 @@ func (p ManifestApplicationProcess) ToProcessCreateMessage(appGUID, spaceGUID st
msg.DesiredInstances = p.Instances

if p.Memory != nil {
// error ignored intentionally, since the manifest yaml is validated in handlers
memoryQuotaMB, _ := bytefmt.ToMegabytes(*p.Memory)
msg.MemoryMB = int64(memoryQuotaMB)
msg.MemoryMB = parseMegabytes(*p.Memory)
}

if p.DiskQuota != nil {
// error ignored intentionally, since the manifest yaml is validated in handlers
diskQuotaMB, _ := bytefmt.ToMegabytes(*p.DiskQuota)
msg.DiskQuotaMB = int64(diskQuotaMB)
msg.DiskQuotaMB = parseMegabytes(*p.DiskQuota)
}

return msg
Expand All @@ -203,14 +199,10 @@ func (p ManifestApplicationProcess) ToProcessPatchMessage(processGUID, spaceGUID
}
}
if p.DiskQuota != nil {
diskQuotaMB, _ := bytefmt.ToMegabytes(*p.DiskQuota)
int64DQMB := int64(diskQuotaMB)
message.DiskQuotaMB = &int64DQMB
message.DiskQuotaMB = tools.PtrTo(parseMegabytes(*p.DiskQuota))
}
if p.Memory != nil {
memoryMB, _ := bytefmt.ToMegabytes(*p.Memory)
int64MMB := int64(memoryMB)
message.MemoryMB = &int64MMB
message.MemoryMB = tools.PtrTo(parseMegabytes(*p.Memory))
}
return message
}
Expand Down Expand Up @@ -287,3 +279,9 @@ func validateAmountWithUnit(value any) error {

return nil
}

func parseMegabytes(s string) int64 {
// error intentinally ignored as the manifesst is validated beforehand
mb, _ := bytefmt.ToMegabytes(s)
return int64(mb) // #nosec G115
}
Loading

0 comments on commit 12e6c64

Please sign in to comment.