ikanban 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,26 @@
1
+ # iKanban CLI licence
2
+
3
+ Copyright © VerBodh Pte. Ltd., Singapore. All rights reserved.
4
+
5
+ The `ikanban` package (the command-line tool and the scanners it runs) is proprietary software.
6
+ It is not open source.
7
+
8
+ ## What you may do
9
+ - Install and run it to scan your own code, AI endpoints and reports, and to send the results to
10
+ your own iKanban account.
11
+ - Run it on your own machines and in your own CI.
12
+ - Run it without an iKanban account; publishing results needs one (the server checks your plan).
13
+
14
+ ## What you may not do
15
+ - Copy, change, or share the package or its source, except as needed to run it.
16
+ - Sell, rent, sublicense, or offer it as part of another product or service.
17
+ - Use it to build a product that competes with iKanban.
18
+ - Remove this notice.
19
+
20
+ ## No warranty
21
+ The package is provided "as is", without warranty of any kind. VerBodh Pte. Ltd. is not liable for
22
+ any claim or damage that comes from using it. A scan can miss a vulnerability; a clean report is not
23
+ proof that code is safe.
24
+
25
+ ## Questions
26
+ support@verbodh.com · https://i-kanban.com
package/README.md CHANGED
@@ -38,3 +38,7 @@ iKanban checks your plan when you publish; a plan that does not include it gets
38
38
 
39
39
  Nothing, unless you pass `--publish`. With `--publish`, the report and its findings go to iKanban.
40
40
  Secrets found in your repo are masked in the report before anything is sent.
41
+
42
+ ## Licence
43
+
44
+ Proprietary: you may run it for your own code and your own iKanban account. See [LICENSE.md](LICENSE.md).
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "ikanban",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "iKanban CLI: AI and security scans of your own repo, with results filed into iKanban",
5
5
  "bin": { "ikanban": "bin/ikanban.js" },
6
- "files": ["bin", "lib", "hooks", "scanners", "README.md"],
6
+ "files": ["bin", "lib", "hooks", "scanners", "README.md", "LICENSE.md"],
7
7
  "scripts": {
8
8
  "prepack": "node scripts/copy-scanners.js",
9
9
  "pretest": "node scripts/copy-scanners.js",
@@ -13,5 +13,5 @@
13
13
  "homepage": "https://i-kanban.com",
14
14
  "keywords": ["ikanban", "security", "scanner", "ai", "cli"],
15
15
  "author": "VerBodh <support@verbodh.com>",
16
- "license": "UNLICENSED"
16
+ "license": "SEE LICENSE IN LICENSE.md"
17
17
  }
@@ -64,7 +64,7 @@ from pathlib import Path
64
64
  # that npm no longer hosts the package. Starting at 1.0.0 rather than continuing
65
65
  # the npm package's 0.1.x line: that counter belonged to the wrapper, not to
66
66
  # this file, and reusing it would suggest a continuity that does not exist.
67
- SECSCAN_VERSION = "1.2.1"
67
+ SECSCAN_VERSION = "1.3.0"
68
68
 
69
69
  SEVERITIES = ["critical", "high", "medium", "low", "info"]
70
70
  SEVERITY_RANK = {s: i for i, s in enumerate(SEVERITIES)}
@@ -430,6 +430,50 @@ def git_ignored(root: Path, rels: list) -> set:
430
430
  return {l.strip() for l in p.stdout.splitlines() if l.strip()}
431
431
 
432
432
 
433
+ # Plan 11 G6: test code inside a normal file holds fake keys as often as a test folder
434
+ # does (a Rust #[cfg(test)] module, a #[test] fn, a Python test_ function). Its lines are
435
+ # suppressed and counted like a test path.
436
+ # ponytail: braces are counted without parsing strings or comments, so a brace inside a
437
+ # string can end a Rust block early; a real parser is the upgrade if that misses cases.
438
+ RUST_TEST_ATTR = re.compile(r"^\s*#\[(cfg\(test\)|test)\]")
439
+ PY_TEST_DEF = re.compile(r"^(\s*)(async\s+)?def test_\w*\s*\(")
440
+
441
+
442
+ def test_code_lines(rel: str, text: str) -> set:
443
+ lines = text.splitlines()
444
+ out = set()
445
+ if rel.endswith(".rs"):
446
+ i = 0
447
+ while i < len(lines):
448
+ if not RUST_TEST_ATTR.match(lines[i]):
449
+ i += 1
450
+ continue
451
+ depth, opened, j = 0, False, i
452
+ while j < len(lines):
453
+ depth += lines[j].count("{") - lines[j].count("}")
454
+ opened = opened or "{" in lines[j]
455
+ out.add(j + 1)
456
+ if opened and depth <= 0:
457
+ break
458
+ j += 1
459
+ i = j + 1
460
+ elif rel.endswith(".py"):
461
+ i = 0
462
+ while i < len(lines):
463
+ m = PY_TEST_DEF.match(lines[i])
464
+ if not m:
465
+ i += 1
466
+ continue
467
+ indent = len(m.group(1))
468
+ out.add(i + 1)
469
+ j = i + 1
470
+ while j < len(lines) and (not lines[j].strip() or len(lines[j]) - len(lines[j].lstrip()) > indent):
471
+ out.add(j + 1)
472
+ j += 1
473
+ i = j
474
+ return out
475
+
476
+
433
477
  def scan_secrets(root: Path) -> Section:
434
478
  sec = Section("Committed secrets")
435
479
  sec.ran.append(f"{len(SECRET_RULES)} high-confidence patterns")
@@ -441,13 +485,16 @@ def scan_secrets(root: Path) -> Section:
441
485
  text = path.read_text(errors="ignore")
442
486
  except OSError:
443
487
  continue
488
+ in_test = None
444
489
  for _id, severity, rx, desc in SECRET_RULES:
445
490
  for m in rx.finditer(text):
446
491
  line_no = text.count("\n", 0, m.start()) + 1
447
492
  line = text.splitlines()[line_no - 1] if line_no <= len(text.splitlines()) else ""
448
493
  if EXAMPLE_MARKERS.search(line):
449
494
  continue
450
- if is_fixture:
495
+ if in_test is None:
496
+ in_test = test_code_lines(rel, text)
497
+ if is_fixture or line_no in in_test:
451
498
  suppressed += 1
452
499
  continue
453
500
  hit = m.group(0)
@@ -477,7 +524,7 @@ def scan_secrets(root: Path) -> Section:
477
524
 
478
525
  if suppressed:
479
526
  sec.skipped.append(
480
- f"{suppressed} match(es) in test/fixture/doc paths were suppressed "
527
+ f"{suppressed} match(es) in test code, test/fixture/doc paths were suppressed "
481
528
  "as expected fake credentials — re-check by hand if a real secret "
482
529
  "could have been committed to a test file")
483
530
  return sec