fix(dir): skip opening file&dir if allowlist matches (#1653) · gitleaks/gitleaks@ed205a5 (original) (raw)

`@@ -64,7 +64,7 @@ func CreateGlobalConfig() config.Config {

`

64

64

`// ----------- Golang files -----------

`

65

65

`` regexp.MustCompile(go\.(mod|sum|work(\.sum)?)$),

``

66

66

`` regexp.MustCompile((^|/)vendor/modules\.txt$),

``

67

``

`` -

regexp.MustCompile((^|/)vendor/(github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)/.*$),

``

``

67

`` +

regexp.MustCompile((^|/)vendor/(github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(/.*)?$),

``

68

68

``

69

69

`// ----------- Java files -----------

`

70

70

`// Gradle

`

`@@ -75,30 +75,27 @@ func CreateGlobalConfig() config.Config {

`

75

75

``

76

76

`// ----------- JavaScript files -----------

`

77

77

`// Dependencies and lock files.

`

78

``

`` -

regexp.MustCompile((^|/)node_modules/.*?$),

``

79

``

`` -

regexp.MustCompile((^|/)package-lock\.json$),

``

80

``

`` -

regexp.MustCompile((^|/)yarn\.lock$),

``

81

``

`` -

regexp.MustCompile((^|/)pnpm-lock\.yaml$),

``

82

``

`` -

regexp.MustCompile((^|/)npm-shrinkwrap\.json$),

``

83

``

`` -

regexp.MustCompile((^|/)bower_components/.*?$),

``

``

78

`` +

regexp.MustCompile((^|/)node_modules(/.*)?$),

``

``

79

`` +

regexp.MustCompile((^|/)(npm-shrinkwrap\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$),

``

``

80

`` +

regexp.MustCompile((^|/)bower_components(/.*)?$),

``

84

81

`// TODO: Add more common static assets, such as swagger-ui.

`

85

82

`` regexp.MustCompile((^|/)(angular|jquery(-?ui)?|plotly|swagger-?ui)[a-zA-Z0-9.-]*(\.min)?\.js(\.map)?$),

``

86

83

``

87

84

`// ----------- Python files -----------

`

88

85

`// Dependencies and lock files.

`

89

86

`` regexp.MustCompile((^|/)(Pipfile|poetry)\.lock$),

``

90

87

`// Virtual environments

`

91

``

`` -

regexp.MustCompile((?i)/?(v?env|virtualenv)/lib(64)?/.+$),

``

92

``

`` -

regexp.MustCompile((?i)(^|/)(lib(64)?/python[23](\.\d{1,2})+/|python/[23](\.\d{1,2})+/lib(64)?/).+$),

``

``

88

`` +

regexp.MustCompile((?i)/?(v?env|virtualenv)/lib(64)?(/.*)?$),

``

``

89

`` +

regexp.MustCompile((?i)(^|/)(lib(64)?/python[23](\.\d{1,2})+|python/[23](\.\d{1,2})+/lib(64)?)(/.*)?$),

``

93

90

`// dist-info directory (https://py-pkgs.org/04-package-structure.html#building-sdists-and-wheels)

`

94

``

`` -

regexp.MustCompile((?i)(^|/)[a-z0-9_.]+-[0-9.]+\.dist-info/.+$),

``

``

91

`` +

regexp.MustCompile((?i)(^|/)[a-z0-9_.]+-[0-9.]+\.dist-info(/.+)?$),

``

95

92

``

96

93

`// ----------- Ruby files -----------

`

97

``

`` -

regexp.MustCompile((^|/)vendor/(bundle|ruby)/.*?$),

``

``

94

`` +

regexp.MustCompile((^|/)vendor/(bundle|ruby)(/.*?)?$),

``

98

95

`` regexp.MustCompile(\.gem$), // tar archive

``

99

96

``

100

97

`// Misc

`

101

``

`` -

regexp.MustCompile(verification-metadata.xml),

``

``

98

`` +

regexp.MustCompile(verification-metadata\.xml),

``

102

99

`` regexp.MustCompile(Database.refactorlog),

``

103

100

`` //regexp.MustCompile(vendor),

``

104

101

` },

`