@codacy/tools-opengrep-1 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -119,6 +119,37 @@ curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/main/install.sh |
119
119
 
120
120
  ## Notes for maintainers
121
121
 
122
+ - **Preset mappings (`src/pattern-mappings.json`)**: prefixes are the upstream rule paths
123
+ (`Semgrep_<lang>.<framework>.…`), which already name the framework, so this mapping is
124
+ prefix-only — Opengrep's tags are topical (`security`, `audit`) and would over-match. 22 keys
125
+ were added, taking ~91 default-on patterns out of repos that lack the framework: Pyramid (16),
126
+ PyCryptodome (12), Kubernetes/Helm (14, via `yaml.kubernetes.` + `codacy.k8s.`; the `kubernetes` signal matches
127
+ loose manifests under `k8s/`/`kubernetes/`/`manifests/`, not just `kustomization.yaml`, or the
128
+ most common layout would have lost all 14), GitHub Actions
129
+ (5), AWS CDK (5), Jinja2 (2), and the smaller Boto3/Twilio/Android/Sequelize/Doctrine families.
130
+ The YAML-language families matter most: before this they fired in any repo containing a single
131
+ `.yaml` file.
132
+
133
+ The `*.aws-lambda.` packs (34 default-on across Python, JavaScript, Ruby and Go) are claimed
134
+ by **seven** keys — `serverless-framework`, `cloudformation`, `aws-cdk`, `boto3`, `aws-sdk`,
135
+ `aws-sdk-go` and `lang:Terraform`. Handler code carries no manifest of its own; the only
136
+ evidence is how it is deployed or which SDK it calls, and any one of the seven is enough.
137
+ Terraform earns a key because deploying a Lambda with `aws_lambda_function` leaves no other
138
+ trace, and the SDK telltales had to learn npm's v2 `aws-sdk`, Go's v1 `aws-sdk-go` and PyPI's
139
+ `botocore`/`aws-lambda-powertools` — Lambda runtimes preinstall boto3, so it is often absent
140
+ from `requirements.txt` entirely.
141
+
142
+ `Semgrep_python.jinja2.` is claimed by `jinja2` **and** `flask`: Flask hard-depends on Jinja2,
143
+ so gating on a direct `jinja2` declaration alone dropped both Error-severity autoescape rules
144
+ from most real Flask repos.
145
+
146
+ Deliberately still universal, guarded by a test so it stays that way:
147
+ `*.lang.*` (the generic per-language packs), `csharp.dotnet.` (the platform, not a library),
148
+ `terraform.*` (already gated by the `Terraform` language), `problem-based-packs.*`
149
+ (cross-language), and `apex.` / `generic.visualforce.` — Apex and VisualForce are
150
+ Salesforce-only _languages_, so the language gate already scopes them and keying them on
151
+ `salesforce` would only add a way to miss them in a Salesforce repo with no `sfdx-project.json`.
152
+
122
153
  - **Tool ID is `Semgrep`** for legacy compatibility with the Codacy platform. The `displayName` is set to `Opengrep` for CLI display. Never change the tool ID without coordinating with the Codacy platform team.
123
154
  - **Config materialization**: When Codacy patterns are specified, the adapter loads `src/rules.yaml`, filters to enabled rules, and writes a filtered config to `.codacy/generated/opengrep-rules.yaml`.
124
155
  - **check_id prefix stripping**: Opengrep prepends a path-based namespace to check_ids derived from the config file path relative to cwd. The adapter computes and strips this prefix (e.g. `codacy.generated.`) plus any `tmp.` legacy prefix.
package/dist/index.js CHANGED
@@ -29983,64 +29983,76 @@ var patterns_default = [
29983
29983
 
29984
29984
  // src/pattern-mappings.json
29985
29985
  var pattern_mappings_default = {
29986
- Django: {
29986
+ django: {
29987
29987
  prefixes: ["Semgrep_python.django."]
29988
29988
  },
29989
- Flask: {
29990
- prefixes: ["Semgrep_python.flask."]
29989
+ flask: {
29990
+ prefixes: ["Semgrep_python.flask.", "Semgrep_python.jinja2."]
29991
29991
  },
29992
- FastAPI: {
29992
+ fastapi: {
29993
29993
  prefixes: ["Semgrep_python.fastapi."]
29994
29994
  },
29995
- SQLAlchemy: {
29995
+ sqlalchemy: {
29996
29996
  prefixes: ["Semgrep_python.sqlalchemy."]
29997
29997
  },
29998
- Express: {
29998
+ express: {
29999
29999
  prefixes: ["Semgrep_javascript.express."]
30000
30000
  },
30001
- React: {
30001
+ react: {
30002
30002
  prefixes: ["Semgrep_javascript.react.", "Semgrep_typescript.react."]
30003
30003
  },
30004
- Angular: {
30004
+ angular: {
30005
30005
  prefixes: ["Semgrep_javascript.angular.", "Semgrep_typescript.angular."]
30006
30006
  },
30007
- "Vue.js": {
30007
+ vue: {
30008
30008
  prefixes: ["Semgrep_javascript.vue."]
30009
30009
  },
30010
- NestJS: {
30010
+ nestjs: {
30011
30011
  prefixes: ["Semgrep_typescript.nestjs."]
30012
30012
  },
30013
- jQuery: {
30013
+ jquery: {
30014
30014
  prefixes: ["Semgrep_javascript.jquery."]
30015
30015
  },
30016
- Playwright: {
30016
+ playwright: {
30017
30017
  prefixes: ["Semgrep_javascript.playwright."]
30018
30018
  },
30019
- "Ruby on Rails": {
30019
+ "ruby-on-rails": {
30020
30020
  prefixes: ["Semgrep_ruby.rails."]
30021
30021
  },
30022
- Spring: {
30022
+ "play-framework": {
30023
+ prefixes: ["Semgrep_scala.play.", "Semgrep_scala_ssrf_rule-Play"]
30024
+ },
30025
+ slick: {
30026
+ prefixes: ["Semgrep_scala.slick."]
30027
+ },
30028
+ "jwt-scala": {
30029
+ prefixes: ["Semgrep_scala.jwt-scala.", "Semgrep_scala.scala-jwt."]
30030
+ },
30031
+ "spring-boot": {
30023
30032
  prefixes: ["Semgrep_java.spring."]
30024
30033
  },
30025
- Laravel: {
30034
+ "spring-framework": {
30035
+ prefixes: ["Semgrep_java.spring."]
30036
+ },
30037
+ laravel: {
30026
30038
  prefixes: ["Semgrep_php.laravel."]
30027
30039
  },
30028
- WordPress: {
30040
+ wordpress: {
30029
30041
  prefixes: ["Semgrep_php.wordpress-plugins."]
30030
30042
  },
30031
- "Gorilla Mux": {
30043
+ "gorilla-mux": {
30032
30044
  prefixes: ["Semgrep_go.gorilla."]
30033
30045
  },
30034
- GORM: {
30046
+ "go-gorm": {
30035
30047
  prefixes: ["Semgrep_go.gorm."]
30036
30048
  },
30037
- gRPC: {
30049
+ grpc: {
30038
30050
  prefixes: ["Semgrep_go.grpc."]
30039
30051
  },
30040
- MongoDB: {
30052
+ mongodb: {
30041
30053
  prefixes: ["Semgrep_java.mongodb.", "Semgrep_python.pymongo."]
30042
30054
  },
30043
- Mongoose: {
30055
+ mongoose: {
30044
30056
  prefixes: ["Semgrep_python.pymongo."]
30045
30057
  },
30046
30058
  i18next: {
@@ -30052,7 +30064,7 @@ var pattern_mappings_default = {
30052
30064
  "Semgrep_codacy.python.i18n."
30053
30065
  ]
30054
30066
  },
30055
- "react-intl": {
30067
+ formatjs: {
30056
30068
  prefixes: [
30057
30069
  "Semgrep_codacy.cpp.i18n.",
30058
30070
  "Semgrep_codacy.java.i18n.",
@@ -30068,7 +30080,7 @@ var pattern_mappings_default = {
30068
30080
  "Semgrep_codacy.python.i18n."
30069
30081
  ]
30070
30082
  },
30071
- Lingui: {
30083
+ lingui: {
30072
30084
  prefixes: [
30073
30085
  "Semgrep_codacy.cpp.i18n.",
30074
30086
  "Semgrep_codacy.java.i18n.",
@@ -30084,13 +30096,116 @@ var pattern_mappings_default = {
30084
30096
  "Semgrep_codacy.python.i18n."
30085
30097
  ]
30086
30098
  },
30087
- "Flask-Babel": {
30099
+ "flask-babel": {
30088
30100
  prefixes: [
30089
30101
  "Semgrep_codacy.cpp.i18n.",
30090
30102
  "Semgrep_codacy.java.i18n.",
30091
30103
  "Semgrep_codacy.js.i18n.",
30092
30104
  "Semgrep_codacy.python.i18n."
30093
30105
  ]
30106
+ },
30107
+ pyramid: {
30108
+ prefixes: ["Semgrep_python.pyramid."]
30109
+ },
30110
+ pycryptodome: {
30111
+ prefixes: ["Semgrep_python.pycryptodome."]
30112
+ },
30113
+ jinja2: {
30114
+ prefixes: ["Semgrep_python.jinja2."]
30115
+ },
30116
+ boto3: {
30117
+ prefixes: [
30118
+ "Semgrep_python.boto3.",
30119
+ "Semgrep_python.aws-lambda.",
30120
+ "Semgrep_javascript.aws-lambda.",
30121
+ "Semgrep_ruby.aws-lambda.",
30122
+ "Semgrep_go.aws-lambda."
30123
+ ]
30124
+ },
30125
+ twilio: {
30126
+ prefixes: ["Semgrep_python.twilio."]
30127
+ },
30128
+ requests: {
30129
+ prefixes: ["Semgrep_python.requests."]
30130
+ },
30131
+ "android-sdk": {
30132
+ prefixes: ["Semgrep_java.android."]
30133
+ },
30134
+ sequelize: {
30135
+ prefixes: ["Semgrep_javascript.sequelize."]
30136
+ },
30137
+ puppeteer: {
30138
+ prefixes: ["Semgrep_javascript.puppeteer."]
30139
+ },
30140
+ electron: {
30141
+ prefixes: ["Semgrep_rules_lgpl_javascript_electronjs_"]
30142
+ },
30143
+ symfony: {
30144
+ prefixes: ["Semgrep_php.symfony."]
30145
+ },
30146
+ "doctrine-orm": {
30147
+ prefixes: ["Semgrep_php.doctrine."]
30148
+ },
30149
+ "doctrine-dbal": {
30150
+ prefixes: ["Semgrep_php.doctrine."]
30151
+ },
30152
+ kubernetes: {
30153
+ prefixes: ["Semgrep_yaml.kubernetes.", "Semgrep_codacy.k8s."]
30154
+ },
30155
+ helm: {
30156
+ prefixes: ["Semgrep_yaml.kubernetes.", "Semgrep_codacy.k8s."]
30157
+ },
30158
+ "github-actions": {
30159
+ prefixes: ["Semgrep_yaml.github-actions."]
30160
+ },
30161
+ "aws-cdk": {
30162
+ prefixes: [
30163
+ "Semgrep_typescript.aws-cdk.",
30164
+ "Semgrep_python.aws-lambda.",
30165
+ "Semgrep_javascript.aws-lambda.",
30166
+ "Semgrep_ruby.aws-lambda.",
30167
+ "Semgrep_go.aws-lambda."
30168
+ ]
30169
+ },
30170
+ "aws-sdk": {
30171
+ prefixes: [
30172
+ "Semgrep_python.aws-lambda.",
30173
+ "Semgrep_javascript.aws-lambda.",
30174
+ "Semgrep_ruby.aws-lambda.",
30175
+ "Semgrep_go.aws-lambda."
30176
+ ]
30177
+ },
30178
+ "aws-sdk-go": {
30179
+ prefixes: [
30180
+ "Semgrep_python.aws-lambda.",
30181
+ "Semgrep_javascript.aws-lambda.",
30182
+ "Semgrep_ruby.aws-lambda.",
30183
+ "Semgrep_go.aws-lambda."
30184
+ ]
30185
+ },
30186
+ "serverless-framework": {
30187
+ prefixes: [
30188
+ "Semgrep_python.aws-lambda.",
30189
+ "Semgrep_javascript.aws-lambda.",
30190
+ "Semgrep_ruby.aws-lambda.",
30191
+ "Semgrep_go.aws-lambda."
30192
+ ]
30193
+ },
30194
+ cloudformation: {
30195
+ prefixes: [
30196
+ "Semgrep_python.aws-lambda.",
30197
+ "Semgrep_javascript.aws-lambda.",
30198
+ "Semgrep_ruby.aws-lambda.",
30199
+ "Semgrep_go.aws-lambda."
30200
+ ]
30201
+ },
30202
+ "lang:Terraform": {
30203
+ prefixes: [
30204
+ "Semgrep_python.aws-lambda.",
30205
+ "Semgrep_javascript.aws-lambda.",
30206
+ "Semgrep_ruby.aws-lambda.",
30207
+ "Semgrep_go.aws-lambda."
30208
+ ]
30094
30209
  }
30095
30210
  };
30096
30211
 
package/dist/metadata.js CHANGED
@@ -26,64 +26,76 @@ module.exports = __toCommonJS(metadata_exports);
26
26
 
27
27
  // src/pattern-mappings.json
28
28
  var pattern_mappings_default = {
29
- Django: {
29
+ django: {
30
30
  prefixes: ["Semgrep_python.django."]
31
31
  },
32
- Flask: {
33
- prefixes: ["Semgrep_python.flask."]
32
+ flask: {
33
+ prefixes: ["Semgrep_python.flask.", "Semgrep_python.jinja2."]
34
34
  },
35
- FastAPI: {
35
+ fastapi: {
36
36
  prefixes: ["Semgrep_python.fastapi."]
37
37
  },
38
- SQLAlchemy: {
38
+ sqlalchemy: {
39
39
  prefixes: ["Semgrep_python.sqlalchemy."]
40
40
  },
41
- Express: {
41
+ express: {
42
42
  prefixes: ["Semgrep_javascript.express."]
43
43
  },
44
- React: {
44
+ react: {
45
45
  prefixes: ["Semgrep_javascript.react.", "Semgrep_typescript.react."]
46
46
  },
47
- Angular: {
47
+ angular: {
48
48
  prefixes: ["Semgrep_javascript.angular.", "Semgrep_typescript.angular."]
49
49
  },
50
- "Vue.js": {
50
+ vue: {
51
51
  prefixes: ["Semgrep_javascript.vue."]
52
52
  },
53
- NestJS: {
53
+ nestjs: {
54
54
  prefixes: ["Semgrep_typescript.nestjs."]
55
55
  },
56
- jQuery: {
56
+ jquery: {
57
57
  prefixes: ["Semgrep_javascript.jquery."]
58
58
  },
59
- Playwright: {
59
+ playwright: {
60
60
  prefixes: ["Semgrep_javascript.playwright."]
61
61
  },
62
- "Ruby on Rails": {
62
+ "ruby-on-rails": {
63
63
  prefixes: ["Semgrep_ruby.rails."]
64
64
  },
65
- Spring: {
65
+ "play-framework": {
66
+ prefixes: ["Semgrep_scala.play.", "Semgrep_scala_ssrf_rule-Play"]
67
+ },
68
+ slick: {
69
+ prefixes: ["Semgrep_scala.slick."]
70
+ },
71
+ "jwt-scala": {
72
+ prefixes: ["Semgrep_scala.jwt-scala.", "Semgrep_scala.scala-jwt."]
73
+ },
74
+ "spring-boot": {
66
75
  prefixes: ["Semgrep_java.spring."]
67
76
  },
68
- Laravel: {
77
+ "spring-framework": {
78
+ prefixes: ["Semgrep_java.spring."]
79
+ },
80
+ laravel: {
69
81
  prefixes: ["Semgrep_php.laravel."]
70
82
  },
71
- WordPress: {
83
+ wordpress: {
72
84
  prefixes: ["Semgrep_php.wordpress-plugins."]
73
85
  },
74
- "Gorilla Mux": {
86
+ "gorilla-mux": {
75
87
  prefixes: ["Semgrep_go.gorilla."]
76
88
  },
77
- GORM: {
89
+ "go-gorm": {
78
90
  prefixes: ["Semgrep_go.gorm."]
79
91
  },
80
- gRPC: {
92
+ grpc: {
81
93
  prefixes: ["Semgrep_go.grpc."]
82
94
  },
83
- MongoDB: {
95
+ mongodb: {
84
96
  prefixes: ["Semgrep_java.mongodb.", "Semgrep_python.pymongo."]
85
97
  },
86
- Mongoose: {
98
+ mongoose: {
87
99
  prefixes: ["Semgrep_python.pymongo."]
88
100
  },
89
101
  i18next: {
@@ -95,7 +107,7 @@ var pattern_mappings_default = {
95
107
  "Semgrep_codacy.python.i18n."
96
108
  ]
97
109
  },
98
- "react-intl": {
110
+ formatjs: {
99
111
  prefixes: [
100
112
  "Semgrep_codacy.cpp.i18n.",
101
113
  "Semgrep_codacy.java.i18n.",
@@ -111,7 +123,7 @@ var pattern_mappings_default = {
111
123
  "Semgrep_codacy.python.i18n."
112
124
  ]
113
125
  },
114
- Lingui: {
126
+ lingui: {
115
127
  prefixes: [
116
128
  "Semgrep_codacy.cpp.i18n.",
117
129
  "Semgrep_codacy.java.i18n.",
@@ -127,13 +139,116 @@ var pattern_mappings_default = {
127
139
  "Semgrep_codacy.python.i18n."
128
140
  ]
129
141
  },
130
- "Flask-Babel": {
142
+ "flask-babel": {
131
143
  prefixes: [
132
144
  "Semgrep_codacy.cpp.i18n.",
133
145
  "Semgrep_codacy.java.i18n.",
134
146
  "Semgrep_codacy.js.i18n.",
135
147
  "Semgrep_codacy.python.i18n."
136
148
  ]
149
+ },
150
+ pyramid: {
151
+ prefixes: ["Semgrep_python.pyramid."]
152
+ },
153
+ pycryptodome: {
154
+ prefixes: ["Semgrep_python.pycryptodome."]
155
+ },
156
+ jinja2: {
157
+ prefixes: ["Semgrep_python.jinja2."]
158
+ },
159
+ boto3: {
160
+ prefixes: [
161
+ "Semgrep_python.boto3.",
162
+ "Semgrep_python.aws-lambda.",
163
+ "Semgrep_javascript.aws-lambda.",
164
+ "Semgrep_ruby.aws-lambda.",
165
+ "Semgrep_go.aws-lambda."
166
+ ]
167
+ },
168
+ twilio: {
169
+ prefixes: ["Semgrep_python.twilio."]
170
+ },
171
+ requests: {
172
+ prefixes: ["Semgrep_python.requests."]
173
+ },
174
+ "android-sdk": {
175
+ prefixes: ["Semgrep_java.android."]
176
+ },
177
+ sequelize: {
178
+ prefixes: ["Semgrep_javascript.sequelize."]
179
+ },
180
+ puppeteer: {
181
+ prefixes: ["Semgrep_javascript.puppeteer."]
182
+ },
183
+ electron: {
184
+ prefixes: ["Semgrep_rules_lgpl_javascript_electronjs_"]
185
+ },
186
+ symfony: {
187
+ prefixes: ["Semgrep_php.symfony."]
188
+ },
189
+ "doctrine-orm": {
190
+ prefixes: ["Semgrep_php.doctrine."]
191
+ },
192
+ "doctrine-dbal": {
193
+ prefixes: ["Semgrep_php.doctrine."]
194
+ },
195
+ kubernetes: {
196
+ prefixes: ["Semgrep_yaml.kubernetes.", "Semgrep_codacy.k8s."]
197
+ },
198
+ helm: {
199
+ prefixes: ["Semgrep_yaml.kubernetes.", "Semgrep_codacy.k8s."]
200
+ },
201
+ "github-actions": {
202
+ prefixes: ["Semgrep_yaml.github-actions."]
203
+ },
204
+ "aws-cdk": {
205
+ prefixes: [
206
+ "Semgrep_typescript.aws-cdk.",
207
+ "Semgrep_python.aws-lambda.",
208
+ "Semgrep_javascript.aws-lambda.",
209
+ "Semgrep_ruby.aws-lambda.",
210
+ "Semgrep_go.aws-lambda."
211
+ ]
212
+ },
213
+ "aws-sdk": {
214
+ prefixes: [
215
+ "Semgrep_python.aws-lambda.",
216
+ "Semgrep_javascript.aws-lambda.",
217
+ "Semgrep_ruby.aws-lambda.",
218
+ "Semgrep_go.aws-lambda."
219
+ ]
220
+ },
221
+ "aws-sdk-go": {
222
+ prefixes: [
223
+ "Semgrep_python.aws-lambda.",
224
+ "Semgrep_javascript.aws-lambda.",
225
+ "Semgrep_ruby.aws-lambda.",
226
+ "Semgrep_go.aws-lambda."
227
+ ]
228
+ },
229
+ "serverless-framework": {
230
+ prefixes: [
231
+ "Semgrep_python.aws-lambda.",
232
+ "Semgrep_javascript.aws-lambda.",
233
+ "Semgrep_ruby.aws-lambda.",
234
+ "Semgrep_go.aws-lambda."
235
+ ]
236
+ },
237
+ cloudformation: {
238
+ prefixes: [
239
+ "Semgrep_python.aws-lambda.",
240
+ "Semgrep_javascript.aws-lambda.",
241
+ "Semgrep_ruby.aws-lambda.",
242
+ "Semgrep_go.aws-lambda."
243
+ ]
244
+ },
245
+ "lang:Terraform": {
246
+ prefixes: [
247
+ "Semgrep_python.aws-lambda.",
248
+ "Semgrep_javascript.aws-lambda.",
249
+ "Semgrep_ruby.aws-lambda.",
250
+ "Semgrep_go.aws-lambda."
251
+ ]
137
252
  }
138
253
  };
139
254
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-opengrep-1",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Opengrep adapter — CLI-mode multi-language SAST scanner",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "yaml": "^2.6.0",
13
- "@codacy/tooling": "0.17.0"
13
+ "@codacy/tooling": "0.19.0"
14
14
  },
15
15
  "license": "MIT",
16
16
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",