Skip to content

Commit 085b7ea

Browse files
authored
docs(gosec): add configs for all existing rules (#2886)
docs: gosec: add configs for all existing rules
1 parent d704754 commit 085b7ea

File tree

1 file changed

+55
-4
lines changed

1 file changed

+55
-4
lines changed

.golangci.reference.yml

+55-4
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ linters-settings:
684684
gosec:
685685
# To select a subset of rules to run.
686686
# Available rules: https://github.com/securego/gosec#available-rules
687+
# Default: [] - means include all rules
687688
includes:
688689
- G101
689690
- G102
@@ -719,6 +720,7 @@ linters-settings:
719720

720721
# To specify a set of rules to explicitly exclude.
721722
# Available rules: https://github.com/securego/gosec#available-rules
723+
# Default: []
722724
excludes:
723725
- G101
724726
- G102
@@ -771,17 +773,66 @@ linters-settings:
771773
concurrency: 12
772774

773775
# To specify the configuration of rules.
774-
# The configuration of rules is not fully documented by gosec:
775-
# https://github.com/securego/gosec#configuration
776-
# https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102
777776
config:
778-
G306: "0600"
779777
G101:
778+
# Regexp pattern for variables and constants to find.
779+
# Default: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
780780
pattern: "(?i)example"
781+
# If true, complain about all cases (even with low entropy).
782+
# Default: false
781783
ignore_entropy: false
784+
# Maximum allowed entropy of the string.
785+
# Default: "80.0"
782786
entropy_threshold: "80.0"
787+
# Maximum allowed value of entropy/string length.
788+
# Is taken into account if entropy >= entropy_threshold/2.
789+
# Default: "3.0"
783790
per_char_threshold: "3.0"
791+
# Calculate entropy for first N chars of the string.
792+
# Default: "16"
784793
truncate: "32"
794+
# Additional functions to ignore while checking unhandled errors.
795+
# Following functions always ignored:
796+
# bytes.Buffer:
797+
# - Write
798+
# - WriteByte
799+
# - WriteRune
800+
# - WriteString
801+
# fmt:
802+
# - Print
803+
# - Printf
804+
# - Println
805+
# - Fprint
806+
# - Fprintf
807+
# - Fprintln
808+
# strings.Builder:
809+
# - Write
810+
# - WriteByte
811+
# - WriteRune
812+
# - WriteString
813+
# io.PipeWriter:
814+
# - CloseWithError
815+
# hash.Hash:
816+
# - Write
817+
# os:
818+
# - Unsetenv
819+
# Default: {}
820+
G104:
821+
fmt:
822+
- Fscanf
823+
G111:
824+
# Regexp pattern to find potential directory traversal.
825+
# Default: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)"
826+
pattern: "custom\\.Dir\\(\\)"
827+
# Maximum allowed permissions mode for os.Mkdir and os.MkdirAll
828+
# Default: "0750"
829+
G301: "0750"
830+
# Maximum allowed permissions mode for os.OpenFile and os.Chmod
831+
# Default: "0600"
832+
G302: "0600"
833+
# Maximum allowed permissions mode for os.WriteFile and ioutil.WriteFile
834+
# Default: "0600"
835+
G306: "0600"
785836

786837
govet:
787838
# Report about shadowed variables.

0 commit comments

Comments
 (0)