@eagleoutice/flowr 2.10.9 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -38
- package/abstract-interpretation/absint-visitor.js +6 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/interval-domain.js +1 -1
- package/abstract-interpretation/domains/lattice.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
- package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
- package/abstract-interpretation/domains/singleton-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
- package/abstract-interpretation/unsupported-functions.d.ts +3 -2
- package/abstract-interpretation/unsupported-functions.js +38 -28
- package/cli/benchmark-app.js +2 -1
- package/cli/common/options.d.ts +2 -108
- package/cli/common/options.js +3 -27
- package/cli/common/script.js +3 -2
- package/cli/common/scripts-info.d.ts +2 -123
- package/cli/common/scripts-info.js +0 -17
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +10 -0
- package/cli/flowr.js +48 -11
- package/cli/repl/commands/repl-cfg.js +9 -9
- package/cli/repl/commands/repl-commands.js +5 -0
- package/cli/repl/commands/repl-dataflow.js +31 -24
- package/cli/repl/commands/repl-main.d.ts +6 -0
- package/cli/repl/commands/repl-normalize.js +15 -12
- package/cli/repl/commands/repl-parse.js +1 -1
- package/cli/repl/commands/repl-query.js +4 -5
- package/cli/repl/commands/repl-quit.js +2 -1
- package/cli/repl/core.d.ts +11 -0
- package/cli/repl/core.js +101 -3
- package/cli/repl/execute.js +3 -2
- package/cli/repl/parser/slice-query-parser.d.ts +16 -0
- package/cli/repl/parser/slice-query-parser.js +52 -0
- package/cli/repl/print-version.d.ts +3 -1
- package/cli/repl/print-version.js +21 -2
- package/cli/repl/server/connection.d.ts +3 -0
- package/cli/repl/server/connection.js +65 -31
- package/cli/repl/server/messages/message-analysis.d.ts +10 -0
- package/cli/repl/server/messages/message-analysis.js +6 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/script-core/summarizer-core.js +13 -32
- package/cli/wiki.d.ts +3 -1
- package/cli/wiki.js +6 -1
- package/config.d.ts +22 -10
- package/config.js +33 -7
- package/control-flow/diff-cfg.d.ts +1 -1
- package/control-flow/diff-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/control-flow/simple-visitor.js +6 -5
- package/control-flow/useless-loop.js +2 -2
- package/core/print/dataflow-printer.d.ts +2 -2
- package/core/print/dataflow-printer.js +2 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/dataflow/environments/append.d.ts +2 -2
- package/dataflow/environments/append.js +4 -10
- package/dataflow/environments/apply-kill.d.ts +21 -0
- package/dataflow/environments/apply-kill.js +155 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in.d.ts +4 -0
- package/dataflow/environments/built-in.js +4 -0
- package/dataflow/environments/default-builtin-config.d.ts +183 -67
- package/dataflow/environments/default-builtin-config.js +358 -147
- package/dataflow/environments/environment.d.ts +49 -31
- package/dataflow/environments/environment.js +144 -25
- package/dataflow/environments/identifier.d.ts +65 -2
- package/dataflow/environments/identifier.js +37 -2
- package/dataflow/environments/overwrite.js +2 -10
- package/dataflow/environments/reference-to-maybe.d.ts +2 -0
- package/dataflow/environments/reference-to-maybe.js +56 -11
- package/dataflow/environments/resolve-by-name.d.ts +1 -1
- package/dataflow/environments/resolve-by-name.js +23 -9
- package/dataflow/environments/scoping.d.ts +9 -2
- package/dataflow/environments/scoping.js +15 -2
- package/dataflow/eval/values/general.js +4 -0
- package/dataflow/extractor.js +35 -4
- package/dataflow/graph/df-helper.d.ts +14 -0
- package/dataflow/graph/df-helper.js +41 -0
- package/dataflow/graph/graph.d.ts +4 -1
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/info.d.ts +27 -1
- package/dataflow/internal/linker.d.ts +5 -1
- package/dataflow/internal/linker.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +61 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +132 -25
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +11 -4
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +23 -0
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +1 -1
- package/dataflow/processor.d.ts +6 -0
- package/documentation/data/faq/faqs.d.ts +2 -1
- package/documentation/data/faq/faqs.js +78 -57
- package/documentation/data/interface/doc-writing-code.js +4 -80
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +15 -7
- package/documentation/doc-readme.js +15 -15
- package/documentation/doc-util/doc-cfg.d.ts +3 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +3 -1
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-files.d.ts +3 -1
- package/documentation/doc-util/doc-files.js +9 -6
- package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +2 -1
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -0
- package/documentation/doc-util/doc-structure.js +1 -2
- package/documentation/doc-util/doc-types.d.ts +6 -6
- package/documentation/doc-util/doc-types.js +11 -9
- package/documentation/issue-linting-rule.js +1 -2
- package/documentation/wiki-analyzer.js +9 -9
- package/documentation/wiki-cfg.js +40 -41
- package/documentation/wiki-core.js +121 -32
- package/documentation/wiki-create-linting-rules.d.ts +6 -0
- package/documentation/wiki-create-linting-rules.js +95 -0
- package/documentation/wiki-dataflow-graph.js +112 -77
- package/documentation/wiki-engine.js +1 -2
- package/documentation/wiki-faq.d.ts +2 -1
- package/documentation/wiki-faq.js +4 -4
- package/documentation/wiki-interface.js +22 -8
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linter.js +16 -6
- package/documentation/wiki-linting-and-testing.js +2 -2
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-maker.d.ts +2 -0
- package/documentation/wiki-mk/doc-maker.js +7 -1
- package/documentation/wiki-normalized-ast.js +5 -5
- package/documentation/wiki-onboarding.d.ts +2 -1
- package/documentation/wiki-onboarding.js +5 -5
- package/documentation/wiki-overview.js +4 -17
- package/documentation/wiki-package-database.d.ts +9 -0
- package/documentation/wiki-package-database.js +63 -0
- package/documentation/wiki-query.js +86 -84
- package/documentation/wiki-search.js +4 -5
- package/documentation/wiki-setup.js +6 -7
- package/gas.d.ts +74 -0
- package/gas.js +18 -0
- package/linter/linter-executor.js +2 -8
- package/linter/linter-format.d.ts +4 -11
- package/linter/linter-rules.d.ts +111 -86
- package/linter/linter-rules.js +9 -1
- package/linter/rules/absolute-path.d.ts +2 -7
- package/linter/rules/absolute-path.js +8 -5
- package/linter/rules/dataframe-access-validation.d.ts +1 -6
- package/linter/rules/dataframe-access-validation.js +8 -6
- package/linter/rules/dead-code.d.ts +2 -11
- package/linter/rules/dead-code.js +16 -11
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/file-path-validity.d.ts +1 -6
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.d.ts +7 -11
- package/linter/rules/function-finder-util.js +9 -6
- package/linter/rules/naming-convention.d.ts +2 -7
- package/linter/rules/naming-convention.js +3 -2
- package/linter/rules/network-functions.d.ts +2 -7
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +36 -0
- package/linter/rules/no-leaked-credentials.js +75 -0
- package/linter/rules/problematic-inputs.d.ts +1 -8
- package/linter/rules/problematic-inputs.js +5 -4
- package/linter/rules/roxygen-arguments.d.ts +2 -7
- package/linter/rules/roxygen-arguments.js +13 -20
- package/linter/rules/seeded-randomness.d.ts +2 -7
- package/linter/rules/seeded-randomness.js +7 -4
- package/linter/rules/software-has-license.d.ts +31 -0
- package/linter/rules/software-has-license.js +46 -0
- package/linter/rules/software-has-tests.d.ts +38 -0
- package/linter/rules/software-has-tests.js +48 -0
- package/linter/rules/stop-with-call-arg.d.ts +2 -7
- package/linter/rules/stop-with-call-arg.js +3 -2
- package/linter/rules/undefined-symbol.d.ts +39 -0
- package/linter/rules/undefined-symbol.js +80 -0
- package/linter/rules/unused-definition.d.ts +3 -8
- package/linter/rules/unused-definition.js +7 -5
- package/linter/rules/useless-loop.d.ts +2 -7
- package/linter/rules/useless-loop.js +5 -2
- package/package.json +5 -5
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +9 -1
- package/project/context/flowr-analyzer-context.d.ts +13 -14
- package/project/context/flowr-analyzer-context.js +4 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
- package/project/context/flowr-analyzer-dependencies-context.js +36 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
- package/project/context/flowr-analyzer-environment-context.js +3 -4
- package/project/context/flowr-analyzer-files-context.d.ts +13 -0
- package/project/context/flowr-analyzer-files-context.js +12 -2
- package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
- package/project/context/flowr-analyzer-gas-context.js +101 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/flowr-analyzer-builder.js +3 -0
- package/project/flowr-analyzer.d.ts +2 -1
- package/project/flowr-analyzer.js +3 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
- package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
- package/project/plugins/flowr-analyzer-plugin.js +14 -7
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
- package/project/plugins/package-version-plugins/package.d.ts +3 -0
- package/project/plugins/package-version-plugins/package.js +12 -0
- package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
- package/project/plugins/package-version-plugins/pkgdb.js +370 -0
- package/project/plugins/plugin-registry.d.ts +5 -1
- package/project/plugins/plugin-registry.js +10 -1
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +62 -8
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -2
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
- package/queries/catalog/dice-query/dice-query-executor.js +52 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
- package/queries/catalog/dice-query/dice-query-format.js +102 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
- package/queries/catalog/linter-query/linter-query-executor.js +8 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +1 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query.d.ts +18 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +7 -2
- package/r-bridge/data/data.js +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
- package/r-bridge/parser.js +2 -9
- package/r-bridge/shell.d.ts +8 -1
- package/r-bridge/shell.js +26 -7
- package/search/flowr-search-builder.d.ts +2 -2
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +30 -9
- package/search/flowr-search-filters.js +26 -21
- package/search/search-executor/search-enrichers.d.ts +601 -1
- package/search/search-executor/search-enrichers.js +30 -6
- package/slicing/static/static-slicer.d.ts +39 -11
- package/slicing/static/static-slicer.js +44 -14
- package/util/collections/queue.d.ts +16 -0
- package/util/collections/queue.js +38 -0
- package/util/log.d.ts +1 -1
- package/util/log.js +1 -1
- package/util/mermaid/dfg.d.ts +2 -2
- package/util/mermaid/dfg.js +2 -2
- package/util/mermaid/mermaid.d.ts +4 -0
- package/util/mermaid/mermaid.js +8 -1
- package/util/objects.d.ts +9 -0
- package/util/objects.js +54 -0
- package/util/proc.d.ts +6 -0
- package/util/proc.js +20 -0
- package/util/version.js +10 -2
- package/cli/common/features.d.ts +0 -9
- package/cli/common/features.js +0 -35
- package/cli/script-core/statistics-core.d.ts +0 -6
- package/cli/script-core/statistics-core.js +0 -103
- package/cli/script-core/statistics-helper-core.d.ts +0 -6
- package/cli/script-core/statistics-helper-core.js +0 -85
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -16
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -14
- package/statistics/features/common-syntax-probability.d.ts +0 -38
- package/statistics/features/common-syntax-probability.js +0 -169
- package/statistics/features/feature.d.ts +0 -179
- package/statistics/features/feature.js +0 -38
- package/statistics/features/post-processing.d.ts +0 -18
- package/statistics/features/post-processing.js +0 -26
- package/statistics/features/supported/assignments/assignments.d.ts +0 -12
- package/statistics/features/supported/assignments/assignments.js +0 -56
- package/statistics/features/supported/assignments/post-process.d.ts +0 -6
- package/statistics/features/supported/assignments/post-process.js +0 -126
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -143
- package/statistics/features/supported/comments/post-process.d.ts +0 -6
- package/statistics/features/supported/comments/post-process.js +0 -51
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -69
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
- package/statistics/features/supported/control-flow/post-process.js +0 -66
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -122
- package/statistics/features/supported/data-access/post-process.d.ts +0 -6
- package/statistics/features/supported/data-access/post-process.js +0 -108
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -168
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
- package/statistics/features/supported/expression-list/post-process.js +0 -45
- package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -81
- package/statistics/features/supported/loops/post-process.d.ts +0 -6
- package/statistics/features/supported/loops/post-process.js +0 -73
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -176
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -99
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
- package/statistics/features/supported/used-packages/post-process.js +0 -122
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -140
- package/statistics/features/supported/values/post-process.d.ts +0 -6
- package/statistics/features/supported/values/post-process.js +0 -73
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -111
- package/statistics/features/supported/variables/post-process.d.ts +0 -15
- package/statistics/features/supported/variables/post-process.js +0 -126
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -62
- package/statistics/meta-statistics.d.ts +0 -32
- package/statistics/meta-statistics.js +0 -16
- package/statistics/output/file-provider.d.ts +0 -36
- package/statistics/output/file-provider.js +0 -96
- package/statistics/output/print-stats.d.ts +0 -29
- package/statistics/output/print-stats.js +0 -81
- package/statistics/output/statistics-file.d.ts +0 -36
- package/statistics/output/statistics-file.js +0 -68
- package/statistics/statistics.d.ts +0 -29
- package/statistics/statistics.js +0 -108
- package/statistics/summarizer/auto-detect.d.ts +0 -5
- package/statistics/summarizer/auto-detect.js +0 -34
- package/statistics/summarizer/first-phase/process.d.ts +0 -6
- package/statistics/summarizer/first-phase/process.js +0 -81
- package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
- package/statistics/summarizer/post-process/clusterer.js +0 -40
- package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
- package/statistics/summarizer/post-process/file-based-count.js +0 -47
- package/statistics/summarizer/post-process/histogram.d.ts +0 -57
- package/statistics/summarizer/post-process/histogram.js +0 -126
- package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
- package/statistics/summarizer/post-process/post-process-output.js +0 -102
- package/statistics/summarizer/second-phase/process.d.ts +0 -15
- package/statistics/summarizer/second-phase/process.js +0 -118
- package/statistics/summarizer/summarizer.d.ts +0 -34
- package/statistics/summarizer/summarizer.js +0 -141
package/linter/linter-rules.js
CHANGED
|
@@ -14,6 +14,10 @@ const network_functions_1 = require("./rules/network-functions");
|
|
|
14
14
|
const stop_with_call_arg_1 = require("./rules/stop-with-call-arg");
|
|
15
15
|
const roxygen_arguments_1 = require("./rules/roxygen-arguments");
|
|
16
16
|
const problematic_inputs_1 = require("./rules/problematic-inputs");
|
|
17
|
+
const software_has_license_1 = require("./rules/software-has-license");
|
|
18
|
+
const software_has_tests_1 = require("./rules/software-has-tests");
|
|
19
|
+
const no_leaked_credentials_1 = require("./rules/no-leaked-credentials");
|
|
20
|
+
const undefined_symbol_1 = require("./rules/undefined-symbol");
|
|
17
21
|
/**
|
|
18
22
|
* The registry of currently supported linting rules.
|
|
19
23
|
* A linting rule can be executed on a dataflow pipeline result using {@link executeLintingRule}.
|
|
@@ -31,6 +35,10 @@ exports.LintingRules = {
|
|
|
31
35
|
'useless-loop': useless_loop_1.USELESS_LOOP,
|
|
32
36
|
'problematic-inputs': problematic_inputs_1.PROBLEMATIC_INPUTS,
|
|
33
37
|
'stop-call': stop_with_call_arg_1.STOP_WITH_CALL_ARG,
|
|
34
|
-
'roxygen-arguments': roxygen_arguments_1.ROXYGEN_ARGS
|
|
38
|
+
'roxygen-arguments': roxygen_arguments_1.ROXYGEN_ARGS,
|
|
39
|
+
'software-has-license': software_has_license_1.SOFTWARE_HAS_LICENSE,
|
|
40
|
+
'software-has-tests': software_has_tests_1.SOFTWARE_HAS_TESTS,
|
|
41
|
+
'no-leaked-credentials': no_leaked_credentials_1.NO_LEAKED_CREDENTIALS,
|
|
42
|
+
'undefined-symbol': undefined_symbol_1.UNDEFINED_SYMBOL
|
|
35
43
|
};
|
|
36
44
|
//# sourceMappingURL=linter-rules.js.map
|
|
@@ -35,15 +35,10 @@ export interface AbsoluteFilePathMetadata extends MergeableRecord {
|
|
|
35
35
|
}
|
|
36
36
|
export declare const ABSOLUTE_PATH: {
|
|
37
37
|
readonly createSearch: (config: AbsoluteFilePathConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["unique"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
|
|
38
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: AbsoluteFilePathConfig, data: {
|
|
39
|
-
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
40
|
-
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
41
|
-
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
42
|
-
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
43
|
-
}) => {
|
|
38
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: AbsoluteFilePathConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
44
39
|
results: AbsoluteFilePathResult[];
|
|
45
40
|
".meta": AbsoluteFilePathMetadata;
|
|
46
|
-
}
|
|
41
|
+
}>;
|
|
47
42
|
readonly prettyPrint: {
|
|
48
43
|
readonly query: (result: AbsoluteFilePathResult) => string;
|
|
49
44
|
readonly full: (result: AbsoluteFilePathResult) => string;
|
|
@@ -21,6 +21,7 @@ const dependencies_query_format_1 = require("../../queries/catalog/dependencies-
|
|
|
21
21
|
const resolve_argument_1 = require("../../dataflow/eval/resolve/resolve-argument");
|
|
22
22
|
const path_1 = __importDefault(require("path"));
|
|
23
23
|
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
24
|
+
const other_path_functions_1 = require("../../queries/catalog/dependencies-query/function-info/other-path-functions");
|
|
24
25
|
function inferWd(file, wd) {
|
|
25
26
|
if (wd === '@script') {
|
|
26
27
|
// we can use the script path as the working directory
|
|
@@ -94,7 +95,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
94
95
|
type: 'dependencies',
|
|
95
96
|
// we use the dependencies query to give us all functions that take a file path as input
|
|
96
97
|
ignoreDefaultFunctions: true,
|
|
97
|
-
readFunctions: read_functions_1.ReadFunctions.concat(write_functions_1.WriteFunctions, source_functions_1.SourceFunctions, config.additionalPathFunctions),
|
|
98
|
+
readFunctions: read_functions_1.ReadFunctions.concat(write_functions_1.WriteFunctions, source_functions_1.SourceFunctions, other_path_functions_1.OtherPathFunctions, config.additionalPathFunctions),
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
if (config.include.constructed) {
|
|
@@ -103,13 +104,15 @@ exports.ABSOLUTE_PATH = {
|
|
|
103
104
|
}
|
|
104
105
|
return q.unique();
|
|
105
106
|
},
|
|
106
|
-
processSearchResult: (elements, config, data) => {
|
|
107
|
+
processSearchResult: async (elements, config, data) => {
|
|
107
108
|
const metadata = {
|
|
108
109
|
totalConsidered: 0,
|
|
109
110
|
totalUnknown: 0
|
|
110
111
|
};
|
|
111
112
|
const queryResults = elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData)?.queries;
|
|
112
113
|
const regex = config.absolutePathRegex ? new RegExp(config.absolutePathRegex) : undefined;
|
|
114
|
+
const normalize = await data.normalize();
|
|
115
|
+
const dataflow = await data.dataflow();
|
|
113
116
|
return {
|
|
114
117
|
results: elements.getElements().flatMap(element => {
|
|
115
118
|
metadata.totalConsidered++;
|
|
@@ -139,7 +142,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
139
142
|
if (resolved === undefined || !(0, strings_1.isAbsolutePath)(resolved, regex)) {
|
|
140
143
|
return [];
|
|
141
144
|
}
|
|
142
|
-
const elem =
|
|
145
|
+
const elem = normalize.idMap.get(r.nodeId);
|
|
143
146
|
return [{
|
|
144
147
|
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
145
148
|
filePath: resolved,
|
|
@@ -156,10 +159,10 @@ exports.ABSOLUTE_PATH = {
|
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
else {
|
|
159
|
-
const dfNode =
|
|
162
|
+
const dfNode = dataflow.graph.getVertex(node.info.id);
|
|
160
163
|
if ((0, vertex_1.isFunctionCallVertex)(dfNode)) {
|
|
161
164
|
const handler = dfNode.name ? PathFunctions.get(dfNode.name) : undefined;
|
|
162
|
-
const strings = handler ? handler(
|
|
165
|
+
const strings = handler ? handler(dataflow.graph, dfNode, data.inspectContext()) : [];
|
|
163
166
|
if (strings) {
|
|
164
167
|
return strings.flatMap(s => {
|
|
165
168
|
const resolved = resolvePathForAbsoluteCheck(s, config.ignoreUrls);
|
|
@@ -27,12 +27,7 @@ export interface DataFrameAccessValidationMetadata extends MergeableRecord {
|
|
|
27
27
|
}
|
|
28
28
|
export declare const DATA_FRAME_ACCESS_VALIDATION: {
|
|
29
29
|
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", [], ParentInformation, FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
|
|
30
|
-
readonly processSearchResult: (elements: FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: DataFrameAccessValidationConfig, data: {
|
|
31
|
-
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
32
|
-
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
33
|
-
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
34
|
-
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
35
|
-
}) => Promise<{
|
|
30
|
+
readonly processSearchResult: (elements: FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: DataFrameAccessValidationConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
36
31
|
results: DataFrameAccessValidationResult[];
|
|
37
32
|
'.meta': DataFrameAccessValidationMetadata;
|
|
38
33
|
}>;
|
|
@@ -15,18 +15,20 @@ const linter_tags_1 = require("../linter-tags");
|
|
|
15
15
|
exports.DATA_FRAME_ACCESS_VALIDATION = {
|
|
16
16
|
createSearch: () => flowr_search_builder_1.Q.all(),
|
|
17
17
|
processSearchResult: async (elements, config, data) => {
|
|
18
|
-
|
|
18
|
+
const normalize = await data.normalize();
|
|
19
|
+
const dataflow = await data.dataflow();
|
|
20
|
+
let ctx = data.inspectContext();
|
|
19
21
|
ctx = {
|
|
20
22
|
...ctx,
|
|
21
|
-
config: config_1.FlowrConfig.amend(data.
|
|
23
|
+
config: config_1.FlowrConfig.amend(data.flowrConfig, flowrConfig => {
|
|
22
24
|
if (config.readLoadedData !== undefined) {
|
|
23
25
|
flowrConfig.abstractInterpretation.dataFrame.readLoadedData.readExternalFiles = config.readLoadedData;
|
|
24
26
|
}
|
|
25
27
|
return flowrConfig;
|
|
26
28
|
})
|
|
27
29
|
};
|
|
28
|
-
const cfg = await data.
|
|
29
|
-
const inference = new shape_inference_1.DataFrameShapeInferenceVisitor({ controlFlow: cfg, dfg:
|
|
30
|
+
const cfg = await data.controlflow(undefined, cfg_kind_1.CfgKind.NoFunctionDefs);
|
|
31
|
+
const inference = new shape_inference_1.DataFrameShapeInferenceVisitor({ controlFlow: cfg, dfg: dataflow.graph, normalizedAst: normalize, ctx });
|
|
30
32
|
inference.start();
|
|
31
33
|
const accessOperations = getAccessOperations(elements, inference);
|
|
32
34
|
const accesses = [];
|
|
@@ -59,8 +61,8 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
|
|
|
59
61
|
.map(accessed => ({ nodeId: access.nodeId, operand: access.operand, ...accessed })))
|
|
60
62
|
.map(({ nodeId, operand, ...accessed }) => ({
|
|
61
63
|
...accessed,
|
|
62
|
-
node:
|
|
63
|
-
operand: operand === undefined ? undefined :
|
|
64
|
+
node: normalize.idMap.get(nodeId),
|
|
65
|
+
operand: operand === undefined ? undefined : normalize.idMap.get(operand),
|
|
64
66
|
}))
|
|
65
67
|
.map(({ node, operand, ...accessed }) => ({
|
|
66
68
|
...accessed,
|
|
@@ -10,19 +10,10 @@ export interface DeadCodeConfig extends MergeableRecord {
|
|
|
10
10
|
*/
|
|
11
11
|
simplificationPasses?: CfgSimplificationPassName[];
|
|
12
12
|
}
|
|
13
|
-
export interface DeadCodeMetadata extends MergeableRecord {
|
|
14
|
-
consideredNodes: number;
|
|
15
|
-
}
|
|
16
13
|
export declare const DEAD_CODE: {
|
|
17
|
-
readonly createSearch: (config: DeadCodeConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
18
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: DeadCodeConfig, _data: {
|
|
19
|
-
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
20
|
-
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
21
|
-
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
22
|
-
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
23
|
-
}) => {
|
|
14
|
+
readonly createSearch: (config: DeadCodeConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
15
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: DeadCodeConfig, _data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => {
|
|
24
16
|
results: LintingResult[];
|
|
25
|
-
'.meta': DeadCodeMetadata;
|
|
26
17
|
};
|
|
27
18
|
readonly prettyPrint: {
|
|
28
19
|
readonly query: (result: LintingResult) => string;
|
|
@@ -8,29 +8,34 @@ const linter_tags_1 = require("../linter-tags");
|
|
|
8
8
|
const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
|
|
9
9
|
const assert_1 = require("../../util/assert");
|
|
10
10
|
const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
|
|
11
|
+
const flowr_search_filters_1 = require("../../search/flowr-search-filters");
|
|
11
12
|
exports.DEAD_CODE = {
|
|
12
13
|
createSearch: (config) => flowr_search_builder_1.Q.all().with(search_enrichers_1.Enrichment.CfgInformation, {
|
|
13
14
|
checkReachable: true,
|
|
14
15
|
simplificationPasses: config.simplificationPasses ?? [...cfg_simplification_1.DefaultCfgSimplificationOrder, 'analyze-dead-code']
|
|
15
|
-
})
|
|
16
|
+
}).filter(flowr_search_filters_1.F.not(flowr_search_filters_1.F.or({
|
|
17
|
+
name: flowr_search_filters_1.FlowrFilter.MatchesEnrichment,
|
|
18
|
+
args: {
|
|
19
|
+
enrichment: search_enrichers_1.Enrichment.CfgInformation,
|
|
20
|
+
test: {
|
|
21
|
+
isReachable: true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
name: flowr_search_filters_1.FlowrFilter.RoleInParent,
|
|
26
|
+
args: {
|
|
27
|
+
roleInParent: "el-g" /* RoleInParent.ExpressionListGrouping */
|
|
28
|
+
}
|
|
29
|
+
}))),
|
|
16
30
|
processSearchResult: (elements, _config, _data) => {
|
|
17
|
-
const meta = {
|
|
18
|
-
consideredNodes: 0
|
|
19
|
-
};
|
|
20
31
|
return {
|
|
21
32
|
results: combineResults(elements.getElements()
|
|
22
|
-
.filter(element => {
|
|
23
|
-
meta.consideredNodes++;
|
|
24
|
-
const cfgInformation = (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.CfgInformation);
|
|
25
|
-
return element.node.info.role !== "el-g" /* RoleInParent.ExpressionListGrouping */ && !cfgInformation.isReachable;
|
|
26
|
-
})
|
|
27
33
|
.map(element => ({
|
|
28
34
|
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
29
35
|
involvedId: element.node.info.id,
|
|
30
36
|
loc: range_1.SourceLocation.fromNode(element.node)
|
|
31
37
|
}))
|
|
32
|
-
.filter(element => (0, assert_1.isNotUndefined)(element.loc)))
|
|
33
|
-
'.meta': meta
|
|
38
|
+
.filter(element => (0, assert_1.isNotUndefined)(element.loc)))
|
|
34
39
|
};
|
|
35
40
|
},
|
|
36
41
|
prettyPrint: {
|
|
@@ -3,12 +3,12 @@ import { LintingRuleTag } from '../linter-tags';
|
|
|
3
3
|
import { type FunctionsMetadata, type FunctionsResult, type FunctionsToDetectConfig } from './function-finder-util';
|
|
4
4
|
export declare const DEPRECATED_FUNCTIONS: {
|
|
5
5
|
readonly createSearch: (config: FunctionsToDetectConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with", "filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
6
|
-
readonly processSearchResult: <T extends import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => (T[number] & {
|
|
6
|
+
readonly processSearchResult: <T extends import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(this: void, elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => import("ts-essentials").AsyncOrSync<(T[number] & {
|
|
7
7
|
certainty?: import("../linter-format").LintingResultCertainty;
|
|
8
|
-
})[]) => {
|
|
8
|
+
})[]>) => Promise<{
|
|
9
9
|
results: FunctionsResult[];
|
|
10
10
|
'.meta': FunctionsMetadata;
|
|
11
|
-
}
|
|
11
|
+
}>;
|
|
12
12
|
readonly prettyPrint: {
|
|
13
13
|
query: (result: FunctionsResult) => string;
|
|
14
14
|
full: (result: FunctionsResult) => string;
|
|
@@ -35,12 +35,7 @@ export interface FilePathValidityMetadata extends MergeableRecord {
|
|
|
35
35
|
}
|
|
36
36
|
export declare const FILE_PATH_VALIDITY: {
|
|
37
37
|
readonly createSearch: (config: FilePathValidityConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
38
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: FilePathValidityConfig, data: {
|
|
39
|
-
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
40
|
-
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
41
|
-
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
42
|
-
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
43
|
-
}) => Promise<{
|
|
38
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: FilePathValidityConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
44
39
|
results: FilePathValidityResult[];
|
|
45
40
|
".meta": FilePathValidityMetadata;
|
|
46
41
|
}>;
|
|
@@ -64,9 +64,9 @@ exports.FILE_PATH_VALIDITY = {
|
|
|
64
64
|
// file:// URIs are local paths; resolve and check existence directly
|
|
65
65
|
const localFromFileUrl = (0, strings_1.fileUrlToPath)(matchingRead.value);
|
|
66
66
|
if (localFromFileUrl !== undefined) {
|
|
67
|
-
const paths = (0, built_in_source_1.findSource)(data.
|
|
67
|
+
const paths = (0, built_in_source_1.findSource)(data.flowrConfig.solver.resolveSource, localFromFileUrl, {
|
|
68
68
|
referenceChain: element.node.info.file ? [element.node.info.file] : [],
|
|
69
|
-
ctx: data.
|
|
69
|
+
ctx: data.inspectContext()
|
|
70
70
|
});
|
|
71
71
|
if (paths && paths.length) {
|
|
72
72
|
metadata.totalValid++;
|
|
@@ -97,16 +97,16 @@ exports.FILE_PATH_VALIDITY = {
|
|
|
97
97
|
}];
|
|
98
98
|
}
|
|
99
99
|
// check if any write to the same file happens before the read, and exclude this case if so
|
|
100
|
-
const writesToFile = results.write.filter(r => samePath(r.value, matchingRead.value, data.
|
|
100
|
+
const writesToFile = results.write.filter(r => samePath(r.value, matchingRead.value, data.flowrConfig.solver.resolveSource?.ignoreCapitalization));
|
|
101
101
|
const writesBefore = writesToFile.map(w => (0, happens_before_1.happensBefore)(cfg, w.nodeId, element.node.info.id));
|
|
102
102
|
if (writesBefore.some(w => w === logic_1.Ternary.Always)) {
|
|
103
103
|
metadata.totalWritesBeforeAlways++;
|
|
104
104
|
return [];
|
|
105
105
|
}
|
|
106
106
|
// check if the file exists!
|
|
107
|
-
const paths = (0, built_in_source_1.findSource)(data.
|
|
107
|
+
const paths = (0, built_in_source_1.findSource)(data.flowrConfig.solver.resolveSource, matchingRead.value, {
|
|
108
108
|
referenceChain: element.node.info.file ? [element.node.info.file] : [],
|
|
109
|
-
ctx: data.
|
|
109
|
+
ctx: data.inspectContext()
|
|
110
110
|
});
|
|
111
111
|
if (paths && paths.length) {
|
|
112
112
|
metadata.totalValid++;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type LintingResult, LintingResultCertainty } from '../linter-format';
|
|
2
2
|
import type { FlowrSearchElement, FlowrSearchElements } from '../../search/flowr-search';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { MergeableRecord } from '../../util/objects';
|
|
5
|
-
import type { DataflowInformation } from '../../dataflow/info';
|
|
6
5
|
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
|
|
7
|
-
import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
8
6
|
import { Ternary } from '../../util/logic';
|
|
7
|
+
import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
8
|
+
import type { AsyncOrSync } from 'ts-essentials';
|
|
9
9
|
export interface FunctionsResult extends LintingResult {
|
|
10
10
|
function: string;
|
|
11
11
|
}
|
|
@@ -24,19 +24,15 @@ export interface FunctionsToDetectConfig extends MergeableRecord {
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const functionFinderUtil: {
|
|
26
26
|
createSearch: (functions: readonly string[]) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with", "filter"], ParentInformation, Promise<FlowrSearchElements<ParentInformation, [] | FlowrSearchElement<ParentInformation>[]>>>;
|
|
27
|
-
processSearchResult
|
|
27
|
+
processSearchResult<T extends FlowrSearchElement<ParentInformation>[]>(this: void, elements: FlowrSearchElements<ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => AsyncOrSync<(T[number] & {
|
|
28
28
|
certainty?: LintingResultCertainty;
|
|
29
|
-
})[])
|
|
29
|
+
})[]>): Promise<{
|
|
30
30
|
results: FunctionsResult[];
|
|
31
31
|
'.meta': FunctionsMetadata;
|
|
32
|
-
}
|
|
32
|
+
}>;
|
|
33
33
|
prettyPrint: (functionType: string) => {
|
|
34
34
|
query: (result: FunctionsResult) => string;
|
|
35
35
|
full: (result: FunctionsResult) => string;
|
|
36
36
|
};
|
|
37
|
-
requireArgumentValue(element: FlowrSearchElement<ParentInformation>, pool: ReadonlyMap<string, FunctionInfo>,
|
|
38
|
-
normalize: NormalizedAst;
|
|
39
|
-
dataflow: DataflowInformation;
|
|
40
|
-
analyzer: ReadonlyFlowrAnalysisProvider;
|
|
41
|
-
}, requireValue: RegExp | string | undefined): Ternary;
|
|
37
|
+
requireArgumentValue(element: FlowrSearchElement<ParentInformation>, pool: ReadonlyMap<string, FunctionInfo>, analyzer: ReadonlyFlowrAnalysisProvider, requireValue: RegExp | string | undefined): Promise<Ternary>;
|
|
42
38
|
};
|
|
@@ -22,16 +22,18 @@ exports.functionFinderUtil = {
|
|
|
22
22
|
name: flowr_search_filters_1.FlowrFilter.MatchesEnrichment,
|
|
23
23
|
args: {
|
|
24
24
|
enrichment: search_enrichers_1.Enrichment.CallTargets,
|
|
25
|
-
test:
|
|
25
|
+
test: {
|
|
26
|
+
targets: (0, flowr_search_filters_1.testFunctionsIgnoringPackage)(functions)
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
}));
|
|
28
30
|
},
|
|
29
|
-
processSearchResult
|
|
31
|
+
async processSearchResult(elements, _config, _data, refineSearch = e => e) {
|
|
30
32
|
const metadata = {
|
|
31
33
|
totalCalls: 0,
|
|
32
34
|
totalFunctionDefinitions: 0
|
|
33
35
|
};
|
|
34
|
-
const results = refineSearch(elements.getElements())
|
|
36
|
+
const results = (await refineSearch(elements.getElements()))
|
|
35
37
|
.flatMap(element => {
|
|
36
38
|
metadata.totalCalls++;
|
|
37
39
|
return (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.CallTargets).targets.map(target => {
|
|
@@ -60,15 +62,16 @@ exports.functionFinderUtil = {
|
|
|
60
62
|
[linter_format_1.LintingPrettyPrintContext.Full]: (result) => `Function \`${result.function}\` called at ${range_1.SourceLocation.format(result.loc)} is related to ${functionType}`
|
|
61
63
|
};
|
|
62
64
|
},
|
|
63
|
-
requireArgumentValue(element, pool,
|
|
65
|
+
async requireArgumentValue(element, pool, analyzer, requireValue) {
|
|
64
66
|
const info = pool.get(element.node.lexeme ?? '');
|
|
65
67
|
/* if we have no additional info, we assume they always access the network */
|
|
66
68
|
if (info === undefined) {
|
|
67
69
|
return logic_1.Ternary.Always;
|
|
68
70
|
}
|
|
69
|
-
const
|
|
71
|
+
const dataflow = await analyzer.dataflow();
|
|
72
|
+
const vert = dataflow.graph.getVertex(element.node.info.id);
|
|
70
73
|
if ((0, vertex_1.isFunctionCallVertex)(vert)) {
|
|
71
|
-
const args = (0, resolve_argument_1.getArgumentStringValue)(
|
|
74
|
+
const args = (0, resolve_argument_1.getArgumentStringValue)(analyzer.flowrConfig.solver.variables, dataflow.graph, vert, info.argIdx, info.argName, info.resolveValue, analyzer.inspectContext());
|
|
72
75
|
// we obtain all values, at least one of them has to trigger for the request
|
|
73
76
|
const argValues = args ? args.values().flatMap(s => Array.from(s)).filter(assert_1.isNotUndefined).toArray() : [];
|
|
74
77
|
if (argValues.length === 0) {
|
|
@@ -58,18 +58,13 @@ export declare function fixCasing(identifier: string, convention: CasingConventi
|
|
|
58
58
|
export declare function createNamingConventionQuickFixes(graph: DataflowGraph, nodeId: NodeId, replacement: string, conv: CasingConvention): LintQuickFixReplacement[] | undefined;
|
|
59
59
|
export declare const NAMING_CONVENTION: {
|
|
60
60
|
readonly createSearch: (_config: NamingConventionConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
61
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: NamingConventionConfig, data: {
|
|
62
|
-
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
63
|
-
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
64
|
-
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
65
|
-
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
66
|
-
}) => {
|
|
61
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: NamingConventionConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
67
62
|
results: NamingConventionResult[];
|
|
68
63
|
'.meta': {
|
|
69
64
|
numMatches: number;
|
|
70
65
|
numBreak: number;
|
|
71
66
|
};
|
|
72
|
-
}
|
|
67
|
+
}>;
|
|
73
68
|
readonly prettyPrint: {
|
|
74
69
|
readonly query: (result: NamingConventionResult) => string;
|
|
75
70
|
readonly full: (result: NamingConventionResult) => string;
|
|
@@ -158,7 +158,8 @@ function createNamingConventionQuickFixes(graph, nodeId, replacement, conv) {
|
|
|
158
158
|
}
|
|
159
159
|
exports.NAMING_CONVENTION = {
|
|
160
160
|
createSearch: (_config) => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.VariableDefinition),
|
|
161
|
-
processSearchResult: (elements, config, data) => {
|
|
161
|
+
processSearchResult: async (elements, config, data) => {
|
|
162
|
+
const dataflow = await data.dataflow();
|
|
162
163
|
const symbols = elements.getElements()
|
|
163
164
|
.map(m => ({
|
|
164
165
|
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
@@ -175,7 +176,7 @@ exports.NAMING_CONVENTION = {
|
|
|
175
176
|
return {
|
|
176
177
|
...m,
|
|
177
178
|
involvedId: id,
|
|
178
|
-
quickFix: fix ? createNamingConventionQuickFixes(
|
|
179
|
+
quickFix: fix ? createNamingConventionQuickFixes(dataflow.graph, id, fix, casing) : undefined
|
|
179
180
|
};
|
|
180
181
|
});
|
|
181
182
|
return {
|
|
@@ -12,15 +12,10 @@ export interface NetworkFunctionsConfig extends MergeableRecord {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const NETWORK_FUNCTIONS: {
|
|
14
14
|
readonly createSearch: (config: NetworkFunctionsConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with", "filter"], ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<ParentInformation, [] | FlowrSearchElement<ParentInformation>[]>>>;
|
|
15
|
-
readonly processSearchResult: (e: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, c: NetworkFunctionsConfig, d: {
|
|
16
|
-
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
17
|
-
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
18
|
-
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
19
|
-
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
20
|
-
}) => {
|
|
15
|
+
readonly processSearchResult: (e: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, c: NetworkFunctionsConfig, d: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
21
16
|
results: FunctionsResult[];
|
|
22
17
|
'.meta': FunctionsMetadata;
|
|
23
|
-
}
|
|
18
|
+
}>;
|
|
24
19
|
readonly prettyPrint: {
|
|
25
20
|
query: (result: FunctionsResult) => string;
|
|
26
21
|
full: (result: FunctionsResult) => string;
|
|
@@ -11,19 +11,21 @@ const write_functions_1 = require("../../queries/catalog/dependencies-query/func
|
|
|
11
11
|
const FnPool = new Map(read_functions_1.ReadFunctions.concat(source_functions_1.SourceFunctions, write_functions_1.WriteFunctions).map(f => [f.name, f]));
|
|
12
12
|
exports.NETWORK_FUNCTIONS = {
|
|
13
13
|
createSearch: (config) => function_finder_util_1.functionFinderUtil.createSearch(config.fns),
|
|
14
|
-
processSearchResult: (e, c, d) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
processSearchResult: (e, c, d) => {
|
|
15
|
+
return function_finder_util_1.functionFinderUtil.processSearchResult(e, c, d, async (es) => {
|
|
16
|
+
const res = [];
|
|
17
|
+
for (const e of es) {
|
|
18
|
+
const val = await function_finder_util_1.functionFinderUtil.requireArgumentValue(e, FnPool, d, c.onlyTriggerWithArgument);
|
|
19
|
+
if (val === logic_1.Ternary.Never) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const x = e;
|
|
23
|
+
x.certainty = val === logic_1.Ternary.Always ? linter_format_1.LintingResultCertainty.Certain : linter_format_1.LintingResultCertainty.Uncertain;
|
|
24
|
+
res.push(x);
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
return res;
|
|
26
|
-
}),
|
|
26
|
+
return res;
|
|
27
|
+
});
|
|
28
|
+
},
|
|
27
29
|
prettyPrint: function_finder_util_1.functionFinderUtil.prettyPrint('network operations'),
|
|
28
30
|
info: {
|
|
29
31
|
name: 'Network Functions',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type LintingResult, LintingRuleCertainty } from '../linter-format';
|
|
2
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
3
|
+
import { LintingRuleTag } from '../linter-tags';
|
|
4
|
+
export interface NoLeakedCredentialsResult extends LintingResult {
|
|
5
|
+
readonly variableName: string;
|
|
6
|
+
}
|
|
7
|
+
export interface NoLeakedCredentialsConfig extends MergeableRecord {
|
|
8
|
+
/** Pattern matched (case-insensitively) against variable names to identify potential credential assignments */
|
|
9
|
+
readonly credentialNamePattern: string;
|
|
10
|
+
/** Pattern matched against string literal values to detect known credential formats (e.g., AWS access key IDs, GitHub tokens) */
|
|
11
|
+
readonly credentialValuePattern: string;
|
|
12
|
+
}
|
|
13
|
+
export interface NoLeakedCredentialsMetadata extends MergeableRecord {
|
|
14
|
+
readonly totalChecked: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const NO_LEAKED_CREDENTIALS: {
|
|
17
|
+
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
18
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: NoLeakedCredentialsConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
19
|
+
results: NoLeakedCredentialsResult[];
|
|
20
|
+
".meta": NoLeakedCredentialsMetadata;
|
|
21
|
+
}>;
|
|
22
|
+
readonly prettyPrint: {
|
|
23
|
+
readonly query: (result: NoLeakedCredentialsResult) => string;
|
|
24
|
+
readonly full: (result: NoLeakedCredentialsResult) => string;
|
|
25
|
+
};
|
|
26
|
+
readonly info: {
|
|
27
|
+
readonly name: "No Leaked Credentials";
|
|
28
|
+
readonly description: "Detects hardcoded credentials assigned to variables whose names suggest they hold passwords, tokens, or API keys, or whose values match known credential formats (AWS, GitHub, Slack, Stripe, SSH).";
|
|
29
|
+
readonly tags: readonly [LintingRuleTag.Security, LintingRuleTag.Experimental, LintingRuleTag.Smell];
|
|
30
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
31
|
+
readonly defaultConfig: {
|
|
32
|
+
readonly credentialNamePattern: "(?:password|passwd|pwd|secret|api[_.]?key|api[_.]?token|access[_.]?token|auth[_.]?token|bearer[_.]?token|private[_.]?key|credential)";
|
|
33
|
+
readonly credentialValuePattern: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NO_LEAKED_CREDENTIALS = void 0;
|
|
4
|
+
const linter_format_1 = require("../linter-format");
|
|
5
|
+
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
6
|
+
const range_1 = require("../../util/range");
|
|
7
|
+
const linter_tags_1 = require("../linter-tags");
|
|
8
|
+
const assert_1 = require("../../util/assert");
|
|
9
|
+
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
10
|
+
const edge_1 = require("../../dataflow/graph/edge");
|
|
11
|
+
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
12
|
+
const defaultCredentialNamePattern = '(?:password|passwd|pwd|secret|api[_.]?key|api[_.]?token|access[_.]?token|auth[_.]?token|bearer[_.]?token|private[_.]?key|credential)';
|
|
13
|
+
const defaultCredentialValuePattern = '^(?:AKIA|AIPA|ASIA|AROA)[A-Z0-9]{16}' + // AWS access key IDs (exact 20-char format)
|
|
14
|
+
'|^gh[psoar]_[A-Za-z0-9_]{10,}' + // GitHub Classic/App/OAuth/Actions tokens
|
|
15
|
+
'|^github_pat_[A-Za-z0-9_]{10,}' + // GitHub fine-grained PATs
|
|
16
|
+
'|^glpat-[A-Za-z0-9_-]{20}' + // GitLab Personal Access Tokens (fixed length)
|
|
17
|
+
'|^xox[baprs]-[0-9A-Za-z]{10,}' + // Slack tokens (xoxb-, xoxp-, xoxa-, xoxr-, xoxs-)
|
|
18
|
+
'|^sk_(?:live|test)_[A-Za-z0-9]{24}' + // Stripe secret/test keys (length-anchored)
|
|
19
|
+
'|^rk_live_[A-Za-z0-9]{24}' + // Stripe restricted keys (length-anchored)
|
|
20
|
+
'|^npm_[A-Za-z0-9]{36}' + // npm access tokens (fixed length)
|
|
21
|
+
'|^shp(?:at|ss|pa|ca)_[A-Za-z0-9]{32}' + // Shopify Admin/Shared/Private/Custom tokens
|
|
22
|
+
'|^sk-ant-[A-Za-z0-9_-]{10,}' + // Anthropic API keys
|
|
23
|
+
'|^sk-proj-[A-Za-z0-9_-]{10,}' + // OpenAI project API keys
|
|
24
|
+
'|^SG\\.[A-Za-z0-9_-]{22}\\.' + // SendGrid API keys (structured format)
|
|
25
|
+
'|^-----BEGIN(?:\\s[A-Z]+)* PRIVATE KEY'; // PEM private keys (RSA, EC, DSA, OpenSSH, etc.)
|
|
26
|
+
exports.NO_LEAKED_CREDENTIALS = {
|
|
27
|
+
createSearch: () => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.VariableDefinition),
|
|
28
|
+
processSearchResult: async (elements, config, data) => {
|
|
29
|
+
const namePattern = new RegExp(config.credentialNamePattern, 'i');
|
|
30
|
+
const valuePattern = new RegExp(config.credentialValuePattern);
|
|
31
|
+
const normalize = await data.normalize();
|
|
32
|
+
const dfg = (await data.dataflow()).graph;
|
|
33
|
+
let totalChecked = 0;
|
|
34
|
+
const results = elements.getElements().flatMap(element => {
|
|
35
|
+
totalChecked++;
|
|
36
|
+
const name = element.node.lexeme ?? '';
|
|
37
|
+
const vertex = dfg.getVertex(element.node.info.id);
|
|
38
|
+
if (!(0, vertex_1.isVariableDefinitionVertex)(vertex)) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const nameMatches = namePattern.test(name);
|
|
42
|
+
for (const [targetId, edge] of dfg.outgoingEdges(element.node.info.id) ?? []) {
|
|
43
|
+
if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const targetNode = normalize.idMap.get(targetId);
|
|
47
|
+
if (targetNode && r_string_1.RString.is(targetNode) && (nameMatches || valuePattern.test(targetNode.content.str))) {
|
|
48
|
+
return [{
|
|
49
|
+
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
50
|
+
involvedId: element.node.info.id,
|
|
51
|
+
variableName: name,
|
|
52
|
+
loc: range_1.SourceLocation.fromNode(element.node) ?? range_1.SourceLocation.invalid()
|
|
53
|
+
}];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return [];
|
|
57
|
+
}).filter(assert_1.isNotUndefined);
|
|
58
|
+
return { results, '.meta': { totalChecked } };
|
|
59
|
+
},
|
|
60
|
+
prettyPrint: {
|
|
61
|
+
[linter_format_1.LintingPrettyPrintContext.Query]: (result) => `Possible hardcoded credential in \`${result.variableName}\` at ${range_1.SourceLocation.format(result.loc)}`,
|
|
62
|
+
[linter_format_1.LintingPrettyPrintContext.Full]: (result) => `Variable \`${result.variableName}\` at ${range_1.SourceLocation.format(result.loc)} appears to contain a hardcoded credential`
|
|
63
|
+
},
|
|
64
|
+
info: {
|
|
65
|
+
name: 'No Leaked Credentials',
|
|
66
|
+
description: 'Detects hardcoded credentials assigned to variables whose names suggest they hold passwords, tokens, or API keys, or whose values match known credential formats (AWS, GitHub, Slack, Stripe, SSH).',
|
|
67
|
+
tags: [linter_tags_1.LintingRuleTag.Security, linter_tags_1.LintingRuleTag.Experimental, linter_tags_1.LintingRuleTag.Smell],
|
|
68
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
69
|
+
defaultConfig: {
|
|
70
|
+
credentialNamePattern: defaultCredentialNamePattern,
|
|
71
|
+
credentialValuePattern: defaultCredentialValuePattern
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=no-leaked-credentials.js.map
|
|
@@ -17,17 +17,10 @@ export interface ProblematicInputsConfig extends MergeableRecord {
|
|
|
17
17
|
inputFns?: InputClassifierConfig;
|
|
18
18
|
pipeCommandFunctions?: PipeCommandFunctionSpec | PipeCommandFunctionSpec[];
|
|
19
19
|
}
|
|
20
|
-
export type ProblematicInputsMetadata = MergeableRecord;
|
|
21
20
|
export declare const PROBLEMATIC_INPUTS: {
|
|
22
21
|
readonly createSearch: (config: ProblematicInputsConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
|
|
23
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: ProblematicInputsConfig, data: {
|
|
24
|
-
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
25
|
-
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
26
|
-
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
27
|
-
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
28
|
-
}) => Promise<{
|
|
22
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: ProblematicInputsConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
|
|
29
23
|
results: ProblematicInputsResult[];
|
|
30
|
-
'.meta': {};
|
|
31
24
|
}>;
|
|
32
25
|
readonly prettyPrint: {
|
|
33
26
|
readonly query: (result: ProblematicInputsResult) => string;
|