pr-checkmate 3.0.4 → 3.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/dist/{cli.js → cjs/cli.js} +30 -30
- package/dist/{config → cjs/config}/index.d.ts +2 -2
- package/dist/{config → cjs/config}/index.js +8 -7
- package/dist/{config → cjs/config}/loader.d.ts +1 -1
- package/dist/{config → cjs/config}/loader.js +8 -8
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.js +10 -10
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.js +27 -27
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.js +17 -17
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.js +18 -18
- package/dist/{core → cjs/core}/checks/dependencies/license-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/license-check.js +12 -12
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.js +14 -14
- package/dist/{core → cjs/core}/checks/findings.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/findings.js +16 -16
- package/dist/{core → cjs/core}/checks/git/custom-rules.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/custom-rules.js +19 -19
- package/dist/{core → cjs/core}/checks/git/diff-smell.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/git/diff-smell.js +13 -13
- package/dist/{core → cjs/core}/checks/git/large-files.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/large-files.js +15 -15
- package/dist/{core → cjs/core}/checks/git/leftover-debug.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/leftover-debug.js +13 -13
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.js +12 -12
- package/dist/{core → cjs/core}/checks/git/merge-conflict.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/merge-conflict.js +15 -15
- package/dist/{core → cjs/core}/checks/git/missing-tests.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/missing-tests.js +15 -15
- package/dist/{core → cjs/core}/checks/git/todo-fixme.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/todo-fixme.js +11 -11
- package/dist/{core → cjs/core}/checks/languages/cpp-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/cpp-format.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/external-checks.d.ts +9 -9
- package/dist/{core → cjs/core}/checks/languages/external-checks.js +10 -10
- package/dist/{core → cjs/core}/checks/languages/external-runner.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/languages/external-runner.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/go-format.d.ts +1 -1
- package/dist/cjs/core/checks/languages/go-format.js +202 -0
- package/dist/cjs/core/checks/languages/lint.d.ts +2 -0
- package/dist/{core → cjs/core}/checks/languages/lint.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/prettier.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/prettier.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/python-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-format.js +14 -14
- package/dist/{core → cjs/core}/checks/languages/python-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-lint.js +13 -13
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.js +29 -29
- package/dist/{core → cjs/core}/checks/languages/typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/typecheck.js +13 -13
- package/dist/{core → cjs/core}/checks/pr/commitlint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/commitlint.js +12 -12
- package/dist/{core → cjs/core}/checks/pr/pr-body.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-body.js +8 -8
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.js +10 -10
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/case-collision.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/case-collision.js +7 -7
- package/dist/{core → cjs/core}/checks/quality/config-validation.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/config-validation.js +9 -9
- package/dist/{core → cjs/core}/checks/quality/coverage.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/coverage.js +4 -4
- package/dist/{core → cjs/core}/checks/quality/dead-code.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/dead-code.js +23 -23
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.js +22 -22
- package/dist/{core → cjs/core}/checks/quality/license-header.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/license-header.js +16 -16
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.js +17 -17
- package/dist/{core → cjs/core}/checks/quality/package-size.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/package-size.js +12 -12
- package/dist/{core → cjs/core}/checks/quality/spellcheck.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/quality/spellcheck.js +18 -18
- package/dist/{core → cjs/core}/checks/quality/symlinks.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/symlinks.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.js +12 -12
- package/dist/{core → cjs/core}/checks/security/diff-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/diff-security.js +15 -15
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.js +16 -16
- package/dist/{core → cjs/core}/checks/security/migration-safety.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/migration-safety.js +17 -17
- package/dist/{core → cjs/core}/checks/security/security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/security.js +21 -21
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.js +14 -14
- package/dist/{core → cjs/core}/checks/security/workflow-security.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/security/workflow-security.js +14 -14
- package/dist/{core → cjs/core}/checks/tool-install.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/tool-install.js +2 -2
- package/dist/{core → cjs/core}/context.d.ts +1 -1
- package/dist/{core → cjs/core}/context.js +16 -16
- package/dist/cjs/core/index.d.ts +4 -0
- package/dist/{core → cjs/core}/index.js +7 -7
- package/dist/{core → cjs/core}/install/cache.js +2 -2
- package/dist/{core → cjs/core}/install/doctor.d.ts +4 -4
- package/dist/{core → cjs/core}/install/doctor.js +34 -34
- package/dist/{core → cjs/core}/install/ensure.d.ts +2 -2
- package/dist/{core → cjs/core}/install/ensure.js +15 -14
- package/dist/{core → cjs/core}/install/lock.js +4 -4
- package/dist/{core → cjs/core}/install/prepare.d.ts +4 -4
- package/dist/{core → cjs/core}/install/prepare.js +13 -13
- package/dist/{core → cjs/core}/install/profiles.d.ts +2 -2
- package/dist/{core → cjs/core}/install/reuse.d.ts +1 -1
- package/dist/{core → cjs/core}/install/reuse.js +4 -4
- package/dist/{core → cjs/core}/registry.d.ts +1 -1
- package/dist/cjs/core/registry.js +112 -0
- package/dist/{core → cjs/core}/reporters.d.ts +1 -1
- package/dist/{core → cjs/core}/reporters.js +28 -28
- package/dist/{core → cjs/core}/run-checks.d.ts +2 -2
- package/dist/{core → cjs/core}/run-checks.js +31 -31
- package/dist/{core → cjs/core}/targets.d.ts +1 -1
- package/dist/{core → cjs/core}/targets.js +20 -20
- package/dist/{core → cjs/core}/types.d.ts +3 -3
- package/dist/cjs/index.d.ts +12 -0
- package/dist/{index.js → cjs/index.js} +18 -18
- package/dist/{init.js → cjs/init.js} +68 -56
- package/dist/{interfaces → cjs/interfaces}/index.d.ts +3 -3
- package/dist/cjs/package.json +1 -0
- package/dist/{scripts → cjs/scripts}/copy-configs.js +22 -7
- package/dist/{scripts → cjs/scripts}/generate-install-manifests.js +2 -2
- package/dist/{scripts → cjs/scripts}/publish-github.js +4 -4
- package/dist/{utils → cjs/utils}/detect-language.js +12 -12
- package/dist/cjs/utils/execa.js +46 -0
- package/dist/{utils → cjs/utils}/git.js +2 -2
- package/dist/{utils → cjs/utils}/http.js +2 -2
- package/dist/cjs/utils/index.d.ts +15 -0
- package/dist/{utils → cjs/utils}/index.js +13 -13
- package/dist/{utils → cjs/utils}/own-deps.d.ts +2 -0
- package/dist/{utils → cjs/utils}/own-deps.js +1 -0
- package/dist/{utils → cjs/utils}/package-version.js +2 -1
- package/dist/{utils → cjs/utils}/resolve-bin.js +2 -1
- package/dist/{utils → cjs/utils}/update-notifier.js +4 -4
- package/dist/esm/cli.d.ts +2 -0
- package/dist/esm/cli.js +137 -0
- package/dist/esm/config/constants.d.ts +153 -0
- package/dist/esm/config/constants.js +360 -0
- package/dist/esm/config/index.d.ts +40 -0
- package/dist/esm/config/index.js +60 -0
- package/dist/esm/config/loader.d.ts +6 -0
- package/dist/esm/config/loader.js +191 -0
- package/dist/esm/config/pr-checkmate-workflow-docker.yml +79 -0
- package/dist/esm/config/pr-checkmate-workflow.yml +92 -0
- package/dist/esm/core/checks/dependencies/banned-imports.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/banned-imports.js +70 -0
- package/dist/esm/core/checks/dependencies/circular-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/circular-deps.js +155 -0
- package/dist/esm/core/checks/dependencies/dependency-check.d.ts +43 -0
- package/dist/esm/core/checks/dependencies/dependency-check.js +174 -0
- package/dist/esm/core/checks/dependencies/grype-scan.d.ts +22 -0
- package/dist/esm/core/checks/dependencies/grype-scan.js +112 -0
- package/dist/esm/core/checks/dependencies/license-check.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/license-check.js +61 -0
- package/dist/esm/core/checks/dependencies/npm-audit.d.ts +6 -0
- package/dist/esm/core/checks/dependencies/npm-audit.js +80 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.js +66 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.js +54 -0
- package/dist/esm/core/checks/findings.d.ts +299 -0
- package/dist/esm/core/checks/findings.js +701 -0
- package/dist/esm/core/checks/git/custom-rules.d.ts +2 -0
- package/dist/esm/core/checks/git/custom-rules.js +106 -0
- package/dist/esm/core/checks/git/diff-smell.d.ts +19 -0
- package/dist/esm/core/checks/git/diff-smell.js +69 -0
- package/dist/esm/core/checks/git/large-files.d.ts +2 -0
- package/dist/esm/core/checks/git/large-files.js +112 -0
- package/dist/esm/core/checks/git/leftover-debug.d.ts +2 -0
- package/dist/esm/core/checks/git/leftover-debug.js +89 -0
- package/dist/esm/core/checks/git/lockfile-drift.d.ts +2 -0
- package/dist/esm/core/checks/git/lockfile-drift.js +114 -0
- package/dist/esm/core/checks/git/merge-conflict.d.ts +2 -0
- package/dist/esm/core/checks/git/merge-conflict.js +117 -0
- package/dist/esm/core/checks/git/missing-tests.d.ts +2 -0
- package/dist/esm/core/checks/git/missing-tests.js +105 -0
- package/dist/esm/core/checks/git/todo-fixme.d.ts +7 -0
- package/dist/esm/core/checks/git/todo-fixme.js +80 -0
- package/dist/esm/core/checks/languages/cpp-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/cpp-format.js +91 -0
- package/dist/esm/core/checks/languages/external-checks.d.ts +77 -0
- package/dist/esm/core/checks/languages/external-checks.js +197 -0
- package/dist/esm/core/checks/languages/external-runner.d.ts +119 -0
- package/dist/esm/core/checks/languages/external-runner.js +138 -0
- package/dist/esm/core/checks/languages/go-format.d.ts +8 -0
- package/dist/{core → esm/core}/checks/languages/go-format.js +29 -35
- package/dist/esm/core/checks/languages/lint.d.ts +2 -0
- package/dist/esm/core/checks/languages/lint.js +92 -0
- package/dist/esm/core/checks/languages/prettier.d.ts +2 -0
- package/dist/esm/core/checks/languages/prettier.js +85 -0
- package/dist/esm/core/checks/languages/python-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/python-format.js +61 -0
- package/dist/esm/core/checks/languages/python-lint.d.ts +9 -0
- package/dist/esm/core/checks/languages/python-lint.js +55 -0
- package/dist/esm/core/checks/languages/python-typecheck.d.ts +14 -0
- package/dist/esm/core/checks/languages/python-typecheck.js +184 -0
- package/dist/esm/core/checks/languages/ruff-shared.d.ts +10 -0
- package/dist/esm/core/checks/languages/ruff-shared.js +35 -0
- package/dist/esm/core/checks/languages/typecheck.d.ts +2 -0
- package/dist/esm/core/checks/languages/typecheck.js +61 -0
- package/dist/esm/core/checks/pr/commitlint.d.ts +2 -0
- package/dist/esm/core/checks/pr/commitlint.js +102 -0
- package/dist/esm/core/checks/pr/pr-body.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-body.js +43 -0
- package/dist/esm/core/checks/pr/pr-size-check.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-size-check.js +42 -0
- package/dist/esm/core/checks/pr/pr-title-lint.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-title-lint.js +31 -0
- package/dist/esm/core/checks/quality/case-collision.d.ts +8 -0
- package/dist/esm/core/checks/quality/case-collision.js +39 -0
- package/dist/esm/core/checks/quality/config-validation.d.ts +11 -0
- package/dist/esm/core/checks/quality/config-validation.js +188 -0
- package/dist/esm/core/checks/quality/coverage.d.ts +2 -0
- package/dist/esm/core/checks/quality/coverage.js +62 -0
- package/dist/esm/core/checks/quality/dead-code.d.ts +2 -0
- package/dist/esm/core/checks/quality/dead-code.js +124 -0
- package/dist/esm/core/checks/quality/duplicate-check.d.ts +2 -0
- package/dist/esm/core/checks/quality/duplicate-check.js +141 -0
- package/dist/esm/core/checks/quality/license-header.d.ts +7 -0
- package/dist/esm/core/checks/quality/license-header.js +81 -0
- package/dist/esm/core/checks/quality/markdown-lint.d.ts +2 -0
- package/dist/esm/core/checks/quality/markdown-lint.js +104 -0
- package/dist/esm/core/checks/quality/package-size.d.ts +36 -0
- package/dist/esm/core/checks/quality/package-size.js +196 -0
- package/dist/esm/core/checks/quality/spellcheck.d.ts +77 -0
- package/dist/esm/core/checks/quality/spellcheck.js +296 -0
- package/dist/esm/core/checks/quality/symlinks.d.ts +16 -0
- package/dist/esm/core/checks/quality/symlinks.js +57 -0
- package/dist/esm/core/checks/quality/yaml-lint.d.ts +20 -0
- package/dist/esm/core/checks/quality/yaml-lint.js +116 -0
- package/dist/esm/core/checks/security/diff-security.d.ts +2 -0
- package/dist/esm/core/checks/security/diff-security.js +354 -0
- package/dist/esm/core/checks/security/dockerfile-security.d.ts +2 -0
- package/dist/esm/core/checks/security/dockerfile-security.js +98 -0
- package/dist/esm/core/checks/security/migration-safety.d.ts +2 -0
- package/dist/esm/core/checks/security/migration-safety.js +137 -0
- package/dist/esm/core/checks/security/security.d.ts +63 -0
- package/dist/esm/core/checks/security/security.js +201 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.d.ts +2 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.js +160 -0
- package/dist/esm/core/checks/security/workflow-security.d.ts +12 -0
- package/dist/esm/core/checks/security/workflow-security.js +100 -0
- package/dist/esm/core/checks/tool-install.d.ts +102 -0
- package/dist/esm/core/checks/tool-install.js +66 -0
- package/dist/esm/core/commands.d.ts +27 -0
- package/dist/esm/core/commands.js +89 -0
- package/dist/esm/core/context.d.ts +62 -0
- package/dist/esm/core/context.js +241 -0
- package/dist/esm/core/index.d.ts +4 -0
- package/dist/esm/core/index.js +4 -0
- package/dist/esm/core/install/cache.d.ts +58 -0
- package/dist/esm/core/install/cache.js +142 -0
- package/dist/esm/core/install/doctor.d.ts +35 -0
- package/dist/esm/core/install/doctor.js +164 -0
- package/dist/esm/core/install/ensure.d.ts +77 -0
- package/dist/esm/core/install/ensure.js +269 -0
- package/dist/esm/core/install/lock.d.ts +34 -0
- package/dist/esm/core/install/lock.js +92 -0
- package/dist/esm/core/install/merge.d.ts +47 -0
- package/dist/esm/core/install/merge.js +85 -0
- package/dist/esm/core/install/prepare.d.ts +76 -0
- package/dist/esm/core/install/prepare.js +142 -0
- package/dist/esm/core/install/profiles.d.ts +78 -0
- package/dist/esm/core/install/profiles.js +192 -0
- package/dist/esm/core/install/reuse.d.ts +41 -0
- package/dist/esm/core/install/reuse.js +100 -0
- package/dist/esm/core/registry.d.ts +6 -0
- package/dist/esm/core/registry.js +109 -0
- package/dist/esm/core/reporters.d.ts +18 -0
- package/dist/esm/core/reporters.js +266 -0
- package/dist/esm/core/run-checks.d.ts +33 -0
- package/dist/esm/core/run-checks.js +293 -0
- package/dist/esm/core/targets.d.ts +140 -0
- package/dist/esm/core/targets.js +213 -0
- package/dist/esm/core/types.d.ts +195 -0
- package/dist/esm/core/types.js +38 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/init.d.ts +38 -0
- package/dist/esm/init.js +421 -0
- package/dist/esm/interfaces/index.d.ts +432 -0
- package/dist/esm/interfaces/index.js +2 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/scripts/copy-configs.d.ts +1 -0
- package/dist/esm/scripts/copy-configs.js +64 -0
- package/dist/esm/scripts/generate-install-manifests.d.ts +39 -0
- package/dist/esm/scripts/generate-install-manifests.js +115 -0
- package/dist/esm/scripts/publish-github.d.ts +1 -0
- package/dist/esm/scripts/publish-github.js +45 -0
- package/dist/esm/utils/ci.d.ts +11 -0
- package/dist/esm/utils/ci.js +40 -0
- package/dist/esm/utils/detect-language.d.ts +48 -0
- package/dist/esm/utils/detect-language.js +234 -0
- package/dist/esm/utils/direct-deps.d.ts +21 -0
- package/dist/esm/utils/direct-deps.js +220 -0
- package/dist/esm/utils/execa.d.ts +22 -0
- package/dist/{utils → esm/utils}/execa.js +1 -4
- package/dist/esm/utils/git.d.ts +14 -0
- package/dist/esm/utils/git.js +21 -0
- package/dist/esm/utils/glob.d.ts +24 -0
- package/dist/esm/utils/glob.js +40 -0
- package/dist/esm/utils/http.d.ts +59 -0
- package/dist/esm/utils/http.js +115 -0
- package/dist/esm/utils/index.d.ts +15 -0
- package/dist/esm/utils/index.js +26 -0
- package/dist/esm/utils/logger.d.ts +65 -0
- package/dist/esm/utils/logger.js +157 -0
- package/dist/esm/utils/own-deps.d.ts +16 -0
- package/dist/esm/utils/own-deps.js +107 -0
- package/dist/esm/utils/package-version.d.ts +4 -0
- package/dist/esm/utils/package-version.js +38 -0
- package/dist/esm/utils/pool.d.ts +49 -0
- package/dist/esm/utils/pool.js +113 -0
- package/dist/esm/utils/resolve-bin.d.ts +67 -0
- package/dist/esm/utils/resolve-bin.js +156 -0
- package/dist/esm/utils/result-collector.d.ts +33 -0
- package/dist/esm/utils/result-collector.js +44 -0
- package/dist/esm/utils/update-notifier.d.ts +19 -0
- package/dist/esm/utils/update-notifier.js +108 -0
- package/install-manifests/core/package-lock.json +4 -4
- package/install-manifests/core/package.json +1 -1
- package/package.json +15 -13
- package/dist/core/checks/languages/lint.d.ts +0 -2
- package/dist/core/index.d.ts +0 -4
- package/dist/core/registry.js +0 -112
- package/dist/index.d.ts +0 -12
- package/dist/utils/index.d.ts +0 -15
- /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
- /package/dist/{config → cjs/config}/constants.d.ts +0 -0
- /package/dist/{config → cjs/config}/constants.js +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow-docker.yml +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow.yml +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.d.ts +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.js +0 -0
- /package/dist/{core → cjs/core}/commands.d.ts +0 -0
- /package/dist/{core → cjs/core}/commands.js +0 -0
- /package/dist/{core → cjs/core}/install/cache.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/lock.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.js +0 -0
- /package/dist/{core → cjs/core}/install/profiles.js +0 -0
- /package/dist/{core → cjs/core}/types.js +0 -0
- /package/dist/{init.d.ts → cjs/init.d.ts} +0 -0
- /package/dist/{interfaces → cjs/interfaces}/index.js +0 -0
- /package/dist/{scripts → cjs/scripts}/copy-configs.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/generate-install-manifests.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/publish-github.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.js +0 -0
- /package/dist/{utils → cjs/utils}/detect-language.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.js +0 -0
- /package/dist/{utils → cjs/utils}/execa.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/git.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.js +0 -0
- /package/dist/{utils → cjs/utils}/http.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.js +0 -0
- /package/dist/{utils → cjs/utils}/package-version.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.js +0 -0
- /package/dist/{utils → cjs/utils}/resolve-bin.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.js +0 -0
- /package/dist/{utils → cjs/utils}/update-notifier.d.ts +0 -0
|
@@ -11,11 +11,11 @@ exports.resolveImports = resolveImports;
|
|
|
11
11
|
exports.dropMissingLanguages = dropMissingLanguages;
|
|
12
12
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
14
|
+
const index_js_1 = require("../../../config/index.js");
|
|
15
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
16
|
+
const index_js_2 = require("../../../utils/index.js");
|
|
17
|
+
const targets_js_1 = require("../../targets.js");
|
|
18
|
+
const types_js_1 = require("../../types.js");
|
|
19
19
|
function loadUserCspellConfig(cwd) {
|
|
20
20
|
const configPath = node_path_1.default.join(cwd, 'pr-checkmate.json');
|
|
21
21
|
if (!node_fs_1.default.existsSync(configPath))
|
|
@@ -24,7 +24,7 @@ function loadUserCspellConfig(cwd) {
|
|
|
24
24
|
return JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8')).cspell || {};
|
|
25
25
|
}
|
|
26
26
|
catch (err) {
|
|
27
|
-
|
|
27
|
+
index_js_2.logger.warn(`[Spellcheck]: ⚠️ Failed to read cspell config: ${err}`);
|
|
28
28
|
return {};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -213,7 +213,7 @@ function resolveFrom(cwd) {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
function createTempCspellConfig(cwd) {
|
|
216
|
-
const packageConfigPath = (0,
|
|
216
|
+
const packageConfigPath = (0, index_js_1.getPackageConfigPath)('cspell.json');
|
|
217
217
|
const packageConfigDir = node_path_1.default.dirname(packageConfigPath);
|
|
218
218
|
const defaultConfig = JSON.parse(node_fs_1.default.readFileSync(packageConfigPath, 'utf-8'));
|
|
219
219
|
const userConfig = loadUserCspellConfig(cwd);
|
|
@@ -222,14 +222,14 @@ function createTempCspellConfig(cwd) {
|
|
|
222
222
|
const { resolved, missing } = resolveImports(merged.import ?? [], packageConfigDir, resolve);
|
|
223
223
|
const available = availableDictionaries(resolve);
|
|
224
224
|
for (const { pkg } of missing) {
|
|
225
|
-
|
|
225
|
+
index_js_2.logger.info(`[Spellcheck]: dictionary ${pkg} is not installed and was skipped. Add it with \`npm i -D ${pkg}\`.`);
|
|
226
226
|
}
|
|
227
227
|
if (available.absent.length > 0) {
|
|
228
228
|
// `info`, not `debug`. A client who installed a dictionary and saw no change
|
|
229
229
|
// had nothing to read: the one line that would have explained it was behind a
|
|
230
230
|
// flag. Which dictionaries are in play decides which findings appear, so it
|
|
231
231
|
// belongs in the ordinary log (ticket 081).
|
|
232
|
-
|
|
232
|
+
index_js_2.logger.info(`[Spellcheck]: optional dictionaries not installed: ${available.absent.join(', ')}. ` +
|
|
233
233
|
`Install any of them to spellcheck that language (\`npm i -D ${available.absent[0]}\`).`);
|
|
234
234
|
}
|
|
235
235
|
// A language the client asked for whose dictionary is absent is dropped rather
|
|
@@ -259,9 +259,9 @@ exports.spellcheckCheck = {
|
|
|
259
259
|
return ctx.config.cspell?.enabled !== false && ctx.config.spellcheck?.enabled !== false;
|
|
260
260
|
},
|
|
261
261
|
async run(ctx) {
|
|
262
|
-
const targets = await (0,
|
|
262
|
+
const targets = await (0, targets_js_1.resolveScopedTargetFiles)(ctx, ['*.ts', '*.tsx', '*.js', '*.jsx', '*.md', '*.mdx', '*.json'], (0, index_js_1.getSourcePaths)(ctx.cwd));
|
|
263
263
|
if (targets === null)
|
|
264
|
-
return (0,
|
|
264
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
265
265
|
// Committed build output and test reports are dropped here, in JS, against
|
|
266
266
|
// repo-RELATIVE paths — a client cannot fix a typo in a generated file, so
|
|
267
267
|
// reporting one is noise that buries the real findings. Neither cspell
|
|
@@ -272,12 +272,12 @@ exports.spellcheckCheck = {
|
|
|
272
272
|
// rule for every repo. `ignoreDirs` already covers plain directory names via
|
|
273
273
|
// `resolveTargetFiles`; this adds the composite globs it cannot express
|
|
274
274
|
// (`**/cypress/videos/**`, `**/jest-html-reporters-*/**`).
|
|
275
|
-
const files = targets.filter(f => !(0,
|
|
275
|
+
const files = targets.filter(f => !(0, index_js_2.matchesAnyGlob)(f, index_js_1.IGNORE_PATTERNS));
|
|
276
276
|
if (files.length === 0)
|
|
277
|
-
return (0,
|
|
278
|
-
const hasLocal = (0,
|
|
277
|
+
return (0, types_js_1.pass)('no files to spellcheck');
|
|
278
|
+
const hasLocal = (0, index_js_1.hasLocalConfig)(['cspell.json', '.cspell.json', 'cspell.config.json'], ctx.cwd);
|
|
279
279
|
let tempConfigPath = null;
|
|
280
|
-
const cspellBin = (0,
|
|
280
|
+
const cspellBin = (0, index_js_2.resolvePackageBin)('cspell', 'bin.mjs');
|
|
281
281
|
// `--no-must-find-files`: cspell exits 1 when it checked nothing, which the
|
|
282
282
|
// exit-code mapping below would report as "spelling issues found" — a warning
|
|
283
283
|
// about problems that do not exist. Every file being excluded is a pass, not a
|
|
@@ -292,16 +292,16 @@ exports.spellcheckCheck = {
|
|
|
292
292
|
args = [...baseArgs, '--config', tempConfigPath];
|
|
293
293
|
}
|
|
294
294
|
try {
|
|
295
|
-
const result = await (0,
|
|
295
|
+
const result = await (0, execa_js_1.execa)(process.execPath, [cspellBin, ...args], {
|
|
296
296
|
cwd: ctx.cwd,
|
|
297
297
|
reject: false,
|
|
298
298
|
stdio: 'inherit',
|
|
299
299
|
});
|
|
300
|
-
return result.exitCode === 0 ? (0,
|
|
300
|
+
return result.exitCode === 0 ? (0, types_js_1.pass)() : (0, types_js_1.warn)('spelling issues found');
|
|
301
301
|
}
|
|
302
302
|
finally {
|
|
303
303
|
if (tempConfigPath)
|
|
304
|
-
(0,
|
|
304
|
+
(0, index_js_2.cleanupTempFile)(tempConfigPath);
|
|
305
305
|
}
|
|
306
306
|
},
|
|
307
307
|
};
|
|
@@ -7,10 +7,10 @@ exports.symlinksCheck = void 0;
|
|
|
7
7
|
exports.isBrokenSymlink = isBrokenSymlink;
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
10
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
11
|
+
const targets_js_1 = require("../../targets.js");
|
|
12
|
+
const types_js_1 = require("../../types.js");
|
|
13
|
+
const findings_js_1 = require("../findings.js");
|
|
14
14
|
/** True when `fullPath` is a symlink whose target does not exist. */
|
|
15
15
|
function isBrokenSymlink(fullPath) {
|
|
16
16
|
let stat;
|
|
@@ -41,7 +41,7 @@ exports.symlinksCheck = {
|
|
|
41
41
|
return ctx.config.symlinks?.enabled !== false;
|
|
42
42
|
},
|
|
43
43
|
async run(ctx) {
|
|
44
|
-
const files = await (0,
|
|
44
|
+
const files = await (0, targets_js_1.resolveTargets)(ctx, ['*'], {
|
|
45
45
|
wholeTree: true,
|
|
46
46
|
onEmpty: { skip: 'no tracked files' },
|
|
47
47
|
});
|
|
@@ -50,14 +50,14 @@ exports.symlinksCheck = {
|
|
|
50
50
|
const ignore = ctx.config.symlinks?.ignore ?? [];
|
|
51
51
|
const broken = [];
|
|
52
52
|
for (const file of files) {
|
|
53
|
-
if (ignore.length > 0 && (0,
|
|
53
|
+
if (ignore.length > 0 && (0, index_js_1.matchesAnyGlob)(file, ignore))
|
|
54
54
|
continue;
|
|
55
55
|
if (isBrokenSymlink(node_path_1.default.join(ctx.cwd, file)))
|
|
56
56
|
broken.push(file);
|
|
57
57
|
}
|
|
58
58
|
if (broken.length === 0)
|
|
59
|
-
return (0,
|
|
60
|
-
const sev = (0,
|
|
59
|
+
return (0, types_js_1.pass)();
|
|
60
|
+
const sev = (0, findings_js_1.severityEmitter)(ctx.config.symlinks?.severity, 'warn');
|
|
61
61
|
broken.forEach(f => sev.log(`[Broken Symlinks]: ${sev.icon} ${f} — target does not exist`));
|
|
62
62
|
return sev.emit(`${broken.length} broken symlink(s)`);
|
|
63
63
|
},
|
|
@@ -8,10 +8,10 @@ exports.isFileDefect = isFileDefect;
|
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const yaml_1 = require("yaml");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
12
|
+
const targets_js_1 = require("../../targets.js");
|
|
13
|
+
const types_js_1 = require("../../types.js");
|
|
14
|
+
const findings_js_1 = require("../findings.js");
|
|
15
15
|
/** First line of a `yaml` error/warning message, stripped of its source excerpt. */
|
|
16
16
|
function shortMessage(message) {
|
|
17
17
|
return message.split('\n')[0].trim();
|
|
@@ -58,17 +58,17 @@ exports.yamlLintCheck = {
|
|
|
58
58
|
async run(ctx) {
|
|
59
59
|
// Keep the CI/workflow dirs that are globally ignored: they hold the very
|
|
60
60
|
// YAML (GitHub Actions, GitLab CI, CircleCI) a YAML linter most needs to see.
|
|
61
|
-
const allTargets = await (0,
|
|
61
|
+
const allTargets = await (0, targets_js_1.resolveTargetFiles)(ctx, ['*.yml', '*.yaml'], {
|
|
62
62
|
keepDirs: ['.github', '.gitlab', '.circleci'],
|
|
63
63
|
});
|
|
64
64
|
if (allTargets === null)
|
|
65
|
-
return (0,
|
|
65
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
66
66
|
if (allTargets.length === 0)
|
|
67
|
-
return (0,
|
|
67
|
+
return (0, types_js_1.skip)('no YAML files');
|
|
68
68
|
const ignore = ctx.config.yamlLint?.ignore ?? [];
|
|
69
|
-
const targets = ignore.length > 0 ? allTargets.filter(f => !(0,
|
|
69
|
+
const targets = ignore.length > 0 ? allTargets.filter(f => !(0, index_js_1.matchesAnyGlob)(f, ignore)) : allTargets;
|
|
70
70
|
if (targets.length === 0)
|
|
71
|
-
return (0,
|
|
71
|
+
return (0, types_js_1.skip)('all YAML files ignored');
|
|
72
72
|
const issues = [];
|
|
73
73
|
for (const file of targets) {
|
|
74
74
|
let source;
|
|
@@ -76,7 +76,7 @@ exports.yamlLintCheck = {
|
|
|
76
76
|
source = node_fs_1.default.readFileSync(node_path_1.default.join(ctx.cwd, file), 'utf-8');
|
|
77
77
|
}
|
|
78
78
|
catch (err) {
|
|
79
|
-
|
|
79
|
+
index_js_1.logger.warn(`[YAML Lint]: ⚠️ Could not read ${file}: ${err}`);
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
82
|
// parseAllDocuments never throws — it collects problems on each document,
|
|
@@ -100,7 +100,7 @@ exports.yamlLintCheck = {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
if (issues.length === 0)
|
|
103
|
-
return (0,
|
|
103
|
+
return (0, types_js_1.pass)();
|
|
104
104
|
// A file that does not parse blocks; a file that parses and merely worries
|
|
105
105
|
// the parser does not. Treating both as blocking is what made this check
|
|
106
106
|
// feel like an obstacle rather than a gate — and a check people switch off
|
|
@@ -109,7 +109,7 @@ exports.yamlLintCheck = {
|
|
|
109
109
|
const broken = issues.filter(i => i.blocking);
|
|
110
110
|
const questionable = issues.filter(i => !i.blocking);
|
|
111
111
|
const describe = (i) => `${i.file}${i.line ? `:${i.line}${i.col ? `:${i.col}` : ''}` : ''} — ${i.message}`;
|
|
112
|
-
const sev = (0,
|
|
112
|
+
const sev = (0, findings_js_1.severityEmitter)(configured, broken.length > 0 ? 'error' : 'warn');
|
|
113
113
|
[...broken, ...questionable]
|
|
114
114
|
.slice(0, 10)
|
|
115
115
|
.forEach(i => sev.log(`[YAML Lint]: ${sev.icon} ${describe(i)}`));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
2
|
export declare const diffSecurityCheck: Check;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.diffSecurityCheck = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const index_js_1 = require("../../../config/index.js");
|
|
5
|
+
const index_js_2 = require("../../../utils/index.js");
|
|
6
|
+
const types_js_1 = require("../../types.js");
|
|
7
|
+
const findings_js_1 = require("../findings.js");
|
|
8
8
|
const MD5_LABEL = 'MD5 (weak hash — use sha256 or stronger)';
|
|
9
9
|
const SHA1_LABEL = 'SHA-1 (weak hash — use sha256 or stronger)';
|
|
10
10
|
const SECURITY_PATTERNS = [
|
|
@@ -262,7 +262,7 @@ function compileExtraPatterns(ctx) {
|
|
|
262
262
|
];
|
|
263
263
|
}
|
|
264
264
|
catch (err) {
|
|
265
|
-
|
|
265
|
+
index_js_2.logger.warn(`[Diff Security]: ⚠️ ignoring extraPattern "${rule.label}" — invalid regex: ${err}`);
|
|
266
266
|
return [];
|
|
267
267
|
}
|
|
268
268
|
});
|
|
@@ -290,21 +290,21 @@ exports.diffSecurityCheck = {
|
|
|
290
290
|
async run(ctx) {
|
|
291
291
|
try {
|
|
292
292
|
const cfg = ctx.config.diffSecurity ?? {};
|
|
293
|
-
const found = (0,
|
|
293
|
+
const found = (0, findings_js_1.emptyBuckets)();
|
|
294
294
|
const scanOpts = {
|
|
295
295
|
comments: cfg.commentHandling ?? 'language',
|
|
296
296
|
// Setting `ignorePaths` REPLACES the test-path defaults rather than adding
|
|
297
297
|
// to them, matching `duplicate.ignore` and `deadCode.ignoreFiles`. A client
|
|
298
298
|
// who wants their tests scanned says so by listing something else here.
|
|
299
|
-
ignorePaths: cfg.ignorePaths ??
|
|
299
|
+
ignorePaths: cfg.ignorePaths ?? index_js_1.DIFF_SECURITY_IGNORE_DEFAULTS,
|
|
300
300
|
// This check owns the cross-line heuristic, so it is the one that turns it
|
|
301
301
|
// on. `0` from the client switches it off.
|
|
302
|
-
dataflowWindow: cfg.dataflowWindow ??
|
|
302
|
+
dataflowWindow: cfg.dataflowWindow ?? findings_js_1.DEFAULT_DATAFLOW_WINDOW,
|
|
303
303
|
};
|
|
304
304
|
const extra = compileExtraPatterns(ctx);
|
|
305
305
|
const disabled = cfg.disablePatterns ?? [];
|
|
306
306
|
const scanInto = (stdout, patterns) => {
|
|
307
|
-
(0,
|
|
307
|
+
(0, findings_js_1.mergeSeverityBuckets)(found, (0, findings_js_1.scanDiffPatterns)(stdout, activePatterns(patterns, disabled), scanOpts));
|
|
308
308
|
};
|
|
309
309
|
/**
|
|
310
310
|
* Feed one language's sources through the patterns, from the diff when
|
|
@@ -317,7 +317,7 @@ exports.diffSecurityCheck = {
|
|
|
317
317
|
* distinction lived in two places, one of them a blocking security check
|
|
318
318
|
* (ticket 079).
|
|
319
319
|
*/
|
|
320
|
-
const review = (globs, patterns) => (0,
|
|
320
|
+
const review = (globs, patterns) => (0, findings_js_1.reviewLines)(ctx, globs, stdout => scanInto(stdout, patterns));
|
|
321
321
|
// JS/TS patterns always run; language-specific sets scan their own globs
|
|
322
322
|
// only when that language is present, so a Python repo gets Python rules.
|
|
323
323
|
// Client `extraPatterns` run against every scanned language, since a
|
|
@@ -340,18 +340,18 @@ exports.diffSecurityCheck = {
|
|
|
340
340
|
// here: three of five language sets scanned, reported as a pass, reads
|
|
341
341
|
// as a clean repository (ticket 072).
|
|
342
342
|
if (!(await review(globs, patterns)))
|
|
343
|
-
return (0,
|
|
343
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
344
344
|
}
|
|
345
|
-
return (0,
|
|
345
|
+
return (0, findings_js_1.reportSeverityBuckets)(found.errors, found.warnings, {
|
|
346
346
|
prefix: 'Diff Security',
|
|
347
347
|
errorSummary: n => `${n} issue(s)`,
|
|
348
348
|
warningSummary: n => `${n} warning(s)`,
|
|
349
|
-
...(0,
|
|
349
|
+
...(0, findings_js_1.clientFindingOptions)(ctx, cfg),
|
|
350
350
|
});
|
|
351
351
|
}
|
|
352
352
|
catch (err) {
|
|
353
|
-
|
|
354
|
-
return (0,
|
|
353
|
+
index_js_2.logger.warn(`[Diff Security]: ⚠️ Could not analyze diff\n${err}`);
|
|
354
|
+
return (0, types_js_1.skip)('diff unavailable');
|
|
355
355
|
}
|
|
356
356
|
},
|
|
357
357
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
2
|
export declare const dockerfileSecurityCheck: Check;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dockerfileSecurityCheck = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
5
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
6
|
+
const targets_js_1 = require("../../targets.js");
|
|
7
|
+
const types_js_1 = require("../../types.js");
|
|
8
|
+
const findings_js_1 = require("../findings.js");
|
|
9
9
|
const DOCKERFILE_GLOBS = ['**/Dockerfile', '**/Dockerfile.*', '**/*.Dockerfile'];
|
|
10
10
|
/** Common Dockerfile security smells, matched on added diff lines. */
|
|
11
11
|
const DOCKER_PATTERNS = [
|
|
@@ -60,42 +60,42 @@ exports.dockerfileSecurityCheck = {
|
|
|
60
60
|
return ctx.config.dockerfileSecurity?.enabled !== false;
|
|
61
61
|
},
|
|
62
62
|
async run(ctx) {
|
|
63
|
-
const files = await (0,
|
|
63
|
+
const files = await (0, targets_js_1.resolveTargetFiles)(ctx, ['*']);
|
|
64
64
|
if (files === null)
|
|
65
|
-
return (0,
|
|
66
|
-
const dockerfiles = files.filter(f => (0,
|
|
65
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
66
|
+
const dockerfiles = files.filter(f => (0, index_js_1.matchesAnyGlob)(f, DOCKERFILE_GLOBS));
|
|
67
67
|
if (dockerfiles.length === 0)
|
|
68
|
-
return (0,
|
|
68
|
+
return (0, types_js_1.pass)();
|
|
69
69
|
try {
|
|
70
70
|
const cfg = ctx.config.dockerfileSecurity ?? {};
|
|
71
71
|
let stdout = '';
|
|
72
72
|
if (ctx.baseSha) {
|
|
73
|
-
stdout = (await (0,
|
|
73
|
+
stdout = (await (0, execa_js_1.execa)('git', ['diff', '--unified=0', ctx.baseSha, ctx.headSha ?? 'HEAD', '--', ...dockerfiles], { cwd: ctx.cwd })).stdout;
|
|
74
74
|
}
|
|
75
75
|
else if (ctx.config.run?.fullScanBehaviour !== 'skip') {
|
|
76
|
-
await (0,
|
|
76
|
+
await (0, findings_js_1.scanTrackedFiles)(ctx, dockerfiles, asDiff => {
|
|
77
77
|
stdout += `${asDiff}\n`;
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
// This check runs `git diff` itself rather than going through
|
|
81
81
|
// `diffAddedLines`, so the `pr-checkmate-ignore` opt-out is applied here.
|
|
82
|
-
const { errors, warnings } = (0,
|
|
82
|
+
const { errors, warnings } = (0, findings_js_1.scanDiffPatterns)(stdout, DOCKER_PATTERNS, {
|
|
83
83
|
skipIgnored: true,
|
|
84
84
|
// Dockerfiles have no extension to key off, and `#` is their comment
|
|
85
85
|
// marker — the `hash` reading, not the language-detected one.
|
|
86
86
|
comments: 'legacy',
|
|
87
87
|
ignorePaths: cfg.ignorePaths,
|
|
88
88
|
});
|
|
89
|
-
return (0,
|
|
89
|
+
return (0, findings_js_1.reportSeverityBuckets)(errors, warnings, {
|
|
90
90
|
prefix: 'Dockerfile Security',
|
|
91
91
|
errorSummary: n => `${n} issue(s)`,
|
|
92
92
|
warningSummary: n => `${n} warning(s)`,
|
|
93
|
-
...(0,
|
|
93
|
+
...(0, findings_js_1.clientFindingOptions)(ctx, cfg),
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
catch (err) {
|
|
97
|
-
|
|
98
|
-
return (0,
|
|
97
|
+
index_js_1.logger.warn(`[Dockerfile Security]: ⚠️ Could not analyze diff\n${err}`);
|
|
98
|
+
return (0, types_js_1.skip)('diff unavailable');
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
2
|
export declare const migrationSafetyCheck: Check;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrationSafetyCheck = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
5
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
6
|
+
const targets_js_1 = require("../../targets.js");
|
|
7
|
+
const types_js_1 = require("../../types.js");
|
|
8
|
+
const findings_js_1 = require("../findings.js");
|
|
9
9
|
/**
|
|
10
10
|
* Paths treated as database migrations. A client overrides via
|
|
11
11
|
* `migrationSafety.paths` (REPLACES this list).
|
|
@@ -69,7 +69,7 @@ function withoutComment(line) {
|
|
|
69
69
|
// after the `+`, where a boundary rule looking for whitespace or line-start
|
|
70
70
|
// does not see it — which is exactly the shape a commented-out statement takes.
|
|
71
71
|
const marker = line.startsWith('+') ? '+' : '';
|
|
72
|
-
const body = (0,
|
|
72
|
+
const body = (0, findings_js_1.stripInlineComment)(line.slice(marker.length), 'hash').replace(/(^|\s)--.*$/, '$1');
|
|
73
73
|
return marker + body;
|
|
74
74
|
}
|
|
75
75
|
/** Bucket dangerous added lines by risk label, honouring the opt-out directive. */
|
|
@@ -102,28 +102,28 @@ exports.migrationSafetyCheck = {
|
|
|
102
102
|
async run(ctx) {
|
|
103
103
|
// Not sourcePath-scoped: migrations commonly live outside `src` (db/, alembic/).
|
|
104
104
|
// ignoreDirs still applies via resolveTargetFiles.
|
|
105
|
-
const files = await (0,
|
|
105
|
+
const files = await (0, targets_js_1.resolveTargetFiles)(ctx, ['*']);
|
|
106
106
|
if (files === null)
|
|
107
|
-
return (0,
|
|
107
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
108
108
|
const globs = ctx.config.migrationSafety?.paths ?? DEFAULT_MIGRATION_GLOBS;
|
|
109
|
-
const migrationFiles = files.filter(f => (0,
|
|
109
|
+
const migrationFiles = files.filter(f => (0, index_js_1.matchesAnyGlob)(f, globs));
|
|
110
110
|
if (migrationFiles.length === 0)
|
|
111
|
-
return (0,
|
|
111
|
+
return (0, types_js_1.pass)();
|
|
112
112
|
try {
|
|
113
113
|
let stdout = '';
|
|
114
114
|
if (ctx.baseSha) {
|
|
115
|
-
stdout = (await (0,
|
|
115
|
+
stdout = (await (0, execa_js_1.execa)('git', ['diff', '--unified=0', ctx.baseSha, ctx.headSha ?? 'HEAD', '--', ...migrationFiles], { cwd: ctx.cwd })).stdout;
|
|
116
116
|
}
|
|
117
117
|
else if (ctx.config.run?.fullScanBehaviour !== 'skip') {
|
|
118
|
-
await (0,
|
|
118
|
+
await (0, findings_js_1.scanTrackedFiles)(ctx, migrationFiles, asDiff => {
|
|
119
119
|
stdout += `${asDiff}\n`;
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
const findings = {};
|
|
123
123
|
scan(stdout, findings);
|
|
124
|
-
if ((0,
|
|
125
|
-
return (0,
|
|
126
|
-
return (0,
|
|
124
|
+
if ((0, findings_js_1.bucketTotal)(findings) === 0)
|
|
125
|
+
return (0, types_js_1.pass)();
|
|
126
|
+
return (0, findings_js_1.reportCountedFindings)(findings, ctx, {
|
|
127
127
|
prefix: 'Migration Safety',
|
|
128
128
|
severity: ctx.config.migrationSafety?.severity,
|
|
129
129
|
sampleLimit: ctx.config.log?.sampleLimit ?? 2,
|
|
@@ -133,8 +133,8 @@ exports.migrationSafetyCheck = {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
catch (err) {
|
|
136
|
-
|
|
137
|
-
return (0,
|
|
136
|
+
index_js_1.logger.warn(`[Migration Safety]: ⚠️ Could not analyze diff\n${err}`);
|
|
137
|
+
return (0, types_js_1.skip)('diff unavailable');
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
};
|
|
@@ -10,10 +10,10 @@ exports.looksLikeCrash = looksLikeCrash;
|
|
|
10
10
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
11
|
const node_os_1 = __importDefault(require("node:os"));
|
|
12
12
|
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
13
|
+
const index_js_1 = require("../../../config/index.js");
|
|
14
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
15
|
+
const index_js_2 = require("../../../utils/index.js");
|
|
16
|
+
const types_js_1 = require("../../types.js");
|
|
17
17
|
/**
|
|
18
18
|
* A HOME the scanner can actually write to.
|
|
19
19
|
*
|
|
@@ -79,7 +79,7 @@ function writableHome() {
|
|
|
79
79
|
const fallback = node_os_1.default.tmpdir();
|
|
80
80
|
try {
|
|
81
81
|
node_fs_1.default.accessSync(fallback, node_fs_1.default.constants.W_OK);
|
|
82
|
-
|
|
82
|
+
index_js_2.logger.info(`[Security Scan]: HOME (${home}) is not writable — caching the scanner in ${fallback}`);
|
|
83
83
|
return fallback;
|
|
84
84
|
}
|
|
85
85
|
catch {
|
|
@@ -120,13 +120,13 @@ exports.securityCheck = {
|
|
|
120
120
|
// tool (knip, license-checker) already skips here; this one did not.
|
|
121
121
|
let gitleaksBin;
|
|
122
122
|
try {
|
|
123
|
-
gitleaksBin = (0,
|
|
123
|
+
gitleaksBin = (0, index_js_2.resolvePackageBin)('gitleaks-secret-scanner-fixed', 'dist/bin/cli.js');
|
|
124
124
|
}
|
|
125
125
|
catch {
|
|
126
|
-
|
|
127
|
-
return (0,
|
|
126
|
+
index_js_2.logger.warn('[Security Scan]: ⚠️ bundled gitleaks scanner could not be resolved — skipping');
|
|
127
|
+
return (0, types_js_1.skip)('gitleaks unavailable');
|
|
128
128
|
}
|
|
129
|
-
const hasClientConfig = (0,
|
|
129
|
+
const hasClientConfig = (0, index_js_1.hasLocalConfig)(['.gitleaks.toml', 'gitleaks.toml', '.gitleaks/config.toml'], ctx.cwd);
|
|
130
130
|
// Pin the gitleaks binary version so the scanner never reaches out to the
|
|
131
131
|
// GitHub API for the "latest" version — that network call adds latency and
|
|
132
132
|
// times out in locked-down/offline CI (the scanner already falls back to
|
|
@@ -145,15 +145,15 @@ exports.securityCheck = {
|
|
|
145
145
|
// after printing `fatal: not a git repository` and "An unexpected error
|
|
146
146
|
// occurred" — alarming output about the tool, for a directory it was never
|
|
147
147
|
// able to review. Every other check skips when git is unusable; so does this.
|
|
148
|
-
if (!isDelta && !(await (0,
|
|
149
|
-
return (0,
|
|
148
|
+
if (!isDelta && !(await (0, index_js_2.resolveGitRef)(ctx.cwd, 'HEAD'))) {
|
|
149
|
+
return (0, types_js_1.skip)('git history unavailable');
|
|
150
150
|
}
|
|
151
151
|
const args = isDelta
|
|
152
152
|
? ['--diff-mode', 'ci']
|
|
153
153
|
: ['--diff-mode', 'history', ...(depth ? ['--depth', String(depth)] : [])];
|
|
154
154
|
args.push('--gitleaks-version', gitleaksVersion);
|
|
155
155
|
if (!hasClientConfig) {
|
|
156
|
-
args.push('--config', (0,
|
|
156
|
+
args.push('--config', (0, index_js_1.getPackageConfigPath)('gitleaks.toml'));
|
|
157
157
|
}
|
|
158
158
|
// A machine-readable copy of the findings, purely so the outcome can carry a
|
|
159
159
|
// number. Written to a temp directory, never into the repository under review:
|
|
@@ -163,10 +163,10 @@ exports.securityCheck = {
|
|
|
163
163
|
const reportDir = node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'pr-checkmate-gitleaks-'));
|
|
164
164
|
const reportPath = node_path_1.default.join(reportDir, 'findings.json');
|
|
165
165
|
args.push('--report-format', 'json', '--report-path', reportPath);
|
|
166
|
-
|
|
166
|
+
index_js_2.logger.info(`[Security Scan]: scanning ${isDelta ? 'the diff range' : `full history${depth ? ` (last ${depth} commits)` : ''}`}`);
|
|
167
167
|
const home = writableHome();
|
|
168
168
|
if (!home)
|
|
169
|
-
return (0,
|
|
169
|
+
return (0, types_js_1.skip)('no writable directory for the scanner cache');
|
|
170
170
|
const env = {
|
|
171
171
|
...process.env,
|
|
172
172
|
HOME: home,
|
|
@@ -176,7 +176,7 @@ exports.securityCheck = {
|
|
|
176
176
|
// stdout stays inherited so the scanner's own report streams to the log as it
|
|
177
177
|
// always has; stderr is captured because it is the only thing that separates
|
|
178
178
|
// a crash from a finding — see `crashed`.
|
|
179
|
-
const result = await (0,
|
|
179
|
+
const result = await (0, execa_js_1.execa)(process.execPath, [gitleaksBin, ...args], {
|
|
180
180
|
cwd: ctx.cwd,
|
|
181
181
|
env,
|
|
182
182
|
stdio: ['ignore', 'inherit', 'pipe'],
|
|
@@ -184,11 +184,11 @@ exports.securityCheck = {
|
|
|
184
184
|
});
|
|
185
185
|
const stderr = String(result.stderr ?? '');
|
|
186
186
|
if (stderr.trim())
|
|
187
|
-
|
|
187
|
+
index_js_2.logger.warn(stderr.trimEnd());
|
|
188
188
|
const found = countFindings(reportPath);
|
|
189
189
|
node_fs_1.default.rmSync(reportDir, { recursive: true, force: true });
|
|
190
190
|
if (result.exitCode === 0)
|
|
191
|
-
return (0,
|
|
191
|
+
return (0, types_js_1.pass)();
|
|
192
192
|
// gitleaks exits 1 specifically when it finds secrets — but so does Node when
|
|
193
193
|
// the wrapper around it throws. Only the second one leaves a stack trace.
|
|
194
194
|
if (result.exitCode === 1 && !looksLikeCrash(stderr)) {
|
|
@@ -198,13 +198,13 @@ exports.securityCheck = {
|
|
|
198
198
|
// nothing else, so a blocking check told the client to open something that
|
|
199
199
|
// does not exist (ticket 085).
|
|
200
200
|
const summary = secretsSummary(found);
|
|
201
|
-
|
|
202
|
-
return (0,
|
|
201
|
+
index_js_2.logger.warn(`⚠️ gitleaks found ${summary} — see the findings above`);
|
|
202
|
+
return (0, types_js_1.fail)(summary);
|
|
203
203
|
}
|
|
204
204
|
const detail = looksLikeCrash(stderr)
|
|
205
205
|
? 'scanner failed to start — nothing was scanned'
|
|
206
206
|
: `scanner error (exit ${result.exitCode})`;
|
|
207
|
-
|
|
208
|
-
return (0,
|
|
207
|
+
index_js_2.logger.warn(`[Security Scan]: ⚠️ ${detail}`);
|
|
208
|
+
return (0, types_js_1.warn)(detail);
|
|
209
209
|
},
|
|
210
210
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
2
|
export declare const sensitiveFileGuardCheck: Check;
|