You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add `spec.Filter.Eval` to allow public evaluation of a single JSON
node. Used internally by `spec.FilterSelector.Select`.
* Add `spec.Segment.IsDescendant` to tell wether a segments selects
just from the current child node or also recursively selects from
all of its descendants.
* Make `spec.SliceSelector.Bounds` public.
* Make the underlying struct defining `spec.Wildcard` public with the
name `spec.WildcardSelector`.
Other changes:
* Add missing "?" to the stringification of `spec.FilterSelector`.
* Upgrade to `golangci-lint` v1.62 and disable `gosec` G602 false
positives (securego/gosec#1250)
funcSlice(args...any) SliceSelector {
const (
startArg=0endArg=1stepArg=2
)
// Set defaults.s:=SliceSelector{0, math.MaxInt, 1}
switchlen(args) -1 {
casestepArg:
//nolint:gosec // disable G602 https://github.com/securego/gosec/issues/1250switchstep:=args[stepArg].(type) {
caseint:
s.step=stepcasenil:
// Nothing to dodefault:
panic("Third value passed to NewSlice is not an integer")
}
fallthroughcaseendArg:
//nolint:gosec // disable G602 https://github.com/securego/gosec/issues/1250switchend:=args[endArg].(type) {
caseint:
s.end=endcasenil:
// Negative step: end with minimum int.ifs.step<0 {
s.end=math.MinInt
}
default:
panic("Second value passed to NewSlice is not an integer")
}
fallthroughcasestartArg:
switchstart:=args[startArg].(type) {
caseint:
s.start=startcasenil:
// Negative step: start with maximum int.ifs.step<0 {
s.start=math.MaxInt
}
default:
panic("First value passed to NewSlice is not an integer")
}
}
returns
}
Summary
I'm getting false positives for G602 when using a switch statement for bounds checking.
Steps to reproduce the behavior
Run gosec against this test case:
Output:
gosec version
Just installed 1fb6a46 from GitHub.
Go version (output of 'go version')
Operating system / Environment
macOS Sequoia
Expected behavior
No issues found.
Actual behavior
False positive for G602.
The text was updated successfully, but these errors were encountered: