sourcecode 4.10.2__py3-none-any.whl → 4.10.3__py3-none-any.whl

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.

Potentially problematic release.


This version of sourcecode might be problematic. Click here for more details.

sourcecode/__init__.py CHANGED
@@ -4,4 +4,4 @@ ASK Engine is the product. ``ask`` is the canonical CLI command; ``sourcecode``
4
4
  the legacy compatibility alias and the Python/PyPI package name. See
5
5
  docs/PRODUCT_IDENTITY.md (normative)."""
6
6
 
7
- __version__ = "4.10.2"
7
+ __version__ = "4.10.3"
@@ -111,8 +111,8 @@ _IS_REFERENCE = re.compile(r"[$@]\{[^}]+\}|^\s*$|^\s*ENC\(|^\s*\*+\s*$")
111
111
  #: XML elements whose text is a configured VALUE. Servlet/JEE spec vocabulary.
112
112
  _DESCRIPTOR_VALUE = re.compile(
113
113
  r"<(?P<tag>param-value|env-entry-value|value|property|password)\b[^>]*>"
114
- r"(?P<value>[^<]*)</(?P=tag)>",
115
- re.IGNORECASE,
114
+ r"(?P<value>.*?)</(?P=tag)>",
115
+ re.IGNORECASE | re.DOTALL,
116
116
  )
117
117
 
118
118
  _DESCRIPTOR_INIT_PARAM = re.compile(
@@ -124,8 +124,8 @@ _DESCRIPTOR_PARAM_NAME = re.compile(
124
124
  re.IGNORECASE,
125
125
  )
126
126
  _DESCRIPTOR_PARAM_VALUE = re.compile(
127
- r"<param-value\b[^>]*>(?P<value>[^<]*)</param-value>",
128
- re.IGNORECASE,
127
+ r"<param-value\b[^>]*>(?P<value>.*?)</param-value>",
128
+ re.IGNORECASE | re.DOTALL,
129
129
  )
130
130
  _JAVAMELODY_CREDENTIAL_PARAMS: frozenset[str] = frozenset({
131
131
  "authorized-users",
@@ -364,7 +364,14 @@ def _scan_descriptor(text: str, rel: str) -> "list[SecurityConfigObservation]":
364
364
  holds a reference and is not reported; one that carries a digest literal
365
365
  holds the credential itself, in a file under version control.
366
366
  """
367
+ def _xml_value(raw: str) -> str:
368
+ value = raw.strip()
369
+ if value.startswith("<![CDATA[") and value.endswith("]]>"):
370
+ value = value[len("<![CDATA["):-len("]]>")]
371
+ return value.strip()
372
+
367
373
  out: "list[SecurityConfigObservation]" = []
374
+ javamelody_value_offsets: set[int] = set()
368
375
  for param in _DESCRIPTOR_INIT_PARAM.finditer(text):
369
376
  body = param.group("body")
370
377
  name_m = _DESCRIPTOR_PARAM_NAME.search(body)
@@ -372,22 +379,29 @@ def _scan_descriptor(text: str, rel: str) -> "list[SecurityConfigObservation]":
372
379
  if name_m is None or value_m is None:
373
380
  continue
374
381
  name = name_m.group("value").strip().lower()
375
- value = value_m.group("value").strip()
382
+ value = _xml_value(value_m.group("value"))
376
383
  if name not in _JAVAMELODY_CREDENTIAL_PARAMS:
377
384
  continue
378
385
  if not value or _IS_REFERENCE.search(value):
379
386
  continue
380
387
  if ":" not in value:
381
388
  continue
382
- if _DIGEST_LITERAL.search(value):
383
- continue
384
389
  user = value.split(":", 1)[0].strip() or "user"
390
+ value_offset = param.start("body") + value_m.start("value")
391
+ javamelody_value_offsets.add(value_offset)
392
+ digest = _DIGEST_LITERAL.search(value)
393
+ evidence = (
394
+ f"<param-value>{user}:…{{{digest.group('algo')}}}"
395
+ f"{digest.group('digest')[:8]}…</param-value>"
396
+ if digest is not None
397
+ else f"<param-value>{user}:…</param-value>"
398
+ )
385
399
  out.append(SecurityConfigObservation(
386
400
  rule="SEC-007",
387
401
  file=rel,
388
- line=_line_of(text, param.start() + value_m.start()),
402
+ line=_line_of(text, value_offset),
389
403
  symbol=rel,
390
- evidence=f"<param-value>{user}:…</param-value>",
404
+ evidence=evidence,
391
405
  detail=(
392
406
  "JavaMelody authorized-users stores a monitoring-console credential "
393
407
  "directly in the deployment descriptor. The value is redacted here; "
@@ -395,7 +409,9 @@ def _scan_descriptor(text: str, rel: str) -> "list[SecurityConfigObservation]":
395
409
  ),
396
410
  ))
397
411
  for match in _DESCRIPTOR_VALUE.finditer(text):
398
- value = match.group("value").strip()
412
+ if match.start("value") in javamelody_value_offsets:
413
+ continue
414
+ value = _xml_value(match.group("value"))
399
415
  if not value or _IS_REFERENCE.search(value):
400
416
  continue
401
417
  digest = _DIGEST_LITERAL.search(value)
@@ -508,7 +508,8 @@ def _line_of(source: str, offset: int) -> int:
508
508
  _JAVA_METHOD_RE = re.compile(
509
509
  r"(?P<mods>(?:(?:public|protected|private|static|final|synchronized|abstract|native)\s+)*)"
510
510
  r"(?P<ret>[\w.$<>\[\], ?]+)\s+"
511
- r"(?P<name>[a-zA-Z_][\w$]*)\s*\([^;{}]*\)\s*(?:throws\s+[^{]+)?\{",
511
+ r"(?P<name>(?!(?:if|for|while|switch|catch|synchronized|return|new|throw|try|else|do)\b)"
512
+ r"[a-zA-Z_][\w$]*)\s*\([^;{}]*\)\s*(?:throws\s+[^{]+)?\{",
512
513
  re.MULTILINE,
513
514
  )
514
515
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 4.10.2
3
+ Version: 4.10.3
4
4
  Summary: Persistent structural context and ultra-fast repeated analysis for AI coding agents
5
5
  License-File: LICENSE
6
6
  Keywords: agents,ai,codebase,context,developer-tools,llm
@@ -42,7 +42,7 @@ Description-Content-Type: text/markdown
42
42
 
43
43
  **Context · Impact · Migration · Architecture · Review — everything from one structural model.**
44
44
 
45
- ![Version](https://img.shields.io/badge/version-4.10.2-blue)
45
+ ![Version](https://img.shields.io/badge/version-4.10.3-blue)
46
46
  ![Python](https://img.shields.io/badge/python-3.9%2B-green)
47
47
 
48
48
  > **ASK Engine** is the product. The CLI command is **`ask`**. The legacy **`sourcecode`**
@@ -106,7 +106,7 @@ brew tap haroundominique/sourcecode && brew install sourcecode
106
106
  # pip / pipx
107
107
  pipx install sourcecode # or: pip install sourcecode
108
108
 
109
- ask version # ask 4.10.2 — and, on a build that has aged,
109
+ ask version # ask 4.10.3 — and, on a build that has aged,
110
110
  # how many releases have probably shipped since
111
111
  ```
112
112
 
@@ -1,4 +1,4 @@
1
- sourcecode/__init__.py,sha256=xskHY5rRjTUnc0g0owXUqwzO6Eu4fz6BniL2gUx5fz0,309
1
+ sourcecode/__init__.py,sha256=kRwEKt8ufgmTyXFYrYP-5dM5o3eTQYMoUFRLOvoQ0as,309
2
2
  sourcecode/adaptive_scanner.py,sha256=yJBKjNpkY6bpueYJ2YnRezen3sYZDecEt7WaaNWdqug,9466
3
3
  sourcecode/archetype.py,sha256=CZvRLpkHot_D8D3JFQVorr-EHDJyh0BbS7RnSTqBigM,40499
4
4
  sourcecode/architectural_baseline.py,sha256=agDSwGEakdkgLLh5xnd3hiD_TC6pRujWt4klnuYF1wo,18689
@@ -103,7 +103,7 @@ sourcecode/sarif.py,sha256=3hQEegUxIZbojFdY59oB-yKsK-rnafHdTNmYsEP2--A,25984
103
103
  sourcecode/scanner.py,sha256=z3CV0rcGunu0Y8mpNgp07wI7nxT0pxw1BkXRRtI0Rpo,9609
104
104
  sourcecode/schema.py,sha256=aHNXDf8LGyUC8ZDE_VS9kiskC2-Oswhi_WnpdGy6HDw,24897
105
105
  sourcecode/security_config.py,sha256=KblMEoRiEjrIE68YsPaUAFebxFp8UM7MS7lAk5CGD8U,3531
106
- sourcecode/security_config_scan.py,sha256=aG2gqhPrjDpYwqML3Sqg-6_FtJWKmlyy9ceMBd4FHSo,26570
106
+ sourcecode/security_config_scan.py,sha256=RDxBNm7oVdAaY6gbQgeA2FjHy2pVc6MPRnrBwTnASqY,27247
107
107
  sourcecode/security_posture.py,sha256=CjJ2Qm87HhKXepnaWx1ncJLW-SxI18udCmUDIkCyAsY,50270
108
108
  sourcecode/semantic_analyzer.py,sha256=bpgdC6m0_ftVtRf3rSdwhbhWjnZnGxRXaZVcfe4BbcQ,95414
109
109
  sourcecode/semantic_impact_engine.py,sha256=t09IirGC3JjQDy33JZd1_WKzQVKXkoNl3-XEUr5kjis,20563
@@ -118,7 +118,7 @@ sourcecode/spring_impact.py,sha256=keWoE1tN5B_SzJx9F-53RKEL0b2edhJdZMTfocmJZLY,8
118
118
  sourcecode/spring_model.py,sha256=zOAgFmrRbG4a6KLm1TJl55aWMyPNsz3OS3FSczqPG6A,16594
119
119
  sourcecode/spring_profiles.py,sha256=-kwrCK0O-MRjrCp6SA1d31t--o4Tg87iqPVrTwxoIUs,19605
120
120
  sourcecode/spring_properties.py,sha256=kPTk5qAJxdbHc1hclhHAP0O-hCIzBn8PTh3lzl-I4a4,8400
121
- sourcecode/spring_security_audit.py,sha256=KKsJCKUI35KiI47E9ydsDsUuom20lz_OBbzyvyDBlKU,46172
121
+ sourcecode/spring_security_audit.py,sha256=KkhIx1WhAD9ccw3P-CcHP3d8p0OAOivKT5CrX2Zuq8k,46257
122
122
  sourcecode/spring_semantic.py,sha256=UrmLg_4gmBVmMqvSnUMgSReVEERVGv3X7LYDBEs6k_o,16598
123
123
  sourcecode/spring_tx_analyzer.py,sha256=_wqjRktqdPS6PiXXxtTkCD1t6BaE2uhqx6ioYY-ULAw,44153
124
124
  sourcecode/summarizer.py,sha256=0aD4x3vgPngqBCEBKGuES1J2Vk5f7mqCm_ZWErwm3js,27025
@@ -193,8 +193,8 @@ sourcecode/telemetry/consent.py,sha256=pQdl-QeLl6Gcibn0eWHSKZrm-HYSsjpVqOnjrgFp8
193
193
  sourcecode/telemetry/events.py,sha256=4_yeO58U-Cwc1Qb27VB0_EjhmroY0k91n3_VGxeALB8,2776
194
194
  sourcecode/telemetry/filters.py,sha256=RzxauTz8HliO4BllQnXEXc7zTeqdCZi5MgqGEDuW7OQ,6570
195
195
  sourcecode/telemetry/transport.py,sha256=4gGHsq0WeY9VywEZXA3vUxykfiYnw9uuqfjAAec7F8o,1681
196
- sourcecode-4.10.2.dist-info/METADATA,sha256=LpRICJiZXofZyp2RYC7EnsTKURHjIHQLvktzU_ABEzM,36657
197
- sourcecode-4.10.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
198
- sourcecode-4.10.2.dist-info/entry_points.txt,sha256=-JEAdChrK5We51kZcb7OaDcyil-dHBjBPL-NhuO-QY8,89
199
- sourcecode-4.10.2.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
200
- sourcecode-4.10.2.dist-info/RECORD,,
196
+ sourcecode-4.10.3.dist-info/METADATA,sha256=6_uj0P5A9uKdHBcaXMZQic-g9lTXCknIu4m9X9sYj1g,36657
197
+ sourcecode-4.10.3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
198
+ sourcecode-4.10.3.dist-info/entry_points.txt,sha256=-JEAdChrK5We51kZcb7OaDcyil-dHBjBPL-NhuO-QY8,89
199
+ sourcecode-4.10.3.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
200
+ sourcecode-4.10.3.dist-info/RECORD,,