seaworthycode 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1321,7 +1321,7 @@ var copy = {
1321
1321
  "cli.error.outputInsideTarget": "Cannot write report inside the scanned directory.",
1322
1322
  "errors.parse.binary_file": "File appears to be binary and was skipped.",
1323
1323
  // Warnings
1324
- "warnings.deps.tree_exceeded": "Dependency tree exceeded 500 packages. Results may be incomplete.",
1324
+ "warnings.deps.tree_exceeded": "Dependency tree is large (5000+ packages). CVE scan may take longer than usual.",
1325
1325
  // Debug
1326
1326
  "debug.submodule_skipped": (path) => `Submodule ${path} not initialised, skipping.`,
1327
1327
  "debug.symlink_loop": (path) => `Symlink loop detected at ${path}, skipping.`,
@@ -3567,6 +3567,7 @@ async function loadLanguage(langKey) {
3567
3567
  languageCache.set(langKey, promise);
3568
3568
  return promise;
3569
3569
  }
3570
+ var MAX_PARSE_BYTES = 256 * 1024;
3570
3571
  function getOrCreateParser(lang, langKey) {
3571
3572
  if (langKey === "bash") {
3572
3573
  const parser2 = new Parser();
@@ -3624,6 +3625,9 @@ async function queryFile(file, queryString, astCache) {
3624
3625
  if (s.length === 0) {
3625
3626
  return { tree: null, source: s };
3626
3627
  }
3628
+ if (s.length > MAX_PARSE_BYTES) {
3629
+ throw new Error("file_too_large");
3630
+ }
3627
3631
  const parser = getOrCreateParser(lang, file.language);
3628
3632
  const parsed2 = parser.parse(s);
3629
3633
  if (!parsed2) {
@@ -3653,6 +3657,9 @@ async function queryFile(file, queryString, astCache) {
3653
3657
  if (source.length === 0) {
3654
3658
  return { matches: [], degraded: false };
3655
3659
  }
3660
+ if (source.length > MAX_PARSE_BYTES) {
3661
+ return { matches: [], degraded: true };
3662
+ }
3656
3663
  try {
3657
3664
  const parser = getOrCreateParser(lang, file.language);
3658
3665
  const parsed = parser.parse(source);
@@ -4747,7 +4754,7 @@ registry.register({
4747
4754
  return findings;
4748
4755
  }
4749
4756
  });
4750
- var MAX_DEPS = 500;
4757
+ var MAX_DEPS = 5e3;
4751
4758
  async function countDepsFromPackageLock(targetDir) {
4752
4759
  try {
4753
4760
  const raw = await fs5.readFile(join8(targetDir, "package-lock.json"), "utf-8");
@@ -16450,7 +16457,7 @@ import { join as join16 } from "path";
16450
16457
  import { createRequire as createRequire3 } from "module";
16451
16458
  import { intro as intro2, outro as outro2, confirm, isCancel as isCancel2 } from "@clack/prompts";
16452
16459
  var _require2 = createRequire3(import.meta.url);
16453
- var { version: CLI_VERSION2 } = _require2("../../package.json");
16460
+ var { version: CLI_VERSION2 } = _require2("../package.json");
16454
16461
  var LOG_FILE = join16(LOG_DIR, "seaworthy.log");
16455
16462
  var SENTRY_PROJECT_ID = "4511394796666960";
16456
16463
  var SENTRY_INGEST = "https://o4508597942026240.ingest.de.sentry.io";