diff --git a/pkg/scanners/azure/value.go b/pkg/scanners/azure/value.go index bd79be76a..5481870c5 100644 --- a/pkg/scanners/azure/value.go +++ b/pkg/scanners/azure/value.go @@ -225,7 +225,7 @@ func (v Value) AsInt() int { if v.Kind != KindNumber { return 0 } - return int(v.rLit.(float64)) + return int(v.rLit.(int64)) } func (v Value) AsFloat() float64 { diff --git a/pkg/scanners/azure/value_test.go b/pkg/scanners/azure/value_test.go new file mode 100644 index 000000000..7b4637227 --- /dev/null +++ b/pkg/scanners/azure/value_test.go @@ -0,0 +1,13 @@ +package azure + +import ( + "testing" + + "github.com/aquasecurity/defsec/pkg/types" + "github.com/stretchr/testify/assert" +) + +func Test_ValueAsInt(t *testing.T) { + val := NewValue(int64(10), types.NewTestMetadata()) + assert.Equal(t, 10, val.AsInt()) +}