Skip to content

Not print vulnerability info. for jar analysis#204

Merged
bjk7119 merged 6 commits into
mainfrom
timeout
May 20, 2026
Merged

Not print vulnerability info. for jar analysis#204
bjk7119 merged 6 commits into
mainfrom
timeout

Conversation

@bjk7119
Copy link
Copy Markdown
Contributor

@bjk7119 bjk7119 commented May 8, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Removed the Vulnerability Link column from binary analysis output.
  • Refactor

    • Replaced dependency-check workflow with direct JAR introspection and optional repository lookups for OSS/license data.
    • Simplified binary analysis and data merging to rely on JAR-derived results.
  • Chores

    • Added a .gitignore to exclude environment and common build/test artifacts.
    • Removed bundled third‑party dependency-check artifacts and updated licensing metadata.

Review Change Stack

@bjk7119 bjk7119 requested a review from soimkim May 8, 2026 05:24
@bjk7119 bjk7119 self-assigned this May 8, 2026
@bjk7119 bjk7119 added the chore [PR/Issue] Refactoring, maintenance the code label May 8, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaces OWASP dependency-check with direct JAR introspection and optional Maven Central POM lookup; removes vulnerability tracking and bundled dependency-check artifacts; updates merge logic and binary output schema to drop vulnerability links.

Changes

JAR Analysis and Merge

Layer / File(s) Summary
Direct JAR parsing and Maven Central lookup
src/fosslight_binary/_jar_analysis.py
Implements SHA-1 computation, extracts META-INF/maven/**/pom.xml and META-INF/MANIFEST.MF, queries Maven Central by SHA-1 with retry/timeout and a one-time network warning, downloads POM for license derivation, falls back to embedded POM/manifest, and returns (jar_items, success) (no vulnerability items).
merge_binary_list and binary analysis wiring
src/fosslight_binary/_jar_analysis.py, src/fosslight_binary/binary_analysis.py
merge_binary_list simplified to (jar_items, bin_list), matches by source path or SHA-1 and sets found_in_jar_analysis; find_binaries now calls analyze_jar_file(...) and merges jar-derived items only; removes OWASP/vulnerability merge paths and Java-version checks.
BinaryItem output and DB gating
src/fosslight_binary/_binary.py, src/fosslight_binary/_binary_dao.py
Removes vulnerability-related constants/types and Vulnerability Link output column. BinaryItem no longer holds vulnerability items and replaces found_in_owasp with found_in_jar_analysis; get_print_array() output schema updated; DB OSS accumulation now uses found_in_jar_analysis.

Packaging and Repository Cleanup

Layer / File(s) Summary
Remove bundled dependency-check from packaging
cli.spec, pyproject.toml
Removes third_party/dependency-check entries from PyInstaller datas and clears package-data globs for fosslight_binary; adds defusedxml to dependencies.
Repository housekeeping
.gitignore, .reuse/dep5
Adds .gitignore for .env, Python build/test artifacts, and Fosslight report/log files; updates .reuse/dep5 licensing stanzas for cli.spec and .gitignore.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested reviewers

  • dd-jy
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of removing vulnerability information output from the JAR analysis workflow, which is the central theme across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch timeout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/fosslight_binary/_jar_analysis.py (1)

208-209: ⚡ Quick win

Elevate missing no_nvd.properties log level to warning.

If this file goes missing, behavior silently degrades; debug can hide packaging/runtime regressions during normal operation.

Proposed tweak
-    else:
-        logger.debug(f"no_nvd.properties not found at {_NO_NVD_PROPERTIES}.")
+    else:
+        logger.warning(f"no_nvd.properties not found at {_NO_NVD_PROPERTIES}.")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` around lines 208 - 209, The current
else branch that logs the missing no_nvd.properties file uses logger.debug which
can hide missing-file issues; update the logging call in the else branch that
references _NO_NVD_PROPERTIES to logger.warning (or logger.warn) and craft a
concise message indicating the file was not found so missing no_nvd.properties
is elevated to a warning level; locate the else block that currently calls
logger.debug(f"no_nvd.properties not found at {_NO_NVD_PROPERTIES}.") and
replace it with a warning-level log using the same _NO_NVD_PROPERTIES symbol.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fosslight_binary/_binary.py`:
- Around line 73-75: The items.append call in _binary.py currently inserts one
extra empty placeholder causing no-OSS rows to have more columns than OSS rows;
update the items.append for the no-OSS case to match the exact column count used
for OSS rows by removing the extra empty placeholder (adjust the list built in
items.append that includes self.source_name_or_path, exclude, self.comment,
self.tlsh, self.checksum so the number and order of elements match the OSS-row
construction).

---

Nitpick comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Around line 208-209: The current else branch that logs the missing
no_nvd.properties file uses logger.debug which can hide missing-file issues;
update the logging call in the else branch that references _NO_NVD_PROPERTIES to
logger.warning (or logger.warn) and craft a concise message indicating the file
was not found so missing no_nvd.properties is elevated to a warning level;
locate the else block that currently calls logger.debug(f"no_nvd.properties not
found at {_NO_NVD_PROPERTIES}.") and replace it with a warning-level log using
the same _NO_NVD_PROPERTIES symbol.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 571242a5-3051-445d-b7cf-50d887450601

📥 Commits

Reviewing files that changed from the base of the PR and between e277289 and c947d64.

📒 Files selected for processing (6)
  • .gitignore
  • pyproject.toml
  • src/fosslight_binary/_binary.py
  • src/fosslight_binary/_jar_analysis.py
  • src/fosslight_binary/binary_analysis.py
  • src/fosslight_binary/no_nvd.properties

Comment thread src/fosslight_binary/_binary.py
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/fosslight_binary/_jar_analysis.py (1)

87-96: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Treat checksum matches as matched before creating the fallback row.

When bin.checksum == sha1, the OSS list is merged but found stays False, so the fallback block still appends a synthetic BinaryItem. That can duplicate the same jar in the report whenever the path differs but the checksum matches.

Proposed fix
             else:
                 if bin.checksum == sha1:
+                    found = True
                     merge_oss_and_vul_items(bin, oss_list)

         if not found:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` around lines 87 - 96, The code merges
OSS items when bin.checksum == sha1 but never marks the file as found, causing a
fallback BinaryItem to be appended; inside the checksum match branch (the if
comparing bin.checksum and sha1) set found = True (and optionally break/return
from the loop if appropriate) so the subsequent fallback block that creates a
new BinaryItem and appends to not_found_bin is skipped; update the logic around
merge_oss_and_vul_items, the checksum comparison, and the variable found to
reflect a successful match.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Around line 87-96: The code merges OSS items when bin.checksum == sha1 but
never marks the file as found, causing a fallback BinaryItem to be appended;
inside the checksum match branch (the if comparing bin.checksum and sha1) set
found = True (and optionally break/return from the loop if appropriate) so the
subsequent fallback block that creates a new BinaryItem and appends to
not_found_bin is skipped; update the logic around merge_oss_and_vul_items, the
checksum comparison, and the variable found to reflect a successful match.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 346e0196-47fd-4429-812a-c7da5584c8d1

📥 Commits

Reviewing files that changed from the base of the PR and between c947d64 and d82200a.

📒 Files selected for processing (6)
  • .reuse/dep5
  • pyproject.toml
  • src/fosslight_binary/_binary.py
  • src/fosslight_binary/_jar_analysis.py
  • src/fosslight_binary/binary_analysis.py
  • src/fosslight_binary/no_nvd.properties
✅ Files skipped from review due to trivial changes (3)
  • .reuse/dep5
  • src/fosslight_binary/no_nvd.properties
  • pyproject.toml

@bjk7119 bjk7119 force-pushed the timeout branch 4 times, most recently from 35a8ba3 to 6bf9cdf Compare May 14, 2026 06:42
@bjk7119 bjk7119 added enhancement [PR/Issue] New feature or request and removed chore [PR/Issue] Refactoring, maintenance the code labels May 14, 2026
@bjk7119 bjk7119 force-pushed the timeout branch 2 times, most recently from 63cb97e to 1b7e70a Compare May 14, 2026 07:27
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/fosslight_binary/binary_analysis.py (1)

28-29: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove dead get_java_version function and its supporting imports.

With OWASP dependency-check removed, get_java_version has no remaining callers. The import subprocess and import re statements (lines 28–29) exist solely to support this function. Removing them alongside the rest of the OWASP removal keeps the PR self-consistent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/binary_analysis.py` around lines 28 - 29, Remove the
dead get_java_version function and its unused supporting imports by deleting the
get_java_version definition and removing the top-level imports of subprocess and
re (which only existed to support that function); update any remaining imports
or linting configuration if necessary to ensure no unused-import warnings remain
and verify no other code references get_java_version.
🧹 Nitpick comments (2)
src/fosslight_binary/_jar_analysis.py (2)

281-336: 💤 Low value

success is never set to False; the caller's failure branch is dead.

analyze_jar_file initializes success = True and never reassigns it, so binary_analysis.py lines 240-243’s else: logger.warning("Could not find OSS information for some jar files.") is unreachable. Either drive success from real failure conditions (e.g., all retries exhausted, or _central_network_warned got tripped) or drop the flag entirely and just return jar_items.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` around lines 281 - 336,
analyze_jar_file currently returns success=True unconditionally; change it to
set success=False whenever a jar does not produce OSS info after all processing
and retries: in the initial for jar_path loop, if _process_one_jar returns
(None, needs_retry=False) for a non-excluded rel_path then set success=False; in
the retry loop, when attempt >= _MAX_RETRY and you call _process_one_jar with
search_timeout=0, if that call returns result is None set success=False; also
set success=False if a jar exhausts retries (i.e., needs_retry remains True
across attempts and never yields a result). Use the existing symbols
analyze_jar_file, success, jar_items, retry_queue, _process_one_jar and
_MAX_RETRY to locate where to assign success=False so the caller can detect
failures.

54-60: 💤 Low value

JAR manifest parser doesn't handle continuation lines per specification.

Per the JAR specification, manifest values longer than 72 bytes are wrapped onto subsequent lines that start with a single space. The current parser treats each physical line independently, silently truncating continued values (e.g., long Bundle-DocURL or Implementation-URL). Unfold continuation lines before splitting:

♻️ Suggested implementation
 def _parse_manifest_bytes(manifest_bytes):
     info = {}
-    for line in manifest_bytes.decode('utf-8', errors='replace').splitlines():
-        if ':' in line:
-            k, _, v = line.partition(':')
-            info[k.strip()] = v.strip()
+    text = manifest_bytes.decode('utf-8', errors='replace')
+    # Unfold continuation lines (per JAR manifest spec: lines starting with a single space).
+    unfolded = re.sub(r'\r?\n ', '', text)
+    for line in unfolded.splitlines():
+        if ':' in line:
+            k, _, v = line.partition(':')
+            info[k.strip()] = v.strip()
     return info

(requires import re)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` around lines 54 - 60, The
_parse_manifest_bytes function currently treats each physical line independently
and drops manifest continuation lines; update _parse_manifest_bytes to first
"unfold" the manifest by decoding bytes, splitting into physical lines, and
joining any line that begins with a single space to the previous physical line
(concatenate without the leading space) before splitting key/value pairs; then
parse each unfolded logical line with the existing partition(':') logic to
populate info. Ensure you operate on the decoded string and preserve existing
error='replace' behavior used in manifest_bytes.decode.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Around line 339-366: In merge_binary_list, avoid empty-SHA1 false positives
and duplicates by only using the checksum branch when sha1 is non-empty; when
bin.checksum == sha1 set bin.found_in_jar_analysis = True and mark found = True
so the item isn't appended to not_found_bin, and then call
bin.set_oss_items(oss_list) as before (use the existing symbols:
merge_binary_list, sha1, bin.checksum, bin.found_in_jar_analysis, found,
set_oss_items, not_found_bin, BinaryItem).
- Around line 313-323: The retry-max-out branch currently calls
_process_one_jar(jar_path, rel_path, sha1='', search_timeout=0) which force-sets
an empty sha1 into the resulting jar_items entry; instead preserve the real sha1
and prevent a Central lookup by either passing the original sha1 through (sha1
variable) and using a flag to suppress central search, or add a
skip_central=True parameter to _process_one_jar and call
_process_one_jar(jar_path, rel_path, sha1, skip_central=True) (or equivalent) so
the real SHA-1 is kept and Central search is disabled when retries are
exhausted.
- Line 12: The code currently imports xml.etree.ElementTree and calls
ET.fromstring in _parse_pom_bytes which is vulnerable; replace the import with
defusedxml.ElementTree (import defusedxml.ElementTree as ET) and update
_parse_pom_bytes to use ET.fromstring (or ET.parse if switching to file-like
input) so entity expansion and external-entity attacks are mitigated; also add
defusedxml to project dependencies (pyproject.toml) so the secure parser is
installed.

---

Outside diff comments:
In `@src/fosslight_binary/binary_analysis.py`:
- Around line 28-29: Remove the dead get_java_version function and its unused
supporting imports by deleting the get_java_version definition and removing the
top-level imports of subprocess and re (which only existed to support that
function); update any remaining imports or linting configuration if necessary to
ensure no unused-import warnings remain and verify no other code references
get_java_version.

---

Nitpick comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Around line 281-336: analyze_jar_file currently returns success=True
unconditionally; change it to set success=False whenever a jar does not produce
OSS info after all processing and retries: in the initial for jar_path loop, if
_process_one_jar returns (None, needs_retry=False) for a non-excluded rel_path
then set success=False; in the retry loop, when attempt >= _MAX_RETRY and you
call _process_one_jar with search_timeout=0, if that call returns result is None
set success=False; also set success=False if a jar exhausts retries (i.e.,
needs_retry remains True across attempts and never yields a result). Use the
existing symbols analyze_jar_file, success, jar_items, retry_queue,
_process_one_jar and _MAX_RETRY to locate where to assign success=False so the
caller can detect failures.
- Around line 54-60: The _parse_manifest_bytes function currently treats each
physical line independently and drops manifest continuation lines; update
_parse_manifest_bytes to first "unfold" the manifest by decoding bytes,
splitting into physical lines, and joining any line that begins with a single
space to the previous physical line (concatenate without the leading space)
before splitting key/value pairs; then parse each unfolded logical line with the
existing partition(':') logic to populate info. Ensure you operate on the
decoded string and preserve existing error='replace' behavior used in
manifest_bytes.decode.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b3bb40cd-6b41-48ff-ae83-053441964c1e

📥 Commits

Reviewing files that changed from the base of the PR and between d82200a and 1b7e70a.

⛔ Files ignored due to path filters (81)
  • src/fosslight_binary/third_party/dependency-check/lib/aho-corasick-double-array-trie-1.2.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/android-json-0.0.20131108.vaadin1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/annotations-26.0.2-1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/ant-1.10.15.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/bcpg-jdk18on-1.78.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/bcprov-jdk18on-1.78.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-cli-1.10.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-codec-1.19.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-collections-3.2.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-collections4-4.5.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-compress-1.27.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-dbcp2-2.13.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-digester-2.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-io-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-jcs3-core-3.2.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-lang3-3.19.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-logging-1.3.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-pool2-2.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-text-1.14.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-validator-1.10.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/compiler-0.9.6.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/cpe-parser-3.0.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/dependency-check-cli-12.1.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/dependency-check-core-12.1.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/dependency-check-utils-12.1.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/error_prone_annotations-2.41.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/failureaccess-1.0.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/gson-2.9.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/guava-33.5.0-jre.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/h2-2.3.232.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpclient5-5.5.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpclient5-cache-5.4.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpcore5-5.3.6.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpcore5-h2-5.3.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/j2objc-annotations-3.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-annotations-2.20.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-core-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-databind-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-dataformat-yaml-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-datatype-jsr310-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-module-blackbird-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jakarta.json-2.0.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jakarta.transaction-api-1.3.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/javax.activation-api-1.2.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/javax.inject-1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/javax.ws.rs-api-2.0.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jaxb-api-2.3.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jcs3-slf4j-1.0.5.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jdiagnostics-1.0.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jmustache-1.16.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/joda-time-2.14.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jsoup-1.21.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jspecify-1.0.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jsr305-3.0.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jul-to-slf4j-1.7.36.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/logback-classic-1.2.13.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/logback-core-1.2.13.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-analysis-common-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-core-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-facet-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-queries-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-queryparser-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-sandbox-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/minlog-1.3.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/open-vulnerability-clients-7.3.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/ossindex-service-api-1.8.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/ossindex-service-client-1.8.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/package-url-java-1.2.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/packager-core-0.21.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/packager-rpm-0.21.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/packageurl-java-1.5.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/pecoff4j-0.0.2.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/retirejs-core-3.0.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/semver4j-5.8.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/slf4j-api-1.7.36.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/snakeyaml-2.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/spotbugs-annotations-4.9.6.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/toml4j-0.7.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/velocity-engine-core-2.4.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/xz-1.9.jar is excluded by !**/*.jar
📒 Files selected for processing (16)
  • .gitignore
  • .reuse/dep5
  • cli.spec
  • pyproject.toml
  • src/fosslight_binary/__init__.py
  • src/fosslight_binary/_binary.py
  • src/fosslight_binary/_binary_dao.py
  • src/fosslight_binary/_jar_analysis.py
  • src/fosslight_binary/binary_analysis.py
  • src/fosslight_binary/third_party/dependency-check/LICENSE.txt
  • src/fosslight_binary/third_party/dependency-check/NOTICE.txt
  • src/fosslight_binary/third_party/dependency-check/README.md
  • src/fosslight_binary/third_party/dependency-check/bin/completion-for-dependency-check.sh
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.bat
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.sh
  • src/fosslight_binary/third_party/dependency-check/licenses/commons-cli/LICENSE.txt
💤 Files with no reviewable changes (9)
  • src/fosslight_binary/third_party/dependency-check/licenses/commons-cli/LICENSE.txt
  • src/fosslight_binary/third_party/dependency-check/NOTICE.txt
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.bat
  • src/fosslight_binary/third_party/dependency-check/README.md
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.sh
  • src/fosslight_binary/third_party/dependency-check/LICENSE.txt
  • src/fosslight_binary/third_party/dependency-check/bin/completion-for-dependency-check.sh
  • cli.spec
  • src/fosslight_binary/init.py
✅ Files skipped from review due to trivial changes (2)
  • .gitignore
  • .reuse/dep5
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/fosslight_binary/_binary.py

Comment thread src/fosslight_binary/_jar_analysis.py Outdated
Comment thread src/fosslight_binary/_jar_analysis.py
Comment thread src/fosslight_binary/_jar_analysis.py
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (3)
src/fosslight_binary/_jar_analysis.py (3)

353-360: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Retry max-out path drops the actual JAR SHA-1.

When retries are exhausted, line 357 calls _process_one_jar(jar_path, rel_path, sha1='', ...), discarding the already-computed SHA-1. The resulting jar_items[rel_path] entry will have "sha1": "", which corrupts SHA-1 matching in merge_binary_list and loses observability.

🛠️ Proposed fix

Pass the real SHA-1 through but skip Central lookup via search_timeout=0:

-                result, _ = _process_one_jar(jar_path, rel_path, sha1='', search_timeout=0)
+                # Skip Central lookup but preserve the real SHA-1
+                result, _ = _process_one_jar(jar_path, rel_path, sha1=sha1, search_timeout=0)

With search_timeout=0, _search_central_by_sha1 will time out immediately, but the SHA-1 will be preserved in the returned result dict (line 315).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` around lines 353 - 360, The retry-max
path is discarding the computed SHA-1 by calling _process_one_jar(jar_path,
rel_path, sha1='', ...); change that call to pass the actual computed sha1
variable (the SHA-1 you computed earlier for this JAR) while still setting
search_timeout=0 so _search_central_by_sha1 is skipped immediately; ensure
jar_items[rel_path] is set from that result so the preserved "sha1" field is
kept for merge_binary_list and observability.

12-12: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use defusedxml.ElementTree for secure XML parsing.

The module parses POM files from arbitrary JAR files using ET.fromstring (line 42), which is vulnerable to XML entity expansion attacks. For a binary scanner processing untrusted artifacts, this is a security concern.

🛡️ Proposed fix
-import xml.etree.ElementTree as ET
+import defusedxml.ElementTree as ET

Also add defusedxml to pyproject.toml dependencies.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` at line 12, Replace the insecure
xml.etree.ElementTree usage with defusedxml by changing the import in
src/fosslight_binary/_jar_analysis.py to import defusedxml.ElementTree as ET and
keep using ET.fromstring where POMs are parsed (the call currently flagged);
also add defusedxml to the project dependencies in pyproject.toml so the secure
parser is installed. Ensure no other xml.etree.ElementTree imports remain in
this module and run tests that exercise the POM parsing to verify behavior is
unchanged.

383-393: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

SHA-1 matching branch has multiple bugs.

The else branch (lines 391-393) has three related defects:

  1. Empty SHA-1 false matches: When sha1 is "" (from retry fallback or failed computation), bin.checksum == sha1 can match unrelated binaries with empty checksums.
  2. found_in_jar_analysis not set: Only the path-match branch sets this flag. Per _binary_dao.py, OSS items are cleared when not item.found_in_jar_analysis, so SHA-1-matched OSS data will be wiped during DB processing.
  3. Duplicate BinaryItem appended: When SHA-1 matches but path doesn't, found stays False, causing a duplicate BinaryItem to be appended.
🐛 Proposed fix
         for bin in bin_list:
             if bin.source_name_or_path == key:
                 found = True
                 for oss in oss_list:
                     if oss.name and oss.license:
                         bin.found_in_jar_analysis = True
                         break
                 bin.set_oss_items(oss_list)
-            else:
-                if bin.checksum == sha1:
-                    bin.set_oss_items(oss_list)
+            elif sha1 and bin.checksum == sha1:
+                found = True
+                for oss in oss_list:
+                    if oss.name and oss.license:
+                        bin.found_in_jar_analysis = True
+                        break
+                bin.set_oss_items(oss_list)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` around lines 383 - 393, The SHA-1
matching branch in the for-loop over bin_list incorrectly matches empty sha1
values, fails to mark matched binaries as found_in_jar_analysis, and leaves the
outer found flag false which can cause duplicates; update the loop (the block
referencing bin.source_name_or_path, key, sha1, bin.checksum, bin.set_oss_items
and the found variable) so that you only attempt checksum matching when sha1 is
non-empty, when checksum matches set bin.found_in_jar_analysis = True and set
found = True (so the binary isn’t appended again), and keep path-match as the
primary branch that also sets found and found_in_jar_analysis before calling
bin.set_oss_items.
🧹 Nitpick comments (1)
src/fosslight_binary/_jar_analysis.py (1)

383-383: 💤 Low value

Avoid shadowing Python builtin bin.

Rename the loop variable to avoid shadowing the builtin function.

♻️ Suggested change
-        for bin in bin_list:
-            if bin.source_name_or_path == key:
+        for bin_item in bin_list:
+            if bin_item.source_name_or_path == key:

(Apply throughout the function)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` at line 383, The loop variable "bin"
in the iteration "for bin in bin_list:" shadows Python's builtin bin(); rename
that variable (e.g., to "bin_entry" or "binary_item") and update every usage
inside the same function (all references to bin, any assignments, method calls,
appends, etc.) to the new name so the builtin is no longer shadowed; apply this
rename consistently for every occurrence tied to "bin_list" within the function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Around line 353-360: The retry-max path is discarding the computed SHA-1 by
calling _process_one_jar(jar_path, rel_path, sha1='', ...); change that call to
pass the actual computed sha1 variable (the SHA-1 you computed earlier for this
JAR) while still setting search_timeout=0 so _search_central_by_sha1 is skipped
immediately; ensure jar_items[rel_path] is set from that result so the preserved
"sha1" field is kept for merge_binary_list and observability.
- Line 12: Replace the insecure xml.etree.ElementTree usage with defusedxml by
changing the import in src/fosslight_binary/_jar_analysis.py to import
defusedxml.ElementTree as ET and keep using ET.fromstring where POMs are parsed
(the call currently flagged); also add defusedxml to the project dependencies in
pyproject.toml so the secure parser is installed. Ensure no other
xml.etree.ElementTree imports remain in this module and run tests that exercise
the POM parsing to verify behavior is unchanged.
- Around line 383-393: The SHA-1 matching branch in the for-loop over bin_list
incorrectly matches empty sha1 values, fails to mark matched binaries as
found_in_jar_analysis, and leaves the outer found flag false which can cause
duplicates; update the loop (the block referencing bin.source_name_or_path, key,
sha1, bin.checksum, bin.set_oss_items and the found variable) so that you only
attempt checksum matching when sha1 is non-empty, when checksum matches set
bin.found_in_jar_analysis = True and set found = True (so the binary isn’t
appended again), and keep path-match as the primary branch that also sets found
and found_in_jar_analysis before calling bin.set_oss_items.

---

Nitpick comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Line 383: The loop variable "bin" in the iteration "for bin in bin_list:"
shadows Python's builtin bin(); rename that variable (e.g., to "bin_entry" or
"binary_item") and update every usage inside the same function (all references
to bin, any assignments, method calls, appends, etc.) to the new name so the
builtin is no longer shadowed; apply this rename consistently for every
occurrence tied to "bin_list" within the function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 573c26a1-e99f-48e9-81ca-ec96ef8246bb

📥 Commits

Reviewing files that changed from the base of the PR and between 1b7e70a and ab59a78.

⛔ Files ignored due to path filters (81)
  • src/fosslight_binary/third_party/dependency-check/lib/aho-corasick-double-array-trie-1.2.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/android-json-0.0.20131108.vaadin1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/annotations-26.0.2-1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/ant-1.10.15.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/bcpg-jdk18on-1.78.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/bcprov-jdk18on-1.78.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-cli-1.10.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-codec-1.19.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-collections-3.2.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-collections4-4.5.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-compress-1.27.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-dbcp2-2.13.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-digester-2.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-io-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-jcs3-core-3.2.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-lang3-3.19.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-logging-1.3.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-pool2-2.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-text-1.14.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/commons-validator-1.10.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/compiler-0.9.6.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/cpe-parser-3.0.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/dependency-check-cli-12.1.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/dependency-check-core-12.1.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/dependency-check-utils-12.1.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/error_prone_annotations-2.41.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/failureaccess-1.0.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/gson-2.9.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/guava-33.5.0-jre.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/h2-2.3.232.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpclient5-5.5.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpclient5-cache-5.4.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpcore5-5.3.6.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/httpcore5-h2-5.3.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/j2objc-annotations-3.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-annotations-2.20.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-core-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-databind-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-dataformat-yaml-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-datatype-jsr310-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jackson-module-blackbird-2.20.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jakarta.json-2.0.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jakarta.transaction-api-1.3.3.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/javax.activation-api-1.2.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/javax.inject-1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/javax.ws.rs-api-2.0.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jaxb-api-2.3.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jcs3-slf4j-1.0.5.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jdiagnostics-1.0.7.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jmustache-1.16.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/joda-time-2.14.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jsoup-1.21.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jspecify-1.0.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jsr305-3.0.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/jul-to-slf4j-1.7.36.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/logback-classic-1.2.13.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/logback-core-1.2.13.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-analysis-common-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-core-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-facet-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-queries-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-queryparser-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/lucene-sandbox-9.12.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/minlog-1.3.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/open-vulnerability-clients-7.3.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/ossindex-service-api-1.8.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/ossindex-service-client-1.8.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/package-url-java-1.2.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/packager-core-0.21.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/packager-rpm-0.21.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/packageurl-java-1.5.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/pecoff4j-0.0.2.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/retirejs-core-3.0.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/semver4j-5.8.0.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/slf4j-api-1.7.36.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/snakeyaml-2.4.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/spotbugs-annotations-4.9.6.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/toml4j-0.7.2.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/velocity-engine-core-2.4.1.jar is excluded by !**/*.jar
  • src/fosslight_binary/third_party/dependency-check/lib/xz-1.9.jar is excluded by !**/*.jar
📒 Files selected for processing (16)
  • .gitignore
  • .reuse/dep5
  • cli.spec
  • pyproject.toml
  • src/fosslight_binary/__init__.py
  • src/fosslight_binary/_binary.py
  • src/fosslight_binary/_binary_dao.py
  • src/fosslight_binary/_jar_analysis.py
  • src/fosslight_binary/binary_analysis.py
  • src/fosslight_binary/third_party/dependency-check/LICENSE.txt
  • src/fosslight_binary/third_party/dependency-check/NOTICE.txt
  • src/fosslight_binary/third_party/dependency-check/README.md
  • src/fosslight_binary/third_party/dependency-check/bin/completion-for-dependency-check.sh
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.bat
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.sh
  • src/fosslight_binary/third_party/dependency-check/licenses/commons-cli/LICENSE.txt
💤 Files with no reviewable changes (9)
  • src/fosslight_binary/third_party/dependency-check/LICENSE.txt
  • cli.spec
  • src/fosslight_binary/third_party/dependency-check/README.md
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.sh
  • src/fosslight_binary/third_party/dependency-check/NOTICE.txt
  • src/fosslight_binary/third_party/dependency-check/licenses/commons-cli/LICENSE.txt
  • src/fosslight_binary/init.py
  • src/fosslight_binary/third_party/dependency-check/bin/dependency-check.bat
  • src/fosslight_binary/third_party/dependency-check/bin/completion-for-dependency-check.sh
✅ Files skipped from review due to trivial changes (2)
  • .gitignore
  • .reuse/dep5
🚧 Files skipped from review as they are similar to previous changes (2)
  • pyproject.toml
  • src/fosslight_binary/binary_analysis.py

@soimkim
Copy link
Copy Markdown
Contributor

soimkim commented May 20, 2026

추후 merge시 squash 로 머지 권장드립니다.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 2 file(s) based on 2 unresolved review comments.

Files modified:

  • pyproject.toml
  • src/fosslight_binary/_jar_analysis.py

Commit: 5b34ada1b26af46bbd81fdc293485924264b97e5

The changes have been pushed to the timeout branch.

Time taken: 3m 19s

Fixed 2 file(s) based on 2 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/fosslight_binary/_jar_analysis.py (1)

386-404: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix the checksum-only merge branch before this ships.

When only the checksum branch on Line 396 matches, found stays False and found_in_jar_analysis is never set. That can both append a duplicate BinaryItem and let downstream code discard the OSS data again. It also still allows empty-SHA1 matches.

🛠️ Minimal fix
     for key, value in jar_items.items():
         found = False
         oss_list = value["oss_list"]
         sha1 = value.get("sha1", "")
         for bin in bin_list:
             if bin.source_name_or_path == key:
                 found = True
                 for oss in oss_list:
                     if oss.name and oss.license:
                         bin.found_in_jar_analysis = True
                         break
                 bin.set_oss_items(oss_list)
-            else:
-                if bin.checksum == sha1:
-                    bin.set_oss_items(oss_list)
+            elif sha1 and bin.checksum == sha1:
+                found = True
+                for oss in oss_list:
+                    if oss.name and oss.license:
+                        bin.found_in_jar_analysis = True
+                        break
+                bin.set_oss_items(oss_list)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_binary/_jar_analysis.py` around lines 386 - 404, The
checksum-only branch currently leaves found=False and doesn't mark the matched
BinaryItem as found in jar analysis or prevent duplicates; modify the else
branch that tests bin.checksum == sha1 to first skip empty sha1 values, and when
a non-empty sha1 matches set bin.set_oss_items(oss_list), set
bin.found_in_jar_analysis = True and set found = True (and optionally break out
once matched) so the existing BinaryItem is updated and not re-added to
not_found_bin; reference BinaryItem, bin_list, oss_list, sha1, bin.checksum,
found_in_jar_analysis, set_oss_items, source_name_or_path.
🧹 Nitpick comments (1)
pyproject.toml (1)

30-30: ⚡ Quick win

Add a version constraint for the security-critical defusedxml dependency.

The defusedxml library is imported in src/fosslight_binary/_jar_analysis.py and actively used for secure XML parsing of Maven POM files. Since this is a security-focused library, add a minimum version constraint to ensure reproducible builds and guard against potential regressions.

Suggested version constraint
-    "defusedxml",
+    "defusedxml>=0.7.0",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyproject.toml` at line 30, Update the pyproject.toml dependency entry for
defusedxml to include a minimum version constraint (e.g., change "defusedxml" to
"defusedxml>=0.7.1") so builds are reproducible and you get the security fixes;
ensure this matches the import usage in src/fosslight_binary/_jar_analysis.py
which relies on defusedxml for secure XML parsing of Maven POMs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Around line 193-205: In _process_one_jar ensure the skip_central flag is
honored for the entire fallback path: do not call _exists_in_central when
skip_central is True. Specifically, after using _search_central_by_sha1 (or when
skip_central short-circuits to central_info={}), guard any subsequent call to
_exists_in_central with if not skip_central and otherwise set
confirmed_in_central = False (or use central_info if available) so the
POM-inspection fallback does not trigger another Maven Central network call;
adjust logic around variables central_info, timed_out, confirmed_in_central and
the _exists_in_central(...) call in _process_one_jar accordingly.

---

Duplicate comments:
In `@src/fosslight_binary/_jar_analysis.py`:
- Around line 386-404: The checksum-only branch currently leaves found=False and
doesn't mark the matched BinaryItem as found in jar analysis or prevent
duplicates; modify the else branch that tests bin.checksum == sha1 to first skip
empty sha1 values, and when a non-empty sha1 matches set
bin.set_oss_items(oss_list), set bin.found_in_jar_analysis = True and set found
= True (and optionally break out once matched) so the existing BinaryItem is
updated and not re-added to not_found_bin; reference BinaryItem, bin_list,
oss_list, sha1, bin.checksum, found_in_jar_analysis, set_oss_items,
source_name_or_path.

---

Nitpick comments:
In `@pyproject.toml`:
- Line 30: Update the pyproject.toml dependency entry for defusedxml to include
a minimum version constraint (e.g., change "defusedxml" to "defusedxml>=0.7.1")
so builds are reproducible and you get the security fixes; ensure this matches
the import usage in src/fosslight_binary/_jar_analysis.py which relies on
defusedxml for secure XML parsing of Maven POMs.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ca7158bb-256c-4579-9996-6ef2c71fa3a0

📥 Commits

Reviewing files that changed from the base of the PR and between ab59a78 and 5b34ada.

📒 Files selected for processing (2)
  • pyproject.toml
  • src/fosslight_binary/_jar_analysis.py

Comment thread src/fosslight_binary/_jar_analysis.py
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • src/fosslight_binary/_jar_analysis.py

Commit: 275de1dd45e2ccf9040e75041a47403a13c8d04a

The changes have been pushed to the timeout branch.

Time taken: 2m 53s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@bjk7119 bjk7119 merged commit 4d78414 into main May 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement [PR/Issue] New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants