@critiq/rules 0.0.1 → 0.1.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/LICENSE +201 -0
- package/README.md +256 -140
- package/catalog.yaml +985 -19
- package/package.json +7 -1
- package/rules/go/go.performance.no-regex-construction-in-loop.rule.yaml +33 -0
- package/rules/go/go.performance.no-sync-fs-in-request-path.rule.yaml +33 -0
- package/rules/go/go.performance.no-unbounded-concurrency.rule.yaml +33 -0
- package/rules/go/go.security.echo-sensitive-binding-without-validation.rule.yaml +46 -0
- package/rules/go/go.security.echo-unsafe-multipart-upload.rule.yaml +45 -0
- package/rules/go/go.security.fiber-sensitive-binding-without-validation.rule.yaml +45 -0
- package/rules/go/go.security.fiber-unsafe-multipart-upload.rule.yaml +45 -0
- package/rules/go/go.security.gin-sensitive-binding-without-validation.rule.yaml +45 -0
- package/rules/go/go.security.gin-trust-all-proxies.rule.yaml +45 -0
- package/rules/go/go.security.gin-wildcard-cors-with-credentials.rule.yaml +47 -0
- package/rules/go/go.security.net-http-missing-timeouts.rule.yaml +45 -0
- package/rules/go/go.security.sensitive-data-egress.rule.yaml +46 -0
- package/rules/go/go.security.tar-path-traversal.rule.yaml +45 -0
- package/rules/go/go.security.template-unescaped-request-value.rule.yaml +45 -0
- package/rules/go/go.testing.real-network-in-unit-test.rule.yaml +33 -0
- package/rules/go/go.testing.t-skip-without-ticket-reference.rule.yaml +33 -0
- package/rules/go/go.testing.time-sleep-in-unit-test.rule.yaml +33 -0
- package/rules/java/java.performance.no-regex-construction-in-loop.rule.yaml +33 -0
- package/rules/java/java.performance.no-sync-fs-in-request-path.rule.yaml +33 -0
- package/rules/java/java.performance.no-unbounded-concurrency.rule.yaml +33 -0
- package/rules/java/java.security.android-screenshot-exposure.rule.yaml +35 -0
- package/rules/java/java.security.android-world-readable-mode.rule.yaml +35 -0
- package/rules/java/java.security.jpa-concatenated-query.rule.yaml +47 -0
- package/rules/java/java.security.reflected-output-from-request.rule.yaml +35 -0
- package/rules/java/java.security.servlet-insecure-cookie.rule.yaml +35 -0
- package/rules/java/java.security.spring-actuator-health-details-always.rule.yaml +40 -0
- package/rules/java/java.security.spring-actuator-sensitive-exposure.rule.yaml +40 -0
- package/rules/java/java.security.spring-csrf-globally-disabled.rule.yaml +49 -0
- package/rules/java/java.security.spring-debug-exposure.rule.yaml +35 -0
- package/rules/java/java.security.spring-permit-all-default.rule.yaml +47 -0
- package/rules/java/java.security.spring-webmvc-unrestricted-data-binding.rule.yaml +47 -0
- package/rules/java/java.security.template-unescaped-user-output.rule.yaml +49 -0
- package/rules/java/java.testing.disabled-without-ticket-reference.rule.yaml +33 -0
- package/rules/java/java.testing.http-client-in-unit-test.rule.yaml +33 -0
- package/rules/java/java.testing.thread-sleep-in-unit-test.rule.yaml +33 -0
- package/rules/php/php.performance.no-regex-construction-in-loop.rule.yaml +33 -0
- package/rules/php/php.performance.no-sync-fs-in-request-path.rule.yaml +33 -0
- package/rules/php/php.performance.no-unbounded-concurrency.rule.yaml +33 -0
- package/rules/php/php.security.insecure-cors-wildcard-with-credentials.rule.yaml +41 -0
- package/rules/php/php.security.insecure-mail-or-file-transport.rule.yaml +41 -0
- package/rules/php/php.security.insecure-session-or-cookie-config.rule.yaml +42 -0
- package/rules/php/php.security.laravel-sensitive-csrf-exclusion.rule.yaml +42 -0
- package/rules/php/php.security.laravel-unsafe-blade-output.rule.yaml +42 -0
- package/rules/php/php.security.laravel-unsafe-mass-assignment.rule.yaml +45 -0
- package/rules/php/php.security.sensitive-data-egress.rule.yaml +42 -0
- package/rules/php/php.security.symfony-csrf-disabled.rule.yaml +42 -0
- package/rules/php/php.security.symfony-debug-exposure.rule.yaml +44 -0
- package/rules/php/php.security.unsafe-file-upload-handling.rule.yaml +41 -0
- package/rules/php/php.security.wordpress-missing-nonce-or-capability.rule.yaml +42 -0
- package/rules/php/php.security.wordpress-unprepared-sql.rule.yaml +42 -0
- package/rules/php/php.testing.curl-in-unit-test.rule.yaml +33 -0
- package/rules/php/php.testing.mark-test-skipped-without-ticket-reference.rule.yaml +33 -0
- package/rules/php/php.testing.sleep-in-unit-test.rule.yaml +33 -0
- package/rules/python/py.performance.no-regex-construction-in-loop.rule.yaml +33 -0
- package/rules/python/py.performance.no-sync-fs-in-request-path.rule.yaml +33 -0
- package/rules/python/py.performance.no-unbounded-concurrency.rule.yaml +33 -0
- package/rules/python/py.security.django-csrf-exempt-state-changing.rule.yaml +46 -0
- package/rules/python/py.security.django-missing-csrf-middleware.rule.yaml +47 -0
- package/rules/python/py.security.django-unsafe-production-settings.rule.yaml +47 -0
- package/rules/python/py.security.drf-allow-any-default.rule.yaml +46 -0
- package/rules/python/py.security.drf-allow-any-unsafe-method.rule.yaml +46 -0
- package/rules/python/py.security.fastapi-insecure-cors.rule.yaml +43 -0
- package/rules/python/py.security.flask-missing-upload-body-limit.rule.yaml +44 -0
- package/rules/python/py.security.flask-unsafe-html-output.rule.yaml +44 -0
- package/rules/python/py.security.flask-unsafe-upload-filename.rule.yaml +44 -0
- package/rules/python/py.testing.pytest-skip-without-ticket-reference.rule.yaml +33 -0
- package/rules/python/py.testing.real-network-in-unit-test.rule.yaml +33 -0
- package/rules/python/py.testing.time-sleep-in-unit-test.rule.yaml +33 -0
- package/rules/ruby/ruby.performance.no-regex-construction-in-loop.rule.yaml +33 -0
- package/rules/ruby/ruby.performance.no-sync-fs-in-request-path.rule.yaml +33 -0
- package/rules/ruby/ruby.performance.no-unbounded-concurrency.rule.yaml +33 -0
- package/rules/ruby/ruby.security.rails-csrf-disabled.rule.yaml +45 -0
- package/rules/ruby/ruby.security.rails-detailed-exceptions-enabled.rule.yaml +44 -0
- package/rules/ruby/ruby.security.rails-open-redirect.rule.yaml +45 -0
- package/rules/ruby/ruby.security.rails-unsafe-html-output.rule.yaml +46 -0
- package/rules/ruby/ruby.security.rails-unsafe-render.rule.yaml +45 -0
- package/rules/ruby/ruby.security.rails-unsafe-session-or-cookie-store.rule.yaml +45 -0
- package/rules/ruby/ruby.security.rails-unsafe-strong-parameters.rule.yaml +46 -0
- package/rules/ruby/ruby.security.sensitive-data-egress.rule.yaml +45 -0
- package/rules/ruby/ruby.security.sidekiq-web-unauthenticated-mount.rule.yaml +45 -0
- package/rules/ruby/ruby.testing.focused-example.rule.yaml +33 -0
- package/rules/ruby/ruby.testing.pending-without-ticket-reference.rule.yaml +33 -0
- package/rules/ruby/ruby.testing.real-network-in-unit-test.rule.yaml +33 -0
- package/rules/ruby/ruby.testing.skip-without-ticket-reference.rule.yaml +33 -0
- package/rules/ruby/ruby.testing.sleep-in-unit-test.rule.yaml +33 -0
- package/rules/rust/rust.performance.no-regex-construction-in-loop.rule.yaml +33 -0
- package/rules/rust/rust.performance.no-sync-fs-in-request-path.rule.yaml +33 -0
- package/rules/rust/rust.performance.no-unbounded-concurrency.rule.yaml +33 -0
- package/rules/rust/rust.security.actix-wildcard-cors-with-credentials.rule.yaml +47 -0
- package/rules/rust/rust.security.axum-body-limit-disabled.rule.yaml +45 -0
- package/rules/rust/rust.security.axum-insecure-cors-with-credentials.rule.yaml +47 -0
- package/rules/rust/rust.security.rocket-panic-prone-request-handler.rule.yaml +45 -0
- package/rules/rust/rust.security.rocket-unsafe-template-output.rule.yaml +47 -0
- package/rules/rust/rust.security.sqlx-diesel-raw-interpolated-query.rule.yaml +47 -0
- package/rules/rust/rust.security.template-unescaped-request-value.rule.yaml +47 -0
- package/rules/rust/rust.security.warp-blocking-or-panic-in-async-handler.rule.yaml +45 -0
- package/rules/rust/rust.testing.ignore-without-ticket-reference.rule.yaml +33 -0
- package/rules/rust/rust.testing.real-network-in-unit-test.rule.yaml +33 -0
- package/rules/rust/rust.testing.thread-sleep-in-unit-test.rule.yaml +33 -0
- package/rules/shared/security.archive-path-traversal.rule.yaml +41 -0
- package/rules/shared/security.external-file-upload.rule.yaml +40 -0
- package/rules/shared/security.permissive-file-permissions.rule.yaml +40 -0
- package/rules/shared/security.sensitive-data-egress.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.assignment-in-condition.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.assignment-to-import-binding.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.async-promise-executor.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.duplicate-function-parameter.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.duplicate-import-source.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.duplicate-object-key.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.duplicate-switch-case.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.empty-block-statement.rule.yaml +35 -0
- package/rules/typescript/ts.correctness.identical-comparison-operands.rule.yaml +36 -0
- package/rules/typescript/ts.correctness.reassign-catch-binding.rule.yaml +35 -0
- package/rules/typescript/ts.correctness.regexp-pattern-unusual-control-character.rule.yaml +35 -0
- package/rules/typescript/ts.correctness.self-assignment.rule.yaml +36 -0
- package/rules/typescript/ts.next.server-action-missing-local-auth.rule.yaml +35 -0
- package/rules/typescript/ts.performance.no-array-spread-in-hot-loop.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-cache-miss-from-unstable-key.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-expensive-sort-in-render-path.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-json-parse-stringify-clone.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-large-object-spread-in-loop.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-n-plus-one-await-in-map.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-redundant-network-fetch.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-regex-construction-in-loop.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-sync-fs-in-request-path.rule.yaml +32 -0
- package/rules/typescript/ts.performance.no-unbounded-concurrency.rule.yaml +32 -0
- package/rules/typescript/ts.quality.no-ambiguous-abbreviations.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-barrel-file-cycle.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-boolean-parameter-trap.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-dead-export.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-hidden-side-effect-import.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-inconsistent-error-shape.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-mixed-abstraction-level.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-primitive-obsession-in-domain-model.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-temporal-coupling.rule.yaml +27 -0
- package/rules/typescript/ts.quality.no-wide-public-surface.rule.yaml +27 -0
- package/rules/typescript/ts.react.no-accessibility-label-missing.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-activedescendant-on-non-focusable-host.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-click-without-keyboard-handler.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-deprecated-create-factory.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-deprecated-react-dom-root-api.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-derived-state-from-props.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-effect-fetch-without-cancellation.rule.yaml +35 -0
- package/rules/typescript/ts.react.no-find-dom-node.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-img-missing-alt-text.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-index-as-key-in-dynamic-list.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-interactive-role-on-static-semantics.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-invalid-anchor-href.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-keyboard-interaction-without-widget-role.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-legacy-lifecycle.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-missing-error-boundary.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-positive-tabindex.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-static-element-with-synthetic-handlers.rule.yaml +36 -0
- package/rules/typescript/ts.react.no-string-ref.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-uncontrolled-to-controlled-input.rule.yaml +34 -0
- package/rules/typescript/ts.react.no-widget-role-without-tabindex.rule.yaml +36 -0
- package/rules/typescript/ts.security.ajv-insecure-configuration.rule.yaml +34 -0
- package/rules/typescript/ts.security.angular-dom-sanitizer-bypass-untrusted-input.rule.yaml +35 -0
- package/rules/typescript/ts.security.apollo-server-csrf-disabled.rule.yaml +36 -0
- package/rules/typescript/ts.security.apollo-server-graphql-dev-tooling-exposure.rule.yaml +36 -0
- package/rules/typescript/ts.security.apollo-server-introspection-exposure.rule.yaml +35 -0
- package/rules/typescript/ts.security.apollo-server-missing-query-limits.rule.yaml +35 -0
- package/rules/typescript/ts.security.astro-vite-public-secret-define.rule.yaml +39 -0
- package/rules/typescript/ts.security.debug-statement-in-source.rule.yaml +36 -0
- package/rules/typescript/ts.security.electron-dangerous-webpreferences.rule.yaml +35 -0
- package/rules/typescript/ts.security.electron-insecure-local-state.rule.yaml +35 -0
- package/rules/typescript/ts.security.electron-missing-ipc-origin-check.rule.yaml +35 -0
- package/rules/typescript/ts.security.electron-shell-open-external-unvalidated.rule.yaml +35 -0
- package/rules/typescript/ts.security.express-error-handler-information-disclosure.rule.yaml +35 -0
- package/rules/typescript/ts.security.express-static-dotfiles-allow.rule.yaml +35 -0
- package/rules/typescript/ts.security.express-unbounded-body-parser.rule.yaml +34 -0
- package/rules/typescript/ts.security.express-user-controlled-static-mount.rule.yaml +35 -0
- package/rules/typescript/ts.security.fastify-excessive-body-limit.rule.yaml +34 -0
- package/rules/typescript/ts.security.fastify-public-bind-without-trust-proxy.rule.yaml +38 -0
- package/rules/typescript/ts.security.graphql-upload-without-csrf-guard.rule.yaml +36 -0
- package/rules/typescript/ts.security.iframe-missing-sandbox-attribute.rule.yaml +35 -0
- package/rules/typescript/ts.security.insecure-content-security-policy-literal.rule.yaml +35 -0
- package/rules/typescript/ts.security.insecure-helmet-hardening-options.rule.yaml +36 -0
- package/rules/typescript/ts.security.jwt-insecure-signing-algorithm.rule.yaml +35 -0
- package/rules/typescript/ts.security.legacy-buffer-constructor.rule.yaml +35 -0
- package/rules/typescript/ts.security.log-injection.rule.yaml +36 -0
- package/rules/typescript/ts.security.nestjs-helmet-after-route-mount.rule.yaml +34 -0
- package/rules/typescript/ts.security.nestjs-missing-global-validation-pipe.rule.yaml +35 -0
- package/rules/typescript/ts.security.nestjs-skip-throttle-sensitive-route.rule.yaml +35 -0
- package/rules/typescript/ts.security.nestjs-validation-pipe-without-whitelist.rule.yaml +36 -0
- package/rules/typescript/ts.security.nuxt-public-runtime-secret.rule.yaml +38 -0
- package/rules/typescript/ts.security.open-redirect.rule.yaml +2 -0
- package/rules/typescript/ts.security.request-driven-array-index-access.rule.yaml +33 -0
- package/rules/typescript/ts.security.sensitive-data-egress.rule.yaml +1 -0
- package/rules/typescript/ts.security.ssrf.rule.yaml +1 -0
- package/rules/typescript/ts.security.unsafe-dompurify-version.rule.yaml +36 -0
- package/rules/typescript/ts.security.unsafe-marked-version.rule.yaml +36 -0
- package/rules/typescript/ts.security.xml-parse-string-with-untrusted-input.rule.yaml +35 -0
- package/rules/typescript/ts.testing.no-flaky-timer-test.rule.yaml +38 -0
- package/rules/typescript/ts.testing.no-focused-test.rule.yaml +34 -0
- package/rules/typescript/ts.testing.no-missing-edge-case-tests.rule.yaml +35 -0
- package/rules/typescript/ts.testing.no-network-call-in-unit-test.rule.yaml +38 -0
- package/rules/typescript/ts.testing.no-skipped-test-without-ticket.rule.yaml +34 -0
- package/rules/typescript/ts.testing.no-snapshot-without-intent.rule.yaml +34 -0
- package/rules/typescript/ts.testing.no-test-only-code-in-production.rule.yaml +38 -0
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@critiq/rules",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Public OSS Critiq rule catalog with catalog metadata, shipped rule YAML files, and preset membership.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/critiq-dev/critiq-rules.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/critiq-dev/critiq-rules#readme",
|
|
6
12
|
"type": "commonjs",
|
|
7
13
|
"main": "./src/index.js",
|
|
8
14
|
"types": "./src/index.d.ts",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.performance.no-regex-construction-in-loop
|
|
5
|
+
title: Avoid no regex construction in loop
|
|
6
|
+
summary: Performance hygiene signal for go sources.
|
|
7
|
+
rationale: Performance hygiene signal for go sources.
|
|
8
|
+
tags:
|
|
9
|
+
- performance
|
|
10
|
+
- go
|
|
11
|
+
- rules-catalog
|
|
12
|
+
stability: experimental
|
|
13
|
+
appliesTo: block
|
|
14
|
+
scope:
|
|
15
|
+
languages:
|
|
16
|
+
- go
|
|
17
|
+
match:
|
|
18
|
+
fact:
|
|
19
|
+
kind: go.performance.no-regex-construction-in-loop
|
|
20
|
+
bind: issue
|
|
21
|
+
emit:
|
|
22
|
+
finding:
|
|
23
|
+
category: performance.allocation
|
|
24
|
+
severity: medium
|
|
25
|
+
confidence: 0.66
|
|
26
|
+
tags:
|
|
27
|
+
- performance
|
|
28
|
+
- go
|
|
29
|
+
message:
|
|
30
|
+
title: Avoid no regex construction in loop in `go` code
|
|
31
|
+
summary: "`${captures.issue.text}` matches go.performance.no-regex-construction-in-loop."
|
|
32
|
+
remediation:
|
|
33
|
+
summary: Refactor this path to reduce avoidable runtime overhead.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.performance.no-sync-fs-in-request-path
|
|
5
|
+
title: Avoid no sync fs in request path
|
|
6
|
+
summary: Performance hygiene signal for go sources.
|
|
7
|
+
rationale: Performance hygiene signal for go sources.
|
|
8
|
+
tags:
|
|
9
|
+
- performance
|
|
10
|
+
- go
|
|
11
|
+
- rules-catalog
|
|
12
|
+
stability: experimental
|
|
13
|
+
appliesTo: block
|
|
14
|
+
scope:
|
|
15
|
+
languages:
|
|
16
|
+
- go
|
|
17
|
+
match:
|
|
18
|
+
fact:
|
|
19
|
+
kind: go.performance.no-sync-fs-in-request-path
|
|
20
|
+
bind: issue
|
|
21
|
+
emit:
|
|
22
|
+
finding:
|
|
23
|
+
category: performance.io
|
|
24
|
+
severity: high
|
|
25
|
+
confidence: 0.66
|
|
26
|
+
tags:
|
|
27
|
+
- performance
|
|
28
|
+
- go
|
|
29
|
+
message:
|
|
30
|
+
title: Avoid no sync fs in request path in `go` code
|
|
31
|
+
summary: "`${captures.issue.text}` matches go.performance.no-sync-fs-in-request-path."
|
|
32
|
+
remediation:
|
|
33
|
+
summary: Refactor this path to reduce avoidable runtime overhead.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.performance.no-unbounded-concurrency
|
|
5
|
+
title: Avoid no unbounded concurrency
|
|
6
|
+
summary: Performance hygiene signal for go sources.
|
|
7
|
+
rationale: Performance hygiene signal for go sources.
|
|
8
|
+
tags:
|
|
9
|
+
- performance
|
|
10
|
+
- go
|
|
11
|
+
- rules-catalog
|
|
12
|
+
stability: experimental
|
|
13
|
+
appliesTo: block
|
|
14
|
+
scope:
|
|
15
|
+
languages:
|
|
16
|
+
- go
|
|
17
|
+
match:
|
|
18
|
+
fact:
|
|
19
|
+
kind: go.performance.no-unbounded-concurrency
|
|
20
|
+
bind: issue
|
|
21
|
+
emit:
|
|
22
|
+
finding:
|
|
23
|
+
category: performance.async
|
|
24
|
+
severity: medium
|
|
25
|
+
confidence: 0.66
|
|
26
|
+
tags:
|
|
27
|
+
- performance
|
|
28
|
+
- go
|
|
29
|
+
message:
|
|
30
|
+
title: Avoid no unbounded concurrency in `go` code
|
|
31
|
+
summary: "`${captures.issue.text}` matches go.performance.no-unbounded-concurrency."
|
|
32
|
+
remediation:
|
|
33
|
+
summary: Refactor this path to reduce avoidable runtime overhead.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.echo-sensitive-binding-without-validation
|
|
5
|
+
title: Echo handlers should validate sensitive request bodies
|
|
6
|
+
summary: >-
|
|
7
|
+
Sensitive Echo binds should use struct tags or validators so mutations cannot accept empty or malformed credentials and roles.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Regex-based heuristics flag Echo `Bind` usage when the file defines structs with sensitive fields that omit `validate` or `binding` style tags.
|
|
10
|
+
This is intentionally conservative and may miss cross-file structs or middleware-protected routes.
|
|
11
|
+
tags:
|
|
12
|
+
- security
|
|
13
|
+
- go
|
|
14
|
+
- echo
|
|
15
|
+
- rules-catalog
|
|
16
|
+
stability: experimental
|
|
17
|
+
appliesTo: block
|
|
18
|
+
scope:
|
|
19
|
+
languages:
|
|
20
|
+
- go
|
|
21
|
+
paths:
|
|
22
|
+
include:
|
|
23
|
+
- "**/*.go"
|
|
24
|
+
exclude:
|
|
25
|
+
- "**/*_test.go"
|
|
26
|
+
- "**/testdata/**"
|
|
27
|
+
- "**/vendor/**"
|
|
28
|
+
match:
|
|
29
|
+
fact:
|
|
30
|
+
kind: go.security.echo-sensitive-binding-without-validation
|
|
31
|
+
bind: issue
|
|
32
|
+
emit:
|
|
33
|
+
finding:
|
|
34
|
+
category: security.input-validation
|
|
35
|
+
severity: medium
|
|
36
|
+
confidence: 0.72
|
|
37
|
+
tags:
|
|
38
|
+
- security
|
|
39
|
+
- go
|
|
40
|
+
- echo
|
|
41
|
+
message:
|
|
42
|
+
title: Add validation tags for sensitive Echo binds in `${captures.issue.text}`
|
|
43
|
+
summary: "`${captures.issue.text}` binds request data without validation tags on sensitive struct fields."
|
|
44
|
+
remediation:
|
|
45
|
+
summary: >-
|
|
46
|
+
Add `validate` tags, use Echo's binding helpers with explicit validation, or route through a hardened DTO layer.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.echo-unsafe-multipart-upload
|
|
5
|
+
title: Harden Echo multipart uploads
|
|
6
|
+
summary: >-
|
|
7
|
+
Multipart handlers should cap body size, sanitize filenames with `filepath.Base`, and avoid concatenating user filenames into destination paths.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Unbounded multipart reads and raw `FormFile().Filename` usage enable DoS and path traversal when combined with predictable upload directories.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- echo
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.echo-unsafe-multipart-upload
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.filesystem
|
|
34
|
+
severity: high
|
|
35
|
+
confidence: 0.78
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- echo
|
|
40
|
+
message:
|
|
41
|
+
title: Harden Echo upload handling in `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` writes multipart uploads without `MaxBytesReader`, basename hardening, or equivalent guards."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Wrap the request body with `http.MaxBytesReader`, normalize filenames with `filepath.Base`, enforce extension allowlists, and prefer storage APIs that never trust client paths.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.fiber-sensitive-binding-without-validation
|
|
5
|
+
title: Fiber handlers should validate sensitive request bodies
|
|
6
|
+
summary: >-
|
|
7
|
+
Sensitive Fiber parsers should pair structs with validator tags or explicit validation so roles and secrets cannot be silently omitted.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Regex heuristics flag `BodyParser`/`JSON` usage when structs in the same file define sensitive fields without `validate` or `binding` style tags.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- fiber
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.fiber-sensitive-binding-without-validation
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.input-validation
|
|
34
|
+
severity: medium
|
|
35
|
+
confidence: 0.72
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- fiber
|
|
40
|
+
message:
|
|
41
|
+
title: Add validation tags for sensitive Fiber binds in `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` parses request bodies without validation tags on sensitive struct fields."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Add `validate` struct tags, use Fiber validator middleware, or centralize DTO validation before business logic.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.fiber-unsafe-multipart-upload
|
|
5
|
+
title: Harden Fiber multipart uploads
|
|
6
|
+
summary: >-
|
|
7
|
+
Fiber upload helpers should enforce size limits and never persist client-controlled filenames without normalization.
|
|
8
|
+
rationale: >-
|
|
9
|
+
`FormFile`/`SaveFile` flows that concatenate `Filename` into paths or skip `filepath.Base` are a common path traversal and storage abuse vector.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- fiber
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.fiber-unsafe-multipart-upload
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.filesystem
|
|
34
|
+
severity: high
|
|
35
|
+
confidence: 0.76
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- fiber
|
|
40
|
+
message:
|
|
41
|
+
title: Harden Fiber upload handling in `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` handles multipart uploads without basename hardening or byte limits in the local handler window."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Apply `filepath.Base`, cap reader sizes, allowlist extensions, and store uploads using server-generated object keys.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.gin-sensitive-binding-without-validation
|
|
5
|
+
title: Gin handlers should validate sensitive request bodies
|
|
6
|
+
summary: >-
|
|
7
|
+
Sensitive Gin binds should use `binding` or validator tags so authentication and mutation payloads cannot be silently empty.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Regex heuristics flag `ShouldBindJSON`/`BindJSON` usage when structs in the same file omit `binding`/`validate` tags on sensitive fields such as passwords or roles.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- gin
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.gin-sensitive-binding-without-validation
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.input-validation
|
|
34
|
+
severity: medium
|
|
35
|
+
confidence: 0.74
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- gin
|
|
40
|
+
message:
|
|
41
|
+
title: Add validation tags for sensitive Gin binds in `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` binds JSON without validation tags on sensitive struct fields."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Add `binding`/`validate` tags, register validators, or reject requests before they reach persistence layers.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.gin-trust-all-proxies
|
|
5
|
+
title: Avoid trust-all Gin reverse proxy settings
|
|
6
|
+
summary: >-
|
|
7
|
+
`SetTrustedProxies` should list real upstreams instead of `nil` or `0.0.0.0/0` style catch-alls that spoof `X-Forwarded-For`.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Trusting every proxy allows clients to forge client IP headers and bypass IP-based controls or auditing.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- gin
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.gin-trust-all-proxies
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.misconfiguration
|
|
34
|
+
severity: high
|
|
35
|
+
confidence: 0.86
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- gin
|
|
40
|
+
message:
|
|
41
|
+
title: Restrict Gin trusted proxies in `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` trusts all proxies or nil, which enables forwarded header spoofing."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Replace catch-all trusted proxy lists with explicit CIDRs for your ingress tier and document the expected hop count.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.gin-wildcard-cors-with-credentials
|
|
5
|
+
title: Avoid wildcard CORS origins with credentials in Gin
|
|
6
|
+
summary: >-
|
|
7
|
+
`gin-contrib/cors` configurations must not combine wildcard origins with `AllowCredentials: true`.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Wildcard origins with credentials violate browser CORS safety expectations and often mask missing origin allowlists in APIs that should be locked down.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- gin
|
|
14
|
+
- cors
|
|
15
|
+
- rules-catalog
|
|
16
|
+
stability: experimental
|
|
17
|
+
appliesTo: block
|
|
18
|
+
scope:
|
|
19
|
+
languages:
|
|
20
|
+
- go
|
|
21
|
+
paths:
|
|
22
|
+
include:
|
|
23
|
+
- "**/*.go"
|
|
24
|
+
exclude:
|
|
25
|
+
- "**/*_test.go"
|
|
26
|
+
- "**/testdata/**"
|
|
27
|
+
- "**/vendor/**"
|
|
28
|
+
match:
|
|
29
|
+
fact:
|
|
30
|
+
kind: go.security.gin-wildcard-cors-with-credentials
|
|
31
|
+
bind: issue
|
|
32
|
+
emit:
|
|
33
|
+
finding:
|
|
34
|
+
category: security.misconfiguration
|
|
35
|
+
severity: high
|
|
36
|
+
confidence: 0.82
|
|
37
|
+
tags:
|
|
38
|
+
- security
|
|
39
|
+
- go
|
|
40
|
+
- gin
|
|
41
|
+
- cors
|
|
42
|
+
message:
|
|
43
|
+
title: Fix permissive CORS with credentials in `${captures.issue.text}`
|
|
44
|
+
summary: "`${captures.issue.text}` pairs wildcard origins with `AllowCredentials`, which is unsafe for browser clients."
|
|
45
|
+
remediation:
|
|
46
|
+
summary: >-
|
|
47
|
+
Replace wildcard origins with explicit HTTPS origins, disable credentials when public anonymous access is intended, or move token APIs to header-only auth without credentialed CORS.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.net-http-missing-timeouts
|
|
5
|
+
title: Configure HTTP server timeouts for public listeners
|
|
6
|
+
summary: >-
|
|
7
|
+
Public Go HTTP servers should use `http.Server` with read, write, idle, and header timeouts instead of convenience `ListenAndServe` helpers or incomplete literals.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Missing timeouts enable slowloris-style resource exhaustion and hung connections on internet-facing services.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- net/http
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.net-http-missing-timeouts
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.misconfiguration
|
|
34
|
+
severity: medium
|
|
35
|
+
confidence: 0.7
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- net/http
|
|
40
|
+
message:
|
|
41
|
+
title: Add HTTP timeouts around `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` exposes a listener without full `http.Server` timeout coverage suitable for public networks."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Construct `http.Server` with `ReadHeaderTimeout`, `ReadTimeout`, `WriteTimeout`, and `IdleTimeout`, and prefer `ListenAndServe` on that configured instance.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.sensitive-data-egress
|
|
5
|
+
title: Avoid relaying request-controlled data through outbound Go HTTP clients
|
|
6
|
+
summary: >-
|
|
7
|
+
Outbound `http.Post` bodies should not be built directly from request values without validation or redaction.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Tainted POST bodies can exfiltrate secrets, replay cookies, or forward attacker payloads to internal integrations.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- privacy
|
|
14
|
+
- egress
|
|
15
|
+
- rules-catalog
|
|
16
|
+
stability: experimental
|
|
17
|
+
appliesTo: block
|
|
18
|
+
scope:
|
|
19
|
+
languages:
|
|
20
|
+
- go
|
|
21
|
+
paths:
|
|
22
|
+
include:
|
|
23
|
+
- "**/*.go"
|
|
24
|
+
exclude:
|
|
25
|
+
- "**/*_test.go"
|
|
26
|
+
- "**/testdata/**"
|
|
27
|
+
- "**/vendor/**"
|
|
28
|
+
match:
|
|
29
|
+
fact:
|
|
30
|
+
kind: security.sensitive-data-egress
|
|
31
|
+
bind: issue
|
|
32
|
+
emit:
|
|
33
|
+
finding:
|
|
34
|
+
category: security.privacy
|
|
35
|
+
severity: high
|
|
36
|
+
confidence: 0.78
|
|
37
|
+
tags:
|
|
38
|
+
- security
|
|
39
|
+
- go
|
|
40
|
+
- privacy
|
|
41
|
+
message:
|
|
42
|
+
title: Validate outbound HTTP payloads in `${captures.issue.text}`
|
|
43
|
+
summary: "`${captures.issue.text}` forwards tainted values into an outbound HTTP client body."
|
|
44
|
+
remediation:
|
|
45
|
+
summary: >-
|
|
46
|
+
Allowlist outbound hosts, strip secrets from relayed payloads, and route integrations through audited helpers.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.tar-path-traversal
|
|
5
|
+
title: Sanitize archive entry paths before writing to disk
|
|
6
|
+
summary: >-
|
|
7
|
+
Tar extraction must normalize `header.Name` with `filepath.Base` or `filepath.Clean` before opening destination files.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Writing `hdr.Name` directly enables `../` traversal that escapes intended extraction directories.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- archive
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.tar-path-traversal
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.filesystem
|
|
34
|
+
severity: high
|
|
35
|
+
confidence: 0.8
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- archive
|
|
40
|
+
message:
|
|
41
|
+
title: Normalize tar entry paths in `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` opens a filesystem path using raw tar header names without `filepath.Base`/`filepath.Clean`."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Join destinations using a fixed root with `filepath.Join`, reject absolute paths, and always apply `filepath.Base` before `os.Create`.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.security.template-unescaped-request-value
|
|
5
|
+
title: Avoid feeding request data into trusted template types
|
|
6
|
+
summary: >-
|
|
7
|
+
`template.HTML`, `template.JS`, and `template.CSS` should not wrap request-derived strings unless they were sanitized first.
|
|
8
|
+
rationale: >-
|
|
9
|
+
Trusted template types disable escaping and turn reflected input into cross-site scripting when executed in browsers.
|
|
10
|
+
tags:
|
|
11
|
+
- security
|
|
12
|
+
- go
|
|
13
|
+
- templates
|
|
14
|
+
- rules-catalog
|
|
15
|
+
stability: experimental
|
|
16
|
+
appliesTo: block
|
|
17
|
+
scope:
|
|
18
|
+
languages:
|
|
19
|
+
- go
|
|
20
|
+
paths:
|
|
21
|
+
include:
|
|
22
|
+
- "**/*.go"
|
|
23
|
+
exclude:
|
|
24
|
+
- "**/*_test.go"
|
|
25
|
+
- "**/testdata/**"
|
|
26
|
+
- "**/vendor/**"
|
|
27
|
+
match:
|
|
28
|
+
fact:
|
|
29
|
+
kind: go.security.template-unescaped-request-value
|
|
30
|
+
bind: issue
|
|
31
|
+
emit:
|
|
32
|
+
finding:
|
|
33
|
+
category: security.output-encoding
|
|
34
|
+
severity: high
|
|
35
|
+
confidence: 0.8
|
|
36
|
+
tags:
|
|
37
|
+
- security
|
|
38
|
+
- go
|
|
39
|
+
- templates
|
|
40
|
+
message:
|
|
41
|
+
title: Sanitize before using trusted template types in `${captures.issue.text}`
|
|
42
|
+
summary: "`${captures.issue.text}` wraps request-controlled data in `template.HTML`/`JS`/`CSS` without an obvious sanitizer."
|
|
43
|
+
remediation:
|
|
44
|
+
summary: >-
|
|
45
|
+
Run untrusted strings through an HTML sanitizer such as bluemonday, prefer typed templates, or keep data in plain escaped fields.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
apiVersion: critiq.dev/v1alpha1
|
|
2
|
+
kind: Rule
|
|
3
|
+
metadata:
|
|
4
|
+
id: go.testing.real-network-in-unit-test
|
|
5
|
+
title: Avoid live network clients in Go unit tests
|
|
6
|
+
summary: Unit tests should not dial the real network; prefer fakes or httptest servers.
|
|
7
|
+
rationale: Live network calls make tests flaky and couple CI to external availability.
|
|
8
|
+
tags:
|
|
9
|
+
- testing
|
|
10
|
+
- go
|
|
11
|
+
- rules-catalog
|
|
12
|
+
stability: experimental
|
|
13
|
+
appliesTo: block
|
|
14
|
+
scope:
|
|
15
|
+
languages:
|
|
16
|
+
- go
|
|
17
|
+
match:
|
|
18
|
+
fact:
|
|
19
|
+
kind: go.testing.real-network-in-unit-test
|
|
20
|
+
bind: issue
|
|
21
|
+
emit:
|
|
22
|
+
finding:
|
|
23
|
+
category: quality.testing
|
|
24
|
+
severity: medium
|
|
25
|
+
confidence: 0.68
|
|
26
|
+
tags:
|
|
27
|
+
- testing
|
|
28
|
+
- go
|
|
29
|
+
message:
|
|
30
|
+
title: Stub outbound network in `${captures.issue.text}`
|
|
31
|
+
summary: "`${captures.issue.text}` uses a real HTTP or dial client inside a `_test.go` file."
|
|
32
|
+
remediation:
|
|
33
|
+
summary: Use `httptest`, interface fakes, or recorded fixtures instead of live hosts.
|