Skip to content

Reject SPDX exports when file checksums are missing - #5414

Open
Shrashti1234 wants to merge 1 commit into
aboutcode-org:developfrom
Shrashti1234:reject-missing-spdx-file-checksums
Open

Shrashti1234 wants to merge 1 commit into
aboutcode-org:developfrom
Shrashti1234:reject-missing-spdx-file-checksums

Conversation

@Shrashti1234

@Shrashti1234 Shrashti1234 commented Nov 4, 2026 •

Copy link
Copy Markdown

Fixes #3453.

A file without a SHA1 currently receives the SHA1 of an empty file in SPDX output. This misrepresents the file and produces an incorrect package verification code. Reject that export with a clear error naming the file and explaining that a scan with --info is needed to collect checksums.

Known SHA1 values remain unchanged. Files identified as empty retain their correct empty-file hash, and directories do not require checksums. This applies to both Tag/Value and RDF output.

Changes and validation

  • Added 18 writer/CLI regression cases covering absent, null, and empty SHA1 values; known checksums; empty files; directories; CLI errors; and scans with --info.
  • The six missing-SHA1 writer cases fail on the original implementation.
  • Updated the Unicode-path scan fixture with the actual checksum of an included synthetic SVG, preserving its export coverage.
  • Updated the CLI documentation, warning text, changelog, and contributor list.
  • Full SPDX export suite: 38 passed on Windows 11 / CPython 3.14.2:
    python -m pytest tests/formattedcode/test_output_spdx.py --test-suite=all -q --tb=short --disable-warnings
  • Ruff and git diff --check passed. Commits include DCO sign-off.

The repository-wide suite was not run locally. Known base-branch FSL metadata and parallel test-runner CI issues are covered separately by #5408. Hosted checks for this PR are pending.

Stop substituting the empty-file SHA1 for files whose checksum is unknown. Raise a clear error directing users to collect checksums with --info, while preserving known checksums and the empty-file special case.

Add writer and CLI regressions for both SPDX formats, document the requirement, and give the Unicode scan fixture the checksum of its included synthetic SVG. The full SPDX suite passes: 38 tests on Windows/Python 3.14.2.

Fixes aboutcode-org#3453

Signed-off-by: Shrashti1234 <sharishhtia@gmail.com>
@Shrashti1234
Shrashti1234 force-pushed the reject-missing-spdx-file-checksums branch from 035fdb3 to c5e84a4 Compare November 5, 2026 04:22

This branch has not been deployed

No deployments
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.

SPDX output sets invalid empty checksums

1 participant