@fabasoad/sarif-to-slack 1.3.1 → 1.3.3
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/.gitattributes +1 -0
- package/.github/actionlint.yaml +9 -0
- package/.github/workflows/release.yml +19 -9
- package/.github/workflows/send-sarif-to-slack.yml +15 -12
- package/.pre-commit-config.yaml +2 -1
- package/.tool-versions +1 -1
- package/README.md +47 -12
- package/biome.json +5 -52
- package/dist/Logger.js +51 -22
- package/dist/SarifToSlackClient.d.ts +12 -10
- package/dist/SarifToSlackClient.d.ts.map +1 -1
- package/dist/SarifToSlackClient.js +28 -15
- package/dist/index.cjs +603 -237
- package/dist/index.d.ts +1 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/model/Finding.js +4 -3
- package/dist/model/SlackMessage.d.ts +0 -16
- package/dist/model/SlackMessage.d.ts.map +1 -1
- package/dist/model/color/ColorIdentification.js +50 -46
- package/dist/model/color/ColorOptions.d.ts +1 -1
- package/dist/model/color/ColorOptions.d.ts.map +1 -1
- package/dist/representations/CompactGroupByRepresentation.js +2 -2
- package/dist/representations/Representation.js +6 -2
- package/dist/representations/RepresentationFactory.js +19 -1
- package/dist/representations/TableGroupByRunPerLevelRepresentation.d.ts +6 -0
- package/dist/representations/TableGroupByRunPerLevelRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupByRunPerLevelRepresentation.js +8 -0
- package/dist/representations/TableGroupByRunPerSeverityRepresentation.d.ts +6 -0
- package/dist/representations/TableGroupByRunPerSeverityRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupByRunPerSeverityRepresentation.js +8 -0
- package/dist/representations/TableGroupByRunRepresentation.d.ts +7 -0
- package/dist/representations/TableGroupByRunRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupByRunRepresentation.js +7 -0
- package/dist/representations/TableGroupBySarifPerLevelRepresentation.d.ts +6 -0
- package/dist/representations/TableGroupBySarifPerLevelRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupBySarifPerLevelRepresentation.js +8 -0
- package/dist/representations/TableGroupBySarifPerSeverityRepresentation.d.ts +6 -0
- package/dist/representations/TableGroupBySarifPerSeverityRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupBySarifPerSeverityRepresentation.js +8 -0
- package/dist/representations/TableGroupBySarifRepresentation.d.ts +9 -0
- package/dist/representations/TableGroupBySarifRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupBySarifRepresentation.js +15 -0
- package/dist/representations/TableGroupByToolNamePerLevelRepresentation.d.ts +6 -0
- package/dist/representations/TableGroupByToolNamePerLevelRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupByToolNamePerLevelRepresentation.js +8 -0
- package/dist/representations/TableGroupByToolNamePerSeverityRepresentation.d.ts +6 -0
- package/dist/representations/TableGroupByToolNamePerSeverityRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupByToolNamePerSeverityRepresentation.js +8 -0
- package/dist/representations/TableGroupByToolNameRepresentation.d.ts +7 -0
- package/dist/representations/TableGroupByToolNameRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupByToolNameRepresentation.js +7 -0
- package/dist/representations/TableGroupRepresentation.d.ts +16 -0
- package/dist/representations/TableGroupRepresentation.d.ts.map +1 -0
- package/dist/representations/TableGroupRepresentation.js +62 -0
- package/dist/representations/table/Cell.d.ts +10 -0
- package/dist/representations/table/Cell.d.ts.map +1 -0
- package/dist/representations/table/Cell.js +23 -0
- package/dist/representations/table/Column.d.ts +11 -0
- package/dist/representations/table/Column.d.ts.map +1 -0
- package/dist/representations/table/Column.js +31 -0
- package/dist/representations/table/Row.d.ts +15 -0
- package/dist/representations/table/Row.d.ts.map +1 -0
- package/dist/representations/table/Row.js +45 -0
- package/dist/representations/table/Table.d.ts +14 -0
- package/dist/representations/table/Table.d.ts.map +1 -0
- package/dist/representations/table/Table.js +66 -0
- package/dist/sarif-to-slack.d.ts +98 -88
- package/dist/system.d.ts +2 -0
- package/dist/system.d.ts.map +1 -0
- package/dist/system.js +24 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types.d.ts +90 -56
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +89 -42
- package/dist/utils/FileUtils.js +8 -7
- package/dist/utils/StringUtils.d.ts +2 -0
- package/dist/utils/StringUtils.d.ts.map +1 -0
- package/dist/utils/StringUtils.js +5 -0
- package/etc/sarif-to-slack.api.md +8 -36
- package/package.json +10 -10
- package/src/Logger.ts +64 -26
- package/src/SarifToSlackClient.ts +42 -29
- package/src/index.ts +0 -9
- package/src/model/Finding.ts +14 -13
- package/src/model/FindingArray.ts +1 -1
- package/src/model/SlackMessage.ts +5 -5
- package/src/model/color/ColorIdentification.ts +66 -50
- package/src/model/color/ColorOptions.ts +1 -1
- package/src/processors/CodeQLProcessor.ts +1 -1
- package/src/representations/CompactGroupByRepresentation.ts +2 -2
- package/src/representations/CompactGroupByRunRepresentation.ts +2 -2
- package/src/representations/CompactGroupBySarifRepresentation.ts +2 -2
- package/src/representations/CompactGroupByToolNameRepresentation.ts +2 -2
- package/src/representations/CompactTotalRepresentation.ts +1 -1
- package/src/representations/Representation.ts +9 -4
- package/src/representations/RepresentationFactory.ts +26 -2
- package/src/representations/TableGroupByRunPerLevelRepresentation.ts +9 -0
- package/src/representations/TableGroupByRunPerSeverityRepresentation.ts +9 -0
- package/src/representations/TableGroupByRunRepresentation.ts +15 -0
- package/src/representations/TableGroupBySarifPerLevelRepresentation.ts +9 -0
- package/src/representations/TableGroupBySarifPerSeverityRepresentation.ts +9 -0
- package/src/representations/TableGroupBySarifRepresentation.ts +25 -0
- package/src/representations/TableGroupByToolNamePerLevelRepresentation.ts +10 -0
- package/src/representations/TableGroupByToolNamePerSeverityRepresentation.ts +10 -0
- package/src/representations/TableGroupByToolNameRepresentation.ts +15 -0
- package/src/representations/TableGroupRepresentation.ts +78 -0
- package/src/representations/table/Cell.ts +25 -0
- package/src/representations/table/Column.ts +39 -0
- package/src/representations/table/Row.ts +50 -0
- package/src/representations/table/Table.ts +93 -0
- package/src/system.ts +27 -0
- package/src/types.ts +98 -58
- package/src/utils/Comparators.ts +1 -1
- package/src/utils/FileUtils.ts +20 -19
- package/src/utils/StringUtils.ts +7 -0
- package/test-data/sarif/codeql-go.sarif +1 -1
- package/test-data/sarif/runs-1-extensions-1-results-0.sarif +2 -2
- package/test-data/sarif/snyk-hex.sarif +1 -1
- package/tests/integration/SendSarifToSlack.spec.ts +73 -83
- package/tests/representations/table/Table.spec.ts +174 -0
- package/dist/System.d.ts +0 -2
- package/dist/System.d.ts.map +0 -1
- package/dist/System.js +0 -15
- package/src/System.ts +0 -16
- /package/test-data/sarif/{tmp → multiple}/codeql-csharp.sarif +0 -0
- /package/test-data/sarif/{tmp → multiple}/grype-container.sarif +0 -0
- /package/test-data/sarif/{tmp → multiple}/runs-1-tools-1-results-0.sarif +0 -0
- /package/test-data/sarif/{tmp → multiple}/runs-2-tools-2.sarif +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.schemastore.org/sarif-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"CodeQL","organization":"GitHub","semanticVersion":"2.19.0","notifications":[{"id":"go/diagnostics/extraction-errors","name":"go/diagnostics/extraction-errors","shortDescription":{"text":"Extraction errors"},"fullDescription":{"text":"List all extraction errors for files in the source code directory."},"defaultConfiguration":{"enabled":true},"properties":{"description":"List all extraction errors for files in the source code directory.","id":"go/diagnostics/extraction-errors","kind":"diagnostic","name":"Extraction errors"}},{"id":"go/diagnostics/successfully-extracted-files","name":"go/diagnostics/successfully-extracted-files","shortDescription":{"text":"Extracted files"},"fullDescription":{"text":"List all files that were extracted."},"defaultConfiguration":{"enabled":true},"properties":{"tags":["successfully-extracted-files"],"description":"List all files that were extracted.","id":"go/diagnostics/successfully-extracted-files","kind":"diagnostic","name":"Extracted files"}},{"id":"go/baseline/expected-extracted-files","name":"go/baseline/expected-extracted-files","shortDescription":{"text":"Expected extracted files"},"fullDescription":{"text":"Files appearing in the source archive that are expected to be extracted."},"defaultConfiguration":{"enabled":true},"properties":{"tags":["expected-extracted-files","telemetry"]}},{"id":"cli/sip-enablement","name":"cli/sip-enablement","shortDescription":{"text":"macOS SIP enablement status"},"fullDescription":{"text":"macOS SIP enablement status"},"defaultConfiguration":{"enabled":true}}],"rules":[{"id":"go/stack-trace-exposure","name":"go/stack-trace-exposure","shortDescription":{"text":"Information exposure through a stack trace"},"fullDescription":{"text":"Information from a stack trace propagates to an external user. Stack traces can unintentionally reveal implementation details that are useful to an attacker for developing a subsequent exploit."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-209","external/cwe/cwe-497"],"description":"Information from a stack trace propagates to an external user.\n Stack traces can unintentionally reveal implementation details\n that are useful to an attacker for developing a subsequent exploit.","id":"go/stack-trace-exposure","kind":"path-problem","name":"Information exposure through a stack trace","precision":"high","problem.severity":"error","security-severity":"5.4"}},{"id":"go/unvalidated-url-redirection","name":"go/unvalidated-url-redirection","shortDescription":{"text":"Open URL redirect"},"fullDescription":{"text":"Open URL redirection based on unvalidated user input may cause redirection to malicious web sites."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-601"],"description":"Open URL redirection based on unvalidated user input\n may cause redirection to malicious web sites.","id":"go/unvalidated-url-redirection","kind":"path-problem","name":"Open URL redirect","precision":"high","problem.severity":"warning","security-severity":"6.1"}},{"id":"go/bad-redirect-check","name":"go/bad-redirect-check","shortDescription":{"text":"Bad redirect check"},"fullDescription":{"text":"A redirect check that checks for a leading slash but not two leading slashes or a leading slash followed by a backslash is incomplete."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-601"],"description":"A redirect check that checks for a leading slash but not two\n leading slashes or a leading slash followed by a backslash is\n incomplete.","id":"go/bad-redirect-check","kind":"path-problem","name":"Bad redirect check","precision":"high","problem.severity":"error","security-severity":"6.1"}},{"id":"go/weak-crypto-key","name":"go/weak-crypto-key","shortDescription":{"text":"Use of a weak cryptographic key"},"fullDescription":{"text":"Using a weak cryptographic key can allow an attacker to compromise security."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-326"],"description":"Using a weak cryptographic key can allow an attacker to compromise security.","id":"go/weak-crypto-key","kind":"path-problem","name":"Use of a weak cryptographic key","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/insecure-tls","name":"go/insecure-tls","shortDescription":{"text":"Insecure TLS configuration"},"fullDescription":{"text":"If an application supports insecure TLS versions or ciphers, it may be vulnerable to machine-in-the-middle and other attacks."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-327"],"description":"If an application supports insecure TLS versions or ciphers, it may be vulnerable to\n machine-in-the-middle and other attacks.","id":"go/insecure-tls","kind":"path-problem","name":"Insecure TLS configuration","precision":"very-high","problem.severity":"warning","security-severity":"7.5"}},{"id":"go/request-forgery","name":"go/request-forgery","shortDescription":{"text":"Uncontrolled data used in network request"},"fullDescription":{"text":"Sending network requests with user-controlled data allows for request forgery attacks."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-918"],"description":"Sending network requests with user-controlled data allows for request forgery attacks.","id":"go/request-forgery","kind":"path-problem","name":"Uncontrolled data used in network request","precision":"high","problem.severity":"error","security-severity":"9.1"}},{"id":"go/allocation-size-overflow","name":"go/allocation-size-overflow","shortDescription":{"text":"Size computation for allocation may overflow"},"fullDescription":{"text":"When computing the size of an allocation based on the size of a large object, the result may overflow and cause a runtime panic."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-190"],"description":"When computing the size of an allocation based on the size of a large object,\n the result may overflow and cause a runtime panic.","id":"go/allocation-size-overflow","kind":"path-problem","name":"Size computation for allocation may overflow","precision":"high","problem.severity":"warning","security-severity":"8.1"}},{"id":"go/sql-injection","name":"go/sql-injection","shortDescription":{"text":"Database query built from user-controlled sources"},"fullDescription":{"text":"Building a database query from user-controlled sources is vulnerable to insertion of malicious code by the user."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-089"],"description":"Building a database query from user-controlled sources is vulnerable to insertion of\n malicious code by the user.","id":"go/sql-injection","kind":"path-problem","name":"Database query built from user-controlled sources","precision":"high","problem.severity":"error","security-severity":"8.8"}},{"id":"go/unsafe-quoting","name":"go/unsafe-quoting","shortDescription":{"text":"Potentially unsafe quoting"},"fullDescription":{"text":"If a quoted string literal is constructed from data that may itself contain quotes, the embedded data could (accidentally or intentionally) change the structure of the overall string."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-078","external/cwe/cwe-089","external/cwe/cwe-094"],"description":"If a quoted string literal is constructed from data that may itself contain quotes,\n the embedded data could (accidentally or intentionally) change the structure of\n the overall string.","id":"go/unsafe-quoting","kind":"path-problem","name":"Potentially unsafe quoting","precision":"high","problem.severity":"warning","security-severity":"9.3"}},{"id":"go/regex/missing-regexp-anchor","name":"go/regex/missing-regexp-anchor","shortDescription":{"text":"Missing regular expression anchor"},"fullDescription":{"text":"Regular expressions without anchors can be vulnerable to bypassing."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-20"],"description":"Regular expressions without anchors can be vulnerable to bypassing.","id":"go/regex/missing-regexp-anchor","kind":"problem","name":"Missing regular expression anchor","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/incomplete-url-scheme-check","name":"go/incomplete-url-scheme-check","shortDescription":{"text":"Incomplete URL scheme check"},"fullDescription":{"text":"Checking for the \"javascript:\" URL scheme without also checking for \"vbscript:\" and \"data:\" suggests a logic error or even a security vulnerability."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","correctness","external/cwe/cwe-020"],"description":"Checking for the \"javascript:\" URL scheme without also checking for \"vbscript:\"\n and \"data:\" suggests a logic error or even a security vulnerability.","id":"go/incomplete-url-scheme-check","kind":"problem","name":"Incomplete URL scheme check","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/incomplete-hostname-regexp","name":"go/incomplete-hostname-regexp","shortDescription":{"text":"Incomplete regular expression for hostnames"},"fullDescription":{"text":"Matching a URL or hostname against a regular expression that contains an unescaped dot as part of the hostname might match more hostnames than expected."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-20"],"description":"Matching a URL or hostname against a regular expression that contains an unescaped\n dot as part of the hostname might match more hostnames than expected.","id":"go/incomplete-hostname-regexp","kind":"path-problem","name":"Incomplete regular expression for hostnames","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/suspicious-character-in-regex","name":"go/suspicious-character-in-regex","shortDescription":{"text":"Suspicious characters in a regular expression"},"fullDescription":{"text":"If a literal bell character or backspace appears in a regular expression, the start of text or word boundary may have been intended."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-20"],"description":"If a literal bell character or backspace appears in a regular expression, the start of text or word boundary may have been intended.","id":"go/suspicious-character-in-regex","kind":"path-problem","name":"Suspicious characters in a regular expression","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/email-injection","name":"go/email-injection","shortDescription":{"text":"Email content injection"},"fullDescription":{"text":"Incorporating untrusted input directly into an email message can enable content spoofing, which in turn may lead to information leaks and other security issues."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-640"],"description":"Incorporating untrusted input directly into an email message can enable\n content spoofing, which in turn may lead to information leaks and other\n security issues.","id":"go/email-injection","kind":"path-problem","name":"Email content injection","precision":"high","problem.severity":"error","security-severity":"9.8"}},{"id":"go/disabled-certificate-check","name":"go/disabled-certificate-check","shortDescription":{"text":"Disabled TLS certificate check"},"fullDescription":{"text":"If an application disables TLS certificate checking, it may be vulnerable to man-in-the-middle attacks."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-295"],"description":"If an application disables TLS certificate checking, it may be vulnerable to\n man-in-the-middle attacks.","id":"go/disabled-certificate-check","kind":"problem","name":"Disabled TLS certificate check","precision":"high","problem.severity":"warning","security-severity":"7.5"}},{"id":"go/missing-jwt-signature-check","name":"go/missing-jwt-signature-check","shortDescription":{"text":"Missing JWT signature check"},"fullDescription":{"text":"Failing to check the JSON Web Token (JWT) signature may allow an attacker to forge their own tokens."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-347"],"description":"Failing to check the JSON Web Token (JWT) signature may allow an attacker to forge their own tokens.","id":"go/missing-jwt-signature-check","kind":"path-problem","name":"Missing JWT signature check","precision":"high","problem.severity":"error","security-severity":"7.8"}},{"id":"go/uncontrolled-allocation-size","name":"go/uncontrolled-allocation-size","shortDescription":{"text":"Slice memory allocation with excessive size value"},"fullDescription":{"text":"Allocating memory for slices with the built-in make function from user-controlled sources can lead to a denial of service."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-770"],"description":"Allocating memory for slices with the built-in make function from user-controlled sources can lead to a denial of service.","id":"go/uncontrolled-allocation-size","kind":"path-problem","name":"Slice memory allocation with excessive size value","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/insecure-hostkeycallback","name":"go/insecure-hostkeycallback","shortDescription":{"text":"Use of insecure HostKeyCallback implementation"},"fullDescription":{"text":"Detects insecure SSL client configurations with an implementation of the `HostKeyCallback` that accepts all host keys."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-322"],"description":"Detects insecure SSL client configurations with an implementation of the `HostKeyCallback` that accepts all host keys.","id":"go/insecure-hostkeycallback","kind":"path-problem","name":"Use of insecure HostKeyCallback implementation","precision":"high","problem.severity":"warning","security-severity":"8.2"}},{"id":"go/clear-text-logging","name":"go/clear-text-logging","shortDescription":{"text":"Clear-text logging of sensitive information"},"fullDescription":{"text":"Logging sensitive information without encryption or hashing can expose it to an attacker."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-312","external/cwe/cwe-315","external/cwe/cwe-359"],"description":"Logging sensitive information without encryption or hashing can\n expose it to an attacker.","id":"go/clear-text-logging","kind":"path-problem","name":"Clear-text logging of sensitive information","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/constant-oauth2-state","name":"go/constant-oauth2-state","shortDescription":{"text":"Use of constant `state` value in OAuth 2.0 URL"},"fullDescription":{"text":"Using a constant value for the `state` in the OAuth 2.0 URL makes the application susceptible to CSRF attacks."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-352"],"description":"Using a constant value for the `state` in the OAuth 2.0 URL makes the application\n susceptible to CSRF attacks.","id":"go/constant-oauth2-state","kind":"path-problem","name":"Use of constant `state` value in OAuth 2.0 URL","precision":"high","problem.severity":"error","security-severity":"8.8"}},{"id":"go/insecure-randomness","name":"go/insecure-randomness","shortDescription":{"text":"Use of insufficient randomness as the key of a cryptographic algorithm"},"fullDescription":{"text":"Using insufficient randomness as the key of a cryptographic algorithm can allow an attacker to compromise security."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-338"],"description":"Using insufficient randomness as the key of a cryptographic algorithm can allow an attacker to compromise security.","id":"go/insecure-randomness","kind":"path-problem","name":"Use of insufficient randomness as the key of a cryptographic algorithm","precision":"high","problem.severity":"error","security-severity":"7.8"}},{"id":"go/unsafe-unzip-symlink","name":"go/unsafe-unzip-symlink","shortDescription":{"text":"Arbitrary file write extracting an archive containing symbolic links"},"fullDescription":{"text":"Extracting files from a malicious zip archive without validating that the destination file path is within the destination directory can cause files outside the destination directory to be overwritten. Extracting symbolic links in particular requires resolving previously extracted links to ensure the destination directory is not escaped."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-022"],"description":"Extracting files from a malicious zip archive without validating that the\n destination file path is within the destination directory can cause files outside\n the destination directory to be overwritten. Extracting symbolic links in particular\n requires resolving previously extracted links to ensure the destination directory\n is not escaped.","id":"go/unsafe-unzip-symlink","kind":"path-problem","name":"Arbitrary file write extracting an archive containing symbolic links","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/zipslip","name":"go/zipslip","shortDescription":{"text":"Arbitrary file access during archive extraction (\"Zip Slip\")"},"fullDescription":{"text":"Extracting files from a malicious ZIP file, or similar type of archive, without validating that the destination file path is within the destination directory can allow an attacker to unexpectedly gain access to resources."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-022"],"description":"Extracting files from a malicious ZIP file, or similar type of archive, without\n validating that the destination file path is within the destination directory\n can allow an attacker to unexpectedly gain access to resources.","id":"go/zipslip","kind":"path-problem","name":"Arbitrary file access during archive extraction (\"Zip Slip\")","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/path-injection","name":"go/path-injection","shortDescription":{"text":"Uncontrolled data used in path expression"},"fullDescription":{"text":"Accessing paths influenced by users can allow an attacker to access unexpected resources."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-022","external/cwe/cwe-023","external/cwe/cwe-036","external/cwe/cwe-073","external/cwe/cwe-099"],"description":"Accessing paths influenced by users can allow an attacker to access\n unexpected resources.","id":"go/path-injection","kind":"path-problem","name":"Uncontrolled data used in path expression","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/command-injection","name":"go/command-injection","shortDescription":{"text":"Command built from user-controlled sources"},"fullDescription":{"text":"Building a system command from user-controlled sources is vulnerable to insertion of malicious code by the user."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-078"],"description":"Building a system command from user-controlled sources is vulnerable to insertion of\n malicious code by the user.","id":"go/command-injection","kind":"path-problem","name":"Command built from user-controlled sources","precision":"high","problem.severity":"error","security-severity":"9.8"}},{"id":"go/incorrect-integer-conversion","name":"go/incorrect-integer-conversion","shortDescription":{"text":"Incorrect conversion between integer types"},"fullDescription":{"text":"Converting the result of `strconv.Atoi`, `strconv.ParseInt`, and `strconv.ParseUint` to integer types of smaller bit size can produce unexpected values."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-190","external/cwe/cwe-681"],"description":"Converting the result of `strconv.Atoi`, `strconv.ParseInt`,\n and `strconv.ParseUint` to integer types of smaller bit size\n can produce unexpected values.","id":"go/incorrect-integer-conversion","kind":"path-problem","name":"Incorrect conversion between integer types","precision":"very-high","problem.severity":"warning","security-severity":"8.1"}},{"id":"go/xml/xpath-injection","name":"go/xml/xpath-injection","shortDescription":{"text":"XPath injection"},"fullDescription":{"text":"Building an XPath expression from user-controlled sources is vulnerable to insertion of malicious code by the user."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-643"],"description":"Building an XPath expression from user-controlled sources is vulnerable to insertion of\n malicious code by the user.","id":"go/xml/xpath-injection","kind":"path-problem","name":"XPath injection","precision":"high","problem.severity":"error","security-severity":"9.8"}},{"id":"go/reflected-xss","name":"go/reflected-xss","shortDescription":{"text":"Reflected cross-site scripting"},"fullDescription":{"text":"Writing user input directly to an HTTP response allows for a cross-site scripting vulnerability."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-079","external/cwe/cwe-116"],"description":"Writing user input directly to an HTTP response allows for\n a cross-site scripting vulnerability.","id":"go/reflected-xss","kind":"path-problem","name":"Reflected cross-site scripting","precision":"high","problem.severity":"error","security-severity":"6.1"}},{"id":"go/summary/lines-of-code","name":"go/summary/lines-of-code","shortDescription":{"text":"Total lines of Go code in the database"},"fullDescription":{"text":"The total number of lines of Go code across all extracted files, including auto-generated files. This is a useful metric of the size of a database. For all files that were seen during the build, this query counts the lines of code, excluding whitespace or comments."},"defaultConfiguration":{"enabled":true},"properties":{"tags":["summary","lines-of-code","debug"],"description":"The total number of lines of Go code across all extracted files, including auto-generated files. This is a useful metric of the size of a database. For all files that were seen during the build, this query counts the lines of code, excluding whitespace or comments.","id":"go/summary/lines-of-code","kind":"metric","name":"Total lines of Go code in the database"}}]},"extensions":[{"name":"codeql/go-queries","semanticVersion":"1.0.8+e99d7db428fc3981c9a1f03f03a024ac40e52f54","locations":[{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/go-all","semanticVersion":"2.0.0+e99d7db428fc3981c9a1f03f03a024ac40e52f54","taxa":[{"id":"ext/net.http.model.yml/2/15","properties":{"CodeQL/DataExtensionLocation":{"artifactLocation":{"uri":"ext/net.http.model.yml"},"region":{"startLine":55,"startColumn":9,"endLine":55,"endColumn":9}}}},{"id":"ext/net.url.model.yml/0/15","properties":{"CodeQL/DataExtensionLocation":{"artifactLocation":{"uri":"ext/net.url.model.yml"},"region":{"startLine":21,"startColumn":9,"endLine":21,"endColumn":9}}}},{"id":"ext/net.url.model.yml/0/22","properties":{"CodeQL/DataExtensionLocation":{"artifactLocation":{"uri":"ext/net.url.model.yml"},"region":{"startLine":28,"startColumn":9,"endLine":28,"endColumn":9}}}}],"locations":[{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/go-all/2.0.0/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/go-all/2.0.0/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/threat-models","semanticVersion":"1.0.8+e99d7db428fc3981c9a1f03f03a024ac40e52f54","locations":[{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/threat-models/1.0.8/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/threat-models/1.0.8/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]}]},"invocations":[{"toolExecutionNotifications":[{"message":{"text":"Extraction failed with error This application uses version go1.23 of the source-processing packages but runs version go1.24 of 'go list'. It may fail to process source files that rely on newer language features. If so, rebuild the application using a newer version of Go."},"level":"error","descriptor":{"id":"go/diagnostics/extraction-errors","index":0},"properties":{"formattedMessage":{"text":"Extraction failed with error This application uses version go1.23 of the source-processing packages but runs version go1.24 of 'go list'. It may fail to process source files that rely on newer language features. If so, rebuild the application using a newer version of Go."}}},{"message":{"text":"Extraction failed in main.go with error package requires newer Go version go1.24 (application built with go1.23)"},"level":"error","descriptor":{"id":"go/diagnostics/extraction-errors","index":0},"properties":{"formattedMessage":{"text":"Extraction failed in main.go with error package requires newer Go version go1.24 (application built with go1.23)"}}},{"locations":[{"physicalLocation":{"artifactLocation":{"uri":"go.mod","uriBaseId":"%SRCROOT%","index":1}}}],"message":{"text":""},"level":"none","descriptor":{"id":"go/diagnostics/successfully-extracted-files","index":1},"properties":{"formattedMessage":{"text":""}}},{"locations":[{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0}}}],"message":{"text":""},"level":"none","descriptor":{"id":"go/diagnostics/successfully-extracted-files","index":1},"properties":{"formattedMessage":{"text":""}}},{"locations":[{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0}}}],"message":{"text":""},"level":"none","descriptor":{"id":"go/baseline/expected-extracted-files","index":2},"properties":{"formattedMessage":{"text":""}}},{"message":{"text":""},"level":"note","timeUtc":"2025-05-09T07:59:00.815+00:00","descriptor":{"id":"cli/sip-enablement","index":3},"properties":{"attributes":{"isEnabled":true},"visibility":{"statusPage":false,"telemetry":true}}}],"executionSuccessful":true}],"artifacts":[{"location":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0}},{"location":{"uri":"go.mod","uriBaseId":"%SRCROOT%","index":1}}],"results":[{"ruleId":"go/command-injection","ruleIndex":24,"rule":{"id":"go/command-injection","index":24},"message":{"text":"This command depends on a [user-provided value](1)."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":58}}}],"partialFingerprints":{"primaryLocationLineHash":"e9584120171099c2:1","primaryLocationStartColumnFingerprint":"32"},"codeFlows":[{"threadFlows":[{"locations":[{"location":{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":39}},"message":{"text":"selection of URL"}},"taxa":[{"index":0,"toolComponent":{"index":1},"properties":{"CodeQL/DataflowRole":"source"}}]},{"location":{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":47}},"message":{"text":"call to Query"}},"taxa":[{"index":1,"toolComponent":{"index":1},"properties":{"CodeQL/DataflowRole":"step"}}]},{"location":{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":58}},"message":{"text":"call to Get"}},"taxa":[{"index":2,"toolComponent":{"index":1},"properties":{"CodeQL/DataflowRole":"step"}}]}]}]}],"relatedLocations":[{"id":1,"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":39}},"message":{"text":"user-provided value"}}]}],"columnKind":"utf16CodeUnits","properties":{"semmle.formatSpecifier":"sarifv2.1.0","metricResults":[{"rule":{"id":"go/summary/lines-of-code","index":28},"ruleId":"go/summary/lines-of-code","ruleIndex":28,"value":14,"baseline":14}]}}]}
|
|
1
|
+
{"$schema":"https://json.schemastore.org/sarif-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"sectools sast","organization":"GitHub","semanticVersion":"2.19.0","notifications":[{"id":"go/diagnostics/extraction-errors","name":"go/diagnostics/extraction-errors","shortDescription":{"text":"Extraction errors"},"fullDescription":{"text":"List all extraction errors for files in the source code directory."},"defaultConfiguration":{"enabled":true},"properties":{"description":"List all extraction errors for files in the source code directory.","id":"go/diagnostics/extraction-errors","kind":"diagnostic","name":"Extraction errors"}},{"id":"go/diagnostics/successfully-extracted-files","name":"go/diagnostics/successfully-extracted-files","shortDescription":{"text":"Extracted files"},"fullDescription":{"text":"List all files that were extracted."},"defaultConfiguration":{"enabled":true},"properties":{"tags":["successfully-extracted-files"],"description":"List all files that were extracted.","id":"go/diagnostics/successfully-extracted-files","kind":"diagnostic","name":"Extracted files"}},{"id":"go/baseline/expected-extracted-files","name":"go/baseline/expected-extracted-files","shortDescription":{"text":"Expected extracted files"},"fullDescription":{"text":"Files appearing in the source archive that are expected to be extracted."},"defaultConfiguration":{"enabled":true},"properties":{"tags":["expected-extracted-files","telemetry"]}},{"id":"cli/sip-enablement","name":"cli/sip-enablement","shortDescription":{"text":"macOS SIP enablement status"},"fullDescription":{"text":"macOS SIP enablement status"},"defaultConfiguration":{"enabled":true}}],"rules":[{"id":"go/stack-trace-exposure","name":"go/stack-trace-exposure","shortDescription":{"text":"Information exposure through a stack trace"},"fullDescription":{"text":"Information from a stack trace propagates to an external user. Stack traces can unintentionally reveal implementation details that are useful to an attacker for developing a subsequent exploit."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-209","external/cwe/cwe-497"],"description":"Information from a stack trace propagates to an external user.\n Stack traces can unintentionally reveal implementation details\n that are useful to an attacker for developing a subsequent exploit.","id":"go/stack-trace-exposure","kind":"path-problem","name":"Information exposure through a stack trace","precision":"high","problem.severity":"error","security-severity":"5.4"}},{"id":"go/unvalidated-url-redirection","name":"go/unvalidated-url-redirection","shortDescription":{"text":"Open URL redirect"},"fullDescription":{"text":"Open URL redirection based on unvalidated user input may cause redirection to malicious web sites."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-601"],"description":"Open URL redirection based on unvalidated user input\n may cause redirection to malicious web sites.","id":"go/unvalidated-url-redirection","kind":"path-problem","name":"Open URL redirect","precision":"high","problem.severity":"warning","security-severity":"6.1"}},{"id":"go/bad-redirect-check","name":"go/bad-redirect-check","shortDescription":{"text":"Bad redirect check"},"fullDescription":{"text":"A redirect check that checks for a leading slash but not two leading slashes or a leading slash followed by a backslash is incomplete."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-601"],"description":"A redirect check that checks for a leading slash but not two\n leading slashes or a leading slash followed by a backslash is\n incomplete.","id":"go/bad-redirect-check","kind":"path-problem","name":"Bad redirect check","precision":"high","problem.severity":"error","security-severity":"6.1"}},{"id":"go/weak-crypto-key","name":"go/weak-crypto-key","shortDescription":{"text":"Use of a weak cryptographic key"},"fullDescription":{"text":"Using a weak cryptographic key can allow an attacker to compromise security."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-326"],"description":"Using a weak cryptographic key can allow an attacker to compromise security.","id":"go/weak-crypto-key","kind":"path-problem","name":"Use of a weak cryptographic key","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/insecure-tls","name":"go/insecure-tls","shortDescription":{"text":"Insecure TLS configuration"},"fullDescription":{"text":"If an application supports insecure TLS versions or ciphers, it may be vulnerable to machine-in-the-middle and other attacks."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-327"],"description":"If an application supports insecure TLS versions or ciphers, it may be vulnerable to\n machine-in-the-middle and other attacks.","id":"go/insecure-tls","kind":"path-problem","name":"Insecure TLS configuration","precision":"very-high","problem.severity":"warning","security-severity":"7.5"}},{"id":"go/request-forgery","name":"go/request-forgery","shortDescription":{"text":"Uncontrolled data used in network request"},"fullDescription":{"text":"Sending network requests with user-controlled data allows for request forgery attacks."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-918"],"description":"Sending network requests with user-controlled data allows for request forgery attacks.","id":"go/request-forgery","kind":"path-problem","name":"Uncontrolled data used in network request","precision":"high","problem.severity":"error","security-severity":"9.1"}},{"id":"go/allocation-size-overflow","name":"go/allocation-size-overflow","shortDescription":{"text":"Size computation for allocation may overflow"},"fullDescription":{"text":"When computing the size of an allocation based on the size of a large object, the result may overflow and cause a runtime panic."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-190"],"description":"When computing the size of an allocation based on the size of a large object,\n the result may overflow and cause a runtime panic.","id":"go/allocation-size-overflow","kind":"path-problem","name":"Size computation for allocation may overflow","precision":"high","problem.severity":"warning","security-severity":"8.1"}},{"id":"go/sql-injection","name":"go/sql-injection","shortDescription":{"text":"Database query built from user-controlled sources"},"fullDescription":{"text":"Building a database query from user-controlled sources is vulnerable to insertion of malicious code by the user."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-089"],"description":"Building a database query from user-controlled sources is vulnerable to insertion of\n malicious code by the user.","id":"go/sql-injection","kind":"path-problem","name":"Database query built from user-controlled sources","precision":"high","problem.severity":"error","security-severity":"8.8"}},{"id":"go/unsafe-quoting","name":"go/unsafe-quoting","shortDescription":{"text":"Potentially unsafe quoting"},"fullDescription":{"text":"If a quoted string literal is constructed from data that may itself contain quotes, the embedded data could (accidentally or intentionally) change the structure of the overall string."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-078","external/cwe/cwe-089","external/cwe/cwe-094"],"description":"If a quoted string literal is constructed from data that may itself contain quotes,\n the embedded data could (accidentally or intentionally) change the structure of\n the overall string.","id":"go/unsafe-quoting","kind":"path-problem","name":"Potentially unsafe quoting","precision":"high","problem.severity":"warning","security-severity":"9.3"}},{"id":"go/regex/missing-regexp-anchor","name":"go/regex/missing-regexp-anchor","shortDescription":{"text":"Missing regular expression anchor"},"fullDescription":{"text":"Regular expressions without anchors can be vulnerable to bypassing."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-20"],"description":"Regular expressions without anchors can be vulnerable to bypassing.","id":"go/regex/missing-regexp-anchor","kind":"problem","name":"Missing regular expression anchor","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/incomplete-url-scheme-check","name":"go/incomplete-url-scheme-check","shortDescription":{"text":"Incomplete URL scheme check"},"fullDescription":{"text":"Checking for the \"javascript:\" URL scheme without also checking for \"vbscript:\" and \"data:\" suggests a logic error or even a security vulnerability."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","correctness","external/cwe/cwe-020"],"description":"Checking for the \"javascript:\" URL scheme without also checking for \"vbscript:\"\n and \"data:\" suggests a logic error or even a security vulnerability.","id":"go/incomplete-url-scheme-check","kind":"problem","name":"Incomplete URL scheme check","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/incomplete-hostname-regexp","name":"go/incomplete-hostname-regexp","shortDescription":{"text":"Incomplete regular expression for hostnames"},"fullDescription":{"text":"Matching a URL or hostname against a regular expression that contains an unescaped dot as part of the hostname might match more hostnames than expected."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-20"],"description":"Matching a URL or hostname against a regular expression that contains an unescaped\n dot as part of the hostname might match more hostnames than expected.","id":"go/incomplete-hostname-regexp","kind":"path-problem","name":"Incomplete regular expression for hostnames","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/suspicious-character-in-regex","name":"go/suspicious-character-in-regex","shortDescription":{"text":"Suspicious characters in a regular expression"},"fullDescription":{"text":"If a literal bell character or backspace appears in a regular expression, the start of text or word boundary may have been intended."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["correctness","security","external/cwe/cwe-20"],"description":"If a literal bell character or backspace appears in a regular expression, the start of text or word boundary may have been intended.","id":"go/suspicious-character-in-regex","kind":"path-problem","name":"Suspicious characters in a regular expression","precision":"high","problem.severity":"warning","security-severity":"7.8"}},{"id":"go/email-injection","name":"go/email-injection","shortDescription":{"text":"Email content injection"},"fullDescription":{"text":"Incorporating untrusted input directly into an email message can enable content spoofing, which in turn may lead to information leaks and other security issues."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-640"],"description":"Incorporating untrusted input directly into an email message can enable\n content spoofing, which in turn may lead to information leaks and other\n security issues.","id":"go/email-injection","kind":"path-problem","name":"Email content injection","precision":"high","problem.severity":"error","security-severity":"9.8"}},{"id":"go/disabled-certificate-check","name":"go/disabled-certificate-check","shortDescription":{"text":"Disabled TLS certificate check"},"fullDescription":{"text":"If an application disables TLS certificate checking, it may be vulnerable to man-in-the-middle attacks."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-295"],"description":"If an application disables TLS certificate checking, it may be vulnerable to\n man-in-the-middle attacks.","id":"go/disabled-certificate-check","kind":"problem","name":"Disabled TLS certificate check","precision":"high","problem.severity":"warning","security-severity":"7.5"}},{"id":"go/missing-jwt-signature-check","name":"go/missing-jwt-signature-check","shortDescription":{"text":"Missing JWT signature check"},"fullDescription":{"text":"Failing to check the JSON Web Token (JWT) signature may allow an attacker to forge their own tokens."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-347"],"description":"Failing to check the JSON Web Token (JWT) signature may allow an attacker to forge their own tokens.","id":"go/missing-jwt-signature-check","kind":"path-problem","name":"Missing JWT signature check","precision":"high","problem.severity":"error","security-severity":"7.8"}},{"id":"go/uncontrolled-allocation-size","name":"go/uncontrolled-allocation-size","shortDescription":{"text":"Slice memory allocation with excessive size value"},"fullDescription":{"text":"Allocating memory for slices with the built-in make function from user-controlled sources can lead to a denial of service."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-770"],"description":"Allocating memory for slices with the built-in make function from user-controlled sources can lead to a denial of service.","id":"go/uncontrolled-allocation-size","kind":"path-problem","name":"Slice memory allocation with excessive size value","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/insecure-hostkeycallback","name":"go/insecure-hostkeycallback","shortDescription":{"text":"Use of insecure HostKeyCallback implementation"},"fullDescription":{"text":"Detects insecure SSL client configurations with an implementation of the `HostKeyCallback` that accepts all host keys."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-322"],"description":"Detects insecure SSL client configurations with an implementation of the `HostKeyCallback` that accepts all host keys.","id":"go/insecure-hostkeycallback","kind":"path-problem","name":"Use of insecure HostKeyCallback implementation","precision":"high","problem.severity":"warning","security-severity":"8.2"}},{"id":"go/clear-text-logging","name":"go/clear-text-logging","shortDescription":{"text":"Clear-text logging of sensitive information"},"fullDescription":{"text":"Logging sensitive information without encryption or hashing can expose it to an attacker."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-312","external/cwe/cwe-315","external/cwe/cwe-359"],"description":"Logging sensitive information without encryption or hashing can\n expose it to an attacker.","id":"go/clear-text-logging","kind":"path-problem","name":"Clear-text logging of sensitive information","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/constant-oauth2-state","name":"go/constant-oauth2-state","shortDescription":{"text":"Use of constant `state` value in OAuth 2.0 URL"},"fullDescription":{"text":"Using a constant value for the `state` in the OAuth 2.0 URL makes the application susceptible to CSRF attacks."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-352"],"description":"Using a constant value for the `state` in the OAuth 2.0 URL makes the application\n susceptible to CSRF attacks.","id":"go/constant-oauth2-state","kind":"path-problem","name":"Use of constant `state` value in OAuth 2.0 URL","precision":"high","problem.severity":"error","security-severity":"8.8"}},{"id":"go/insecure-randomness","name":"go/insecure-randomness","shortDescription":{"text":"Use of insufficient randomness as the key of a cryptographic algorithm"},"fullDescription":{"text":"Using insufficient randomness as the key of a cryptographic algorithm can allow an attacker to compromise security."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-338"],"description":"Using insufficient randomness as the key of a cryptographic algorithm can allow an attacker to compromise security.","id":"go/insecure-randomness","kind":"path-problem","name":"Use of insufficient randomness as the key of a cryptographic algorithm","precision":"high","problem.severity":"error","security-severity":"7.8"}},{"id":"go/unsafe-unzip-symlink","name":"go/unsafe-unzip-symlink","shortDescription":{"text":"Arbitrary file write extracting an archive containing symbolic links"},"fullDescription":{"text":"Extracting files from a malicious zip archive without validating that the destination file path is within the destination directory can cause files outside the destination directory to be overwritten. Extracting symbolic links in particular requires resolving previously extracted links to ensure the destination directory is not escaped."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-022"],"description":"Extracting files from a malicious zip archive without validating that the\n destination file path is within the destination directory can cause files outside\n the destination directory to be overwritten. Extracting symbolic links in particular\n requires resolving previously extracted links to ensure the destination directory\n is not escaped.","id":"go/unsafe-unzip-symlink","kind":"path-problem","name":"Arbitrary file write extracting an archive containing symbolic links","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/zipslip","name":"go/zipslip","shortDescription":{"text":"Arbitrary file access during archive extraction (\"Zip Slip\")"},"fullDescription":{"text":"Extracting files from a malicious ZIP file, or similar type of archive, without validating that the destination file path is within the destination directory can allow an attacker to unexpectedly gain access to resources."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-022"],"description":"Extracting files from a malicious ZIP file, or similar type of archive, without\n validating that the destination file path is within the destination directory\n can allow an attacker to unexpectedly gain access to resources.","id":"go/zipslip","kind":"path-problem","name":"Arbitrary file access during archive extraction (\"Zip Slip\")","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/path-injection","name":"go/path-injection","shortDescription":{"text":"Uncontrolled data used in path expression"},"fullDescription":{"text":"Accessing paths influenced by users can allow an attacker to access unexpected resources."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-022","external/cwe/cwe-023","external/cwe/cwe-036","external/cwe/cwe-073","external/cwe/cwe-099"],"description":"Accessing paths influenced by users can allow an attacker to access\n unexpected resources.","id":"go/path-injection","kind":"path-problem","name":"Uncontrolled data used in path expression","precision":"high","problem.severity":"error","security-severity":"7.5"}},{"id":"go/command-injection","name":"go/command-injection","shortDescription":{"text":"Command built from user-controlled sources"},"fullDescription":{"text":"Building a system command from user-controlled sources is vulnerable to insertion of malicious code by the user."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-078"],"description":"Building a system command from user-controlled sources is vulnerable to insertion of\n malicious code by the user.","id":"go/command-injection","kind":"path-problem","name":"Command built from user-controlled sources","precision":"high","problem.severity":"error","security-severity":"9.8"}},{"id":"go/incorrect-integer-conversion","name":"go/incorrect-integer-conversion","shortDescription":{"text":"Incorrect conversion between integer types"},"fullDescription":{"text":"Converting the result of `strconv.Atoi`, `strconv.ParseInt`, and `strconv.ParseUint` to integer types of smaller bit size can produce unexpected values."},"defaultConfiguration":{"enabled":true,"level":"warning"},"properties":{"tags":["security","external/cwe/cwe-190","external/cwe/cwe-681"],"description":"Converting the result of `strconv.Atoi`, `strconv.ParseInt`,\n and `strconv.ParseUint` to integer types of smaller bit size\n can produce unexpected values.","id":"go/incorrect-integer-conversion","kind":"path-problem","name":"Incorrect conversion between integer types","precision":"very-high","problem.severity":"warning","security-severity":"8.1"}},{"id":"go/xml/xpath-injection","name":"go/xml/xpath-injection","shortDescription":{"text":"XPath injection"},"fullDescription":{"text":"Building an XPath expression from user-controlled sources is vulnerable to insertion of malicious code by the user."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-643"],"description":"Building an XPath expression from user-controlled sources is vulnerable to insertion of\n malicious code by the user.","id":"go/xml/xpath-injection","kind":"path-problem","name":"XPath injection","precision":"high","problem.severity":"error","security-severity":"9.8"}},{"id":"go/reflected-xss","name":"go/reflected-xss","shortDescription":{"text":"Reflected cross-site scripting"},"fullDescription":{"text":"Writing user input directly to an HTTP response allows for a cross-site scripting vulnerability."},"defaultConfiguration":{"enabled":true,"level":"error"},"properties":{"tags":["security","external/cwe/cwe-079","external/cwe/cwe-116"],"description":"Writing user input directly to an HTTP response allows for\n a cross-site scripting vulnerability.","id":"go/reflected-xss","kind":"path-problem","name":"Reflected cross-site scripting","precision":"high","problem.severity":"error","security-severity":"6.1"}},{"id":"go/summary/lines-of-code","name":"go/summary/lines-of-code","shortDescription":{"text":"Total lines of Go code in the database"},"fullDescription":{"text":"The total number of lines of Go code across all extracted files, including auto-generated files. This is a useful metric of the size of a database. For all files that were seen during the build, this query counts the lines of code, excluding whitespace or comments."},"defaultConfiguration":{"enabled":true},"properties":{"tags":["summary","lines-of-code","debug"],"description":"The total number of lines of Go code across all extracted files, including auto-generated files. This is a useful metric of the size of a database. For all files that were seen during the build, this query counts the lines of code, excluding whitespace or comments.","id":"go/summary/lines-of-code","kind":"metric","name":"Total lines of Go code in the database"}}]},"extensions":[{"name":"codeql/go-queries","semanticVersion":"1.0.8+e99d7db428fc3981c9a1f03f03a024ac40e52f54","locations":[{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/go-all","semanticVersion":"2.0.0+e99d7db428fc3981c9a1f03f03a024ac40e52f54","taxa":[{"id":"ext/net.http.model.yml/2/15","properties":{"CodeQL/DataExtensionLocation":{"artifactLocation":{"uri":"ext/net.http.model.yml"},"region":{"startLine":55,"startColumn":9,"endLine":55,"endColumn":9}}}},{"id":"ext/net.url.model.yml/0/15","properties":{"CodeQL/DataExtensionLocation":{"artifactLocation":{"uri":"ext/net.url.model.yml"},"region":{"startLine":21,"startColumn":9,"endLine":21,"endColumn":9}}}},{"id":"ext/net.url.model.yml/0/22","properties":{"CodeQL/DataExtensionLocation":{"artifactLocation":{"uri":"ext/net.url.model.yml"},"region":{"startLine":28,"startColumn":9,"endLine":28,"endColumn":9}}}}],"locations":[{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/go-all/2.0.0/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/go-all/2.0.0/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/threat-models","semanticVersion":"1.0.8+e99d7db428fc3981c9a1f03f03a024ac40e52f54","locations":[{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/threat-models/1.0.8/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///Users/john.doe/.local/bin/codeql/qlpacks/codeql/go-queries/1.0.8/.codeql/libraries/codeql/threat-models/1.0.8/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]}]},"invocations":[{"toolExecutionNotifications":[{"message":{"text":"Extraction failed with error This application uses version go1.23 of the source-processing packages but runs version go1.24 of 'go list'. It may fail to process source files that rely on newer language features. If so, rebuild the application using a newer version of Go."},"level":"error","descriptor":{"id":"go/diagnostics/extraction-errors","index":0},"properties":{"formattedMessage":{"text":"Extraction failed with error This application uses version go1.23 of the source-processing packages but runs version go1.24 of 'go list'. It may fail to process source files that rely on newer language features. If so, rebuild the application using a newer version of Go."}}},{"message":{"text":"Extraction failed in main.go with error package requires newer Go version go1.24 (application built with go1.23)"},"level":"error","descriptor":{"id":"go/diagnostics/extraction-errors","index":0},"properties":{"formattedMessage":{"text":"Extraction failed in main.go with error package requires newer Go version go1.24 (application built with go1.23)"}}},{"locations":[{"physicalLocation":{"artifactLocation":{"uri":"go.mod","uriBaseId":"%SRCROOT%","index":1}}}],"message":{"text":""},"level":"none","descriptor":{"id":"go/diagnostics/successfully-extracted-files","index":1},"properties":{"formattedMessage":{"text":""}}},{"locations":[{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0}}}],"message":{"text":""},"level":"none","descriptor":{"id":"go/diagnostics/successfully-extracted-files","index":1},"properties":{"formattedMessage":{"text":""}}},{"locations":[{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0}}}],"message":{"text":""},"level":"none","descriptor":{"id":"go/baseline/expected-extracted-files","index":2},"properties":{"formattedMessage":{"text":""}}},{"message":{"text":""},"level":"note","timeUtc":"2025-05-09T07:59:00.815+00:00","descriptor":{"id":"cli/sip-enablement","index":3},"properties":{"attributes":{"isEnabled":true},"visibility":{"statusPage":false,"telemetry":true}}}],"executionSuccessful":true}],"artifacts":[{"location":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0}},{"location":{"uri":"go.mod","uriBaseId":"%SRCROOT%","index":1}}],"results":[{"ruleId":"go/command-injection","ruleIndex":24,"rule":{"id":"go/command-injection","index":24},"message":{"text":"This command depends on a [user-provided value](1)."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":58}}}],"partialFingerprints":{"primaryLocationLineHash":"e9584120171099c2:1","primaryLocationStartColumnFingerprint":"32"},"codeFlows":[{"threadFlows":[{"locations":[{"location":{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":39}},"message":{"text":"selection of URL"}},"taxa":[{"index":0,"toolComponent":{"index":1},"properties":{"CodeQL/DataflowRole":"source"}}]},{"location":{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":47}},"message":{"text":"call to Query"}},"taxa":[{"index":1,"toolComponent":{"index":1},"properties":{"CodeQL/DataflowRole":"step"}}]},{"location":{"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":58}},"message":{"text":"call to Get"}},"taxa":[{"index":2,"toolComponent":{"index":1},"properties":{"CodeQL/DataflowRole":"step"}}]}]}]}],"relatedLocations":[{"id":1,"physicalLocation":{"artifactLocation":{"uri":"main.go","uriBaseId":"%SRCROOT%","index":0},"region":{"startLine":10,"startColumn":34,"endColumn":39}},"message":{"text":"user-provided value"}}]}],"columnKind":"utf16CodeUnits","properties":{"semmle.formatSpecifier":"sarifv2.1.0","metricResults":[{"rule":{"id":"go/summary/lines-of-code","index":28},"ruleId":"go/summary/lines-of-code","ruleIndex":28,"value":14,"baseline":14}]}}]}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"tool": {
|
|
7
7
|
"driver": {
|
|
8
8
|
"language": "en-US",
|
|
9
|
-
"name": "
|
|
9
|
+
"name": "sectools sca"
|
|
10
10
|
},
|
|
11
11
|
"extensions": [
|
|
12
12
|
{
|
|
13
|
-
"name": "Snyk Open Source
|
|
13
|
+
"name": "Snyk Open Source",
|
|
14
14
|
"properties": {
|
|
15
15
|
"artifactsScanned": 6
|
|
16
16
|
},
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
+
import { z, ZodSafeParseResult } from 'zod';
|
|
1
2
|
import {
|
|
2
3
|
Color,
|
|
3
|
-
LogLevel,
|
|
4
4
|
RepresentationType, SarifFileExtension,
|
|
5
5
|
SarifToSlackClient,
|
|
6
6
|
SendIf
|
|
7
|
-
} from '../../src'
|
|
7
|
+
} from '../../src';
|
|
8
8
|
|
|
9
9
|
describe('(integration): SendSarifToSlack', (): void => {
|
|
10
|
-
function processLogLevel(logLevel?: string): LogLevel | undefined {
|
|
11
|
-
if (!logLevel) {
|
|
12
|
-
return undefined
|
|
13
|
-
}
|
|
14
|
-
switch (logLevel.toLowerCase()) {
|
|
15
|
-
case 'silly':
|
|
16
|
-
return LogLevel.Silly
|
|
17
|
-
case 'trace':
|
|
18
|
-
return LogLevel.Trace
|
|
19
|
-
case 'debug':
|
|
20
|
-
return LogLevel.Debug
|
|
21
|
-
case 'info':
|
|
22
|
-
return LogLevel.Info
|
|
23
|
-
case 'warning':
|
|
24
|
-
return LogLevel.Warning
|
|
25
|
-
case 'error':
|
|
26
|
-
return LogLevel.Error
|
|
27
|
-
case 'fatal':
|
|
28
|
-
return LogLevel.Fatal
|
|
29
|
-
default:
|
|
30
|
-
throw new Error(`Unknown log level: ${logLevel}`)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
10
|
function processSarifExtension(extension: string): SarifFileExtension {
|
|
35
11
|
const allowed: string[] = ['sarif', 'json']
|
|
36
12
|
if (allowed.includes(extension)) {
|
|
@@ -62,6 +38,18 @@ describe('(integration): SendSarifToSlack', (): void => {
|
|
|
62
38
|
return RepresentationType.CompactTotalPerLevel
|
|
63
39
|
case 'compact-total-per-severity':
|
|
64
40
|
return RepresentationType.CompactTotalPerSeverity
|
|
41
|
+
case 'table-group-by-run-per-level':
|
|
42
|
+
return RepresentationType.TableGroupByRunPerLevel
|
|
43
|
+
case 'table-group-by-run-per-severity':
|
|
44
|
+
return RepresentationType.TableGroupByRunPerSeverity
|
|
45
|
+
case 'table-group-by-tool-name-per-level':
|
|
46
|
+
return RepresentationType.TableGroupByToolNamePerLevel
|
|
47
|
+
case 'table-group-by-tool-name-per-severity':
|
|
48
|
+
return RepresentationType.TableGroupByToolNamePerSeverity
|
|
49
|
+
case 'table-group-by-sarif-per-level':
|
|
50
|
+
return RepresentationType.TableGroupBySarifPerLevel
|
|
51
|
+
case 'table-group-by-sarif-per-severity':
|
|
52
|
+
return RepresentationType.TableGroupBySarifPerSeverity
|
|
65
53
|
default:
|
|
66
54
|
return undefined
|
|
67
55
|
}
|
|
@@ -101,64 +89,66 @@ describe('(integration): SendSarifToSlack', (): void => {
|
|
|
101
89
|
}
|
|
102
90
|
}
|
|
103
91
|
|
|
104
|
-
test('
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
92
|
+
test('should send Sarif to Slack', async () => {
|
|
93
|
+
const recursiveParseResult: ZodSafeParseResult<boolean> = z
|
|
94
|
+
.stringbool()
|
|
95
|
+
.safeParse(process.env.SARIF_TO_SLACK_SARIF_PATH_RECURSIVE);
|
|
96
|
+
const sarifExtensionParseResult: ZodSafeParseResult<SarifFileExtension> = z
|
|
97
|
+
.string()
|
|
98
|
+
.transform(processSarifExtension)
|
|
99
|
+
.safeParse(process.env.SARIF_TO_SLACK_SARIF_FILE_EXTENSION);
|
|
100
|
+
const includeRunParseResult: ZodSafeParseResult<boolean> = z
|
|
101
|
+
.stringbool()
|
|
102
|
+
.safeParse(process.env.SARIF_TO_SLACK_INCLUDE_RUN);
|
|
103
|
+
|
|
104
|
+
const client: SarifToSlackClient = await SarifToSlackClient.create(
|
|
105
|
+
process.env.SARIF_TO_SLACK_WEBHOOK_URL as string,
|
|
106
|
+
{
|
|
107
|
+
username: process.env.SARIF_TO_SLACK_USERNAME,
|
|
108
|
+
iconUrl: process.env.SARIF_TO_SLACK_ICON_URL,
|
|
109
|
+
color: {
|
|
110
|
+
default: Color.from(process.env.SARIF_TO_SLACK_COLOR),
|
|
111
|
+
empty: Color.from(process.env.SARIF_TO_SLACK_COLOR_EMPTY),
|
|
112
|
+
byLevel: {
|
|
113
|
+
error: Color.from(process.env.SARIF_TO_SLACK_COLOR_ERROR),
|
|
114
|
+
warning: Color.from(process.env.SARIF_TO_SLACK_COLOR_WARNING),
|
|
115
|
+
note: Color.from(process.env.SARIF_TO_SLACK_COLOR_NOTE),
|
|
116
|
+
none: Color.from(process.env.SARIF_TO_SLACK_COLOR_NONE),
|
|
117
|
+
unknown: Color.from(process.env.SARIF_TO_SLACK_COLOR_UNKNOWN),
|
|
118
|
+
},
|
|
119
|
+
bySeverity: {
|
|
120
|
+
critical: Color.from(process.env.SARIF_TO_SLACK_COLOR_CRITICAL),
|
|
121
|
+
high: Color.from(process.env.SARIF_TO_SLACK_COLOR_HIGH),
|
|
122
|
+
medium: Color.from(process.env.SARIF_TO_SLACK_COLOR_MEDIUM),
|
|
123
|
+
low: Color.from(process.env.SARIF_TO_SLACK_COLOR_LOW),
|
|
124
|
+
none: Color.from(process.env.SARIF_TO_SLACK_COLOR_NONE),
|
|
125
|
+
unknown: Color.from(process.env.SARIF_TO_SLACK_COLOR_UNKNOWN),
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
sarif: {
|
|
129
|
+
path: process.env.SARIF_TO_SLACK_SARIF_PATH as string,
|
|
130
|
+
recursive: recursiveParseResult.success ? recursiveParseResult.data : false,
|
|
131
|
+
extension: sarifExtensionParseResult.success ? sarifExtensionParseResult.data : 'sarif',
|
|
132
|
+
},
|
|
133
|
+
header: {
|
|
134
|
+
include: process.env.SARIF_TO_SLACK_HEADER !== 'skip',
|
|
135
|
+
value: process.env.SARIF_TO_SLACK_HEADER,
|
|
136
|
+
},
|
|
137
|
+
footer: {
|
|
138
|
+
include: process.env.SARIF_TO_SLACK_FOOTER !== 'skip',
|
|
139
|
+
value: process.env.SARIF_TO_SLACK_FOOTER,
|
|
140
|
+
},
|
|
141
|
+
actor: {
|
|
142
|
+
include: process.env.SARIF_TO_SLACK_ACTOR !== 'skip',
|
|
143
|
+
value: process.env.SARIF_TO_SLACK_ACTOR,
|
|
118
144
|
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
high: Color.from(process.env.SARIF_TO_SLACK_COLOR_HIGH),
|
|
122
|
-
medium: Color.from(process.env.SARIF_TO_SLACK_COLOR_MEDIUM),
|
|
123
|
-
low: Color.from(process.env.SARIF_TO_SLACK_COLOR_LOW),
|
|
124
|
-
none: Color.from(process.env.SARIF_TO_SLACK_COLOR_NONE),
|
|
125
|
-
unknown: Color.from(process.env.SARIF_TO_SLACK_COLOR_UNKNOWN),
|
|
145
|
+
run: {
|
|
146
|
+
include: includeRunParseResult.success ? includeRunParseResult.data : false,
|
|
126
147
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
: false,
|
|
133
|
-
extension: process.env.SARIF_TO_SLACK_SARIF_FILE_EXTENSION
|
|
134
|
-
? processSarifExtension(process.env.SARIF_TO_SLACK_SARIF_FILE_EXTENSION)
|
|
135
|
-
: 'sarif',
|
|
136
|
-
},
|
|
137
|
-
log: {
|
|
138
|
-
level: processLogLevel(process.env.SARIF_TO_SLACK_LOG_LEVEL),
|
|
139
|
-
template: process.env.SARIF_TO_SLACK_LOG_TEMPLATE,
|
|
140
|
-
colored: process.env.SARIF_TO_SLACK_LOG_COLORED
|
|
141
|
-
? Boolean(process.env.SARIF_TO_SLACK_LOG_COLORED)
|
|
142
|
-
: true,
|
|
143
|
-
},
|
|
144
|
-
header: {
|
|
145
|
-
include: process.env.SARIF_TO_SLACK_HEADER !== 'skip',
|
|
146
|
-
value: process.env.SARIF_TO_SLACK_HEADER,
|
|
147
|
-
},
|
|
148
|
-
footer: {
|
|
149
|
-
include: process.env.SARIF_TO_SLACK_FOOTER !== 'skip',
|
|
150
|
-
value: process.env.SARIF_TO_SLACK_FOOTER,
|
|
151
|
-
},
|
|
152
|
-
actor: {
|
|
153
|
-
include: process.env.SARIF_TO_SLACK_ACTOR !== 'skip',
|
|
154
|
-
value: process.env.SARIF_TO_SLACK_ACTOR,
|
|
155
|
-
},
|
|
156
|
-
run: {
|
|
157
|
-
include: Boolean(process.env.SARIF_TO_SLACK_INCLUDE_RUN),
|
|
158
|
-
},
|
|
159
|
-
representation: processRepresentationType(process.env.SARIF_TO_SLACK_REPRESENTATION),
|
|
160
|
-
sendIf: processSendIf(process.env.SARIF_TO_SLACK_SEND_IF),
|
|
161
|
-
})
|
|
162
|
-
await client.send()
|
|
148
|
+
representation: processRepresentationType(process.env.SARIF_TO_SLACK_REPRESENTATION),
|
|
149
|
+
sendIf: processSendIf(process.env.SARIF_TO_SLACK_SEND_IF),
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
await client.send();
|
|
163
153
|
})
|
|
164
154
|
})
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import Table from '../../../src/representations/table/Table';
|
|
2
|
+
import { randomAlphabetic } from '../../../src/utils/StringUtils';
|
|
3
|
+
|
|
4
|
+
describe('(unit): Table', (): void => {
|
|
5
|
+
describe('toString()', (): void => {
|
|
6
|
+
const TOTAL_HEADER = 'Total';
|
|
7
|
+
|
|
8
|
+
test.each([
|
|
9
|
+
[4, TOTAL_HEADER.length, 6],
|
|
10
|
+
[3, TOTAL_HEADER.length, 4],
|
|
11
|
+
[6, TOTAL_HEADER.length, 7],
|
|
12
|
+
[4, TOTAL_HEADER.length, 3],
|
|
13
|
+
[7, TOTAL_HEADER.length, 6],
|
|
14
|
+
[6, TOTAL_HEADER.length, 4],
|
|
15
|
+
])('should pass when header=%s, total=%s and row=%s', (h: number, t: number, r: number): void => {
|
|
16
|
+
const expectedSize: number = Math.max(h, t, r);
|
|
17
|
+
|
|
18
|
+
const fill = (v: string, s: number, c: string = ' '): string => {
|
|
19
|
+
return v + (
|
|
20
|
+
v.length < s ? c.repeat(s - v.length) : ''
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const main: string = randomAlphabetic(h);
|
|
25
|
+
const row: string = randomAlphabetic(r);
|
|
26
|
+
const column: string = randomAlphabetic(1);
|
|
27
|
+
|
|
28
|
+
const table = new Table({ main, columns: [column], rows: [row] });
|
|
29
|
+
table.set(0, 0, 1);
|
|
30
|
+
expect(table.toString()).toEqual(` | ${fill(main, expectedSize)} | ${column} | Total |
|
|
31
|
+
| ${fill('-', expectedSize, '-')} | - | ----- |
|
|
32
|
+
| ${fill(row, expectedSize)} | 1 | 1 |
|
|
33
|
+
| ${fill('-', expectedSize, '-')} | - | ----- |
|
|
34
|
+
| ${fill(TOTAL_HEADER, expectedSize)} | 1 | 1 | `);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test.each(
|
|
38
|
+
[[0, 1], [1, 0], [0, 0]]
|
|
39
|
+
)('should pass when rows size is %s and columns size is %s', (r: number, c: number): void => {
|
|
40
|
+
const table = new Table({
|
|
41
|
+
columns: Array.from({ length: c }, (): string => randomAlphabetic(1)),
|
|
42
|
+
rows: Array.from({ length: r }, (): string => randomAlphabetic(1)),
|
|
43
|
+
});
|
|
44
|
+
for (let i: number = 0; i < r; i++) {
|
|
45
|
+
for (let j: number = 0; j < c; j++) {
|
|
46
|
+
table.set(i, j, 1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
expect(table.toString()).toEqual('');
|
|
50
|
+
});
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// test('should prepare string correctly when "Total" is longer', (): void => {
|
|
54
|
+
// const table = new Table({
|
|
55
|
+
// rows: ['a', 'abc', 'ab'],
|
|
56
|
+
// columns: ['x', 'xyz', 'xy']
|
|
57
|
+
// })
|
|
58
|
+
// table.set(0, 0, 1)
|
|
59
|
+
// table.set(0, 1, 1)
|
|
60
|
+
// table.set(0, 2, 1)
|
|
61
|
+
// table.set(1, 0, 1)
|
|
62
|
+
// table.set(2, 0, 1)
|
|
63
|
+
// table.set(1, 1, 1)
|
|
64
|
+
// table.set(2, 1, 1)
|
|
65
|
+
// table.set(1, 2, 1)
|
|
66
|
+
// table.set(2, 2, 1)
|
|
67
|
+
// expect(table.toString()).toEqual(` | | x | xyz | xy | Total |
|
|
68
|
+
// | ----- | - | --- | -- | ----- |
|
|
69
|
+
// | a | 1 | 1 | 1 | 3 |
|
|
70
|
+
// | abc | 1 | 1 | 1 | 3 |
|
|
71
|
+
// | ab | 1 | 1 | 1 | 3 |
|
|
72
|
+
// | ----- | - | --- | -- | ----- |
|
|
73
|
+
// | Total | 3 | 3 | 3 | 9 | `)
|
|
74
|
+
// })
|
|
75
|
+
//
|
|
76
|
+
// test('should prepare string correctly when "Total" is shorter', (): void => {
|
|
77
|
+
// const table = new Table({
|
|
78
|
+
// rows: ['a', 'abcdef', 'ab'],
|
|
79
|
+
// columns: ['x', 'xyz', 'xy']
|
|
80
|
+
// })
|
|
81
|
+
// table.set(0, 0, 1)
|
|
82
|
+
// table.set(0, 1, 1)
|
|
83
|
+
// table.set(0, 2, 99998)
|
|
84
|
+
// table.set(1, 0, 1)
|
|
85
|
+
// table.set(2, 0, 1)
|
|
86
|
+
// table.set(1, 1, 1)
|
|
87
|
+
// table.set(2, 1, 1)
|
|
88
|
+
// table.set(1, 2, 1)
|
|
89
|
+
// table.set(2, 2, 1)
|
|
90
|
+
// expect(table.toString()).toEqual(` | | x | xyz | xy | Total |
|
|
91
|
+
// | ------ | - | --- | ------ | ------ |
|
|
92
|
+
// | a | 1 | 1 | 99998 | 100000 |
|
|
93
|
+
// | abcdef | 1 | 1 | 1 | 3 |
|
|
94
|
+
// | ab | 1 | 1 | 1 | 3 |
|
|
95
|
+
// | ------ | - | --- | ------ | ------ |
|
|
96
|
+
// | Total | 3 | 3 | 100000 | 100006 | `)
|
|
97
|
+
// })
|
|
98
|
+
//
|
|
99
|
+
// test('should prepare string correctly when rows less than columns', (): void => {
|
|
100
|
+
// const table = new Table({
|
|
101
|
+
// rows: ['a'],
|
|
102
|
+
// columns: ['x', 'xyz', 'xy']
|
|
103
|
+
// })
|
|
104
|
+
// table.set(0, 0, 1)
|
|
105
|
+
// table.set(0, 1, 1)
|
|
106
|
+
// table.set(0, 2, 99998)
|
|
107
|
+
// expect(table.toString()).toEqual(` | | x | xyz | xy | Total |
|
|
108
|
+
// | ----- | - | --- | ----- | ------ |
|
|
109
|
+
// | a | 1 | 1 | 99998 | 100000 |
|
|
110
|
+
// | ----- | - | --- | ----- | ------ |
|
|
111
|
+
// | Total | 1 | 1 | 99998 | 100000 | `)
|
|
112
|
+
// })
|
|
113
|
+
//
|
|
114
|
+
// test('should prepare string correctly when rows more than columns', (): void => {
|
|
115
|
+
// const table = new Table({
|
|
116
|
+
// rows: ['a', 'abcdef', 'ab'],
|
|
117
|
+
// columns: ['x']
|
|
118
|
+
// })
|
|
119
|
+
// table.set(0, 0, 35000)
|
|
120
|
+
// table.set(1, 0, 35000)
|
|
121
|
+
// table.set(2, 0, 30000)
|
|
122
|
+
// expect(table.toString()).toEqual(` | | x | Total |
|
|
123
|
+
// | ------ | ------ | ------ |
|
|
124
|
+
// | a | 35000 | 35000 |
|
|
125
|
+
// | abcdef | 35000 | 35000 |
|
|
126
|
+
// | ab | 30000 | 30000 |
|
|
127
|
+
// | ------ | ------ | ------ |
|
|
128
|
+
// | Total | 100000 | 100000 | `)
|
|
129
|
+
// })
|
|
130
|
+
//
|
|
131
|
+
// test('should prepare string correctly when row and column headers are short', (): void => {
|
|
132
|
+
// const table = new Table({
|
|
133
|
+
// rows: ['a', 'b', 'c'],
|
|
134
|
+
// columns: ['x']
|
|
135
|
+
// })
|
|
136
|
+
// table.set(0, 0, 35000)
|
|
137
|
+
// table.set(1, 0, 64999)
|
|
138
|
+
// table.set(2, 0, 1)
|
|
139
|
+
// expect(table.toString()).toEqual(` | | x | Total |
|
|
140
|
+
// | ----- | ------ | ------ |
|
|
141
|
+
// | a | 35000 | 35000 |
|
|
142
|
+
// | b | 64999 | 64999 |
|
|
143
|
+
// | c | 1 | 1 |
|
|
144
|
+
// | ----- | ------ | ------ |
|
|
145
|
+
// | Total | 100000 | 100000 | `)
|
|
146
|
+
// })
|
|
147
|
+
//
|
|
148
|
+
// test('should prepare string correctly when row and column headers are numbers', (): void => {
|
|
149
|
+
// const table = new Table({
|
|
150
|
+
// rows: ['1'],
|
|
151
|
+
// columns: ['1']
|
|
152
|
+
// })
|
|
153
|
+
// table.set(0, 0, 1)
|
|
154
|
+
// expect(table.toString()).toEqual(` | | 1 | Total |
|
|
155
|
+
// | ----- | - | ----- |
|
|
156
|
+
// | 1 | 1 | 1 |
|
|
157
|
+
// | ----- | - | ----- |
|
|
158
|
+
// | Total | 1 | 1 | `)
|
|
159
|
+
// })
|
|
160
|
+
//
|
|
161
|
+
// test('should prepare string correctly when main header is longer than "Total"', (): void => {
|
|
162
|
+
// const table = new Table({
|
|
163
|
+
// main: 'abz',
|
|
164
|
+
// rows: ['1'],
|
|
165
|
+
// columns: ['1']
|
|
166
|
+
// })
|
|
167
|
+
// table.set(0, 0, 1)
|
|
168
|
+
// expect(table.toString()).toEqual(` | | 1 | Total |
|
|
169
|
+
// | ----- | - | ----- |
|
|
170
|
+
// | 1 | 1 | 1 |
|
|
171
|
+
// | ----- | - | ----- |
|
|
172
|
+
// | Total | 1 | 1 | `)
|
|
173
|
+
// })
|
|
174
|
+
})
|
package/dist/System.d.ts
DELETED
package/dist/System.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../src/System.ts"],"names":[],"mappings":""}
|
package/dist/System.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { version, sha, buildAt } from './metadata.json';
|
|
2
|
-
import Logger from './Logger';
|
|
3
|
-
/**
|
|
4
|
-
* This class prints metadata information into the logs, such as library version,
|
|
5
|
-
* SHA and build time.
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export default class System {
|
|
9
|
-
static initialize() {
|
|
10
|
-
Logger.info(`@fabasoad/sarif-to-slack version: ${version}`);
|
|
11
|
-
Logger.info(`@fabasoad/sarif-to-slack sha: ${sha}`);
|
|
12
|
-
Logger.info(`@fabasoad/sarif-to-slack built at: ${buildAt}`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3lzdGVtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1N5c3RlbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsRUFBRSxPQUFPLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQTtBQUN2RCxPQUFPLE1BQU0sTUFBTSxVQUFVLENBQUE7QUFFN0I7Ozs7R0FJRztBQUNILE1BQU0sQ0FBQyxPQUFPLE9BQU8sTUFBTTtJQUVsQixNQUFNLENBQUMsVUFBVTtRQUN0QixNQUFNLENBQUMsSUFBSSxDQUFDLHFDQUFxQyxPQUFPLEVBQUUsQ0FBQyxDQUFBO1FBQzNELE1BQU0sQ0FBQyxJQUFJLENBQUMsaUNBQWlDLEdBQUcsRUFBRSxDQUFDLENBQUE7UUFDbkQsTUFBTSxDQUFDLElBQUksQ0FBQyxzQ0FBc0MsT0FBTyxFQUFFLENBQUMsQ0FBQTtJQUM5RCxDQUFDO0NBQ0YifQ==
|
package/src/System.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { version, sha, buildAt } from './metadata.json'
|
|
2
|
-
import Logger from './Logger'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This class prints metadata information into the logs, such as library version,
|
|
6
|
-
* SHA and build time.
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export default class System {
|
|
10
|
-
|
|
11
|
-
public static initialize(): void {
|
|
12
|
-
Logger.info(`@fabasoad/sarif-to-slack version: ${version}`)
|
|
13
|
-
Logger.info(`@fabasoad/sarif-to-slack sha: ${sha}`)
|
|
14
|
-
Logger.info(`@fabasoad/sarif-to-slack built at: ${buildAt}`)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|