Skip to content

Conversation

@zlav
Copy link
Member

@zlav zlav commented Jun 12, 2025

Overview

This ticket solves an issue where a symlink between a container images's layers is blocking our JARs in Containers analysis from completing, which results in the overall CLI container analysis failing.

Delivers https://fossa.atlassian.net/browse/ANE-2474

Acceptance criteria

  • Symlinked JARs do not cause a failure of the whole scan.

Testing plan

  • I downloaded the impacted JAR from the ticket

  • I ran the old version on it and saw the same failure the user is seeing

  • I ran the updated version in this PR and saw that only 1 JAR failed to be unzipped, but that the others succeeded.

  • I added a test to the nested_jars.tar test that has a symlinked tar. The previous version of the CLI wasn't able to successfully analyze this and failed on the current test suite.

  • You will see a warn log line if you run fossa analyze --debug when analyzing this tar file with the new CLI.

Risks

This method warns and skips any JAR it comes across that fails extraction. This could result in unintended consequences with JARs that we truly have issues unarchiving. I believe this trade off is worth it. The customer issue in 2474 is solved by this fix and is the first time we have been pushed to deal with JAR extraction issues. Additionally, the error is not swallowed, it is still warned and we can see what happens.

References

ANE-2474: Implement a fix for unzipping symlinked jars

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).
  • If this PR introduced a user-visible change, I added documentation into docs/.
  • If this PR added docs, I added links as appropriate to the user manual's ToC in docs/README.ms and gave consideration to how discoverable or not my documentation is.
  • If this change is externally visible, I updated Changelog.md. If this PR did not mark a release, I added my changes into an ## Unreleased section at the top.
  • If I made changes to .fossa.yml or fossa-deps.{json.yml}, I updated docs/references/files/*.schema.json AND I have updated example files used by fossa init command. You may also need to update these if you have added/removed new dependency type (e.g. pip) or analysis target type (e.g. poetry).
  • If I made changes to a subcommand's options, I updated docs/references/subcommands/<subcommand>.md.

@zlav zlav marked this pull request as ready for review June 19, 2025 01:48
@zlav zlav requested a review from a team as a code owner June 19, 2025 01:48
@zlav zlav requested a review from spatten June 19, 2025 01:48
Copy link
Contributor

@spatten spatten left a comment

Choose a reason for hiding this comment

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

This looks good to me!

Can you make sure you have git lfs installed? It should be as easy as

brew install git-lfs

I had to fix an error in the nested_jars.tar file where it wasn't set up in LFS correctly. This might be me, as I've run into this a few times, but some Googling seems to say it happens if someone commits a large file and does not have LFS setup.

I had to do this:

git add --renormalize .
git commit -m 'fix LFS files'
git push

@zlav zlav changed the title fix the unzip issue Fix unzipping JARs that symlink to other layers Jun 23, 2025
@zlav zlav enabled auto-merge (squash) June 25, 2025 00:28
@zlav zlav merged commit 87190a7 into master Jun 25, 2025
19 checks passed
@zlav zlav deleted the fix/symlink-unzip branch June 25, 2025 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants