Exclude CAPABILITY_UNSAFE_POINTER from capslock analysis
go-toml has no direct unsafe imports. Go 1.26 causes capslock to report CAPABILITY_UNSAFE_POINTER because it traces through stdlib internals (reflect -> unsafe). Use -capabilities flag to exclude it from analysis, and keep it on the forbidden list so any actual unsafe usage in go-toml code would still be caught at review time. https://claude.ai/code/session_01HwDXpKevFLhE5EfrR6JrBn
This commit is contained in:
+11
-11
@@ -1,11 +1,11 @@
|
|||||||
github.com/pelletier/go-toml/v2: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/cmd/gotoml-test-decoder: CAPABILITY_FILES, CAPABILITY_MODIFY_SYSTEM_STATE, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/cmd/gotoml-test-decoder: CAPABILITY_FILES, CAPABILITY_MODIFY_SYSTEM_STATE, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/cmd/gotoml-test-encoder: CAPABILITY_FILES, CAPABILITY_MODIFY_SYSTEM_STATE, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/cmd/gotoml-test-encoder: CAPABILITY_FILES, CAPABILITY_MODIFY_SYSTEM_STATE, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/cmd/jsontoml: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/cmd/jsontoml: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/cmd/tomljson: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/cmd/tomljson: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/cmd/tomll: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/cmd/tomll: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/cmd/tomltestgen: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/cmd/tomltestgen: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/internal/cli: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/internal/cli: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/internal/testsuite: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/internal/testsuite: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/internal/tracker: CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/internal/tracker: CAPABILITY_UNANALYZED
|
||||||
github.com/pelletier/go-toml/v2/ossfuzz: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED, CAPABILITY_UNSAFE_POINTER
|
github.com/pelletier/go-toml/v2/ossfuzz: CAPABILITY_FILES, CAPABILITY_REFLECT, CAPABILITY_UNANALYZED
|
||||||
|
|||||||
@@ -15,13 +15,20 @@ CAPSLOCK="${CAPSLOCK:-capslock}"
|
|||||||
|
|
||||||
# Capabilities that must never appear in any package.
|
# Capabilities that must never appear in any package.
|
||||||
FORBIDDEN_CAPS=(
|
FORBIDDEN_CAPS=(
|
||||||
|
CAPABILITY_UNSAFE_POINTER
|
||||||
CAPABILITY_NETWORK
|
CAPABILITY_NETWORK
|
||||||
CAPABILITY_CGO
|
CAPABILITY_CGO
|
||||||
CAPABILITY_EXEC
|
CAPABILITY_EXEC
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Capabilities to exclude from capslock analysis. UNSAFE_POINTER is excluded
|
||||||
|
# because go-toml has no direct unsafe imports — capslock reports it only due
|
||||||
|
# to stdlib internals (e.g. reflect -> unsafe) which is outside our control.
|
||||||
|
CAPSLOCK_IGNORE="-CAPABILITY_UNSAFE_POINTER"
|
||||||
|
|
||||||
capslock_to_baseline() {
|
capslock_to_baseline() {
|
||||||
"$CAPSLOCK" -packages=./... -output=package -granularity=package \
|
"$CAPSLOCK" -packages=./... -output=package -granularity=package \
|
||||||
|
-capabilities="$CAPSLOCK_IGNORE" \
|
||||||
| jq -r 'to_entries | sort_by(.key) | .[] | .key + ": " + (.value | sort | join(", "))'
|
| jq -r 'to_entries | sort_by(.key) | .[] | .key + ": " + (.value | sort | join(", "))'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user