Add legal artifact presets, FOSSA-compatible outputs#199
Open
lelia wants to merge 33 commits into
Open
Conversation
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
|
🚀 Preview package published! Install with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.2.89.dev4Docker image: |
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
|
❌ Version Check Failed Please increment... |
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Real FOSSA artifacts use \$ as the revision separator in project.id, not \-. Update _build_project_metadata and add two tests that pin the correct separator and fallback behaviour.
Adds customRiskScore: None to vulnerability entries (FOSSA samples include this field, sometimes null). Documents all gap fields and their defaults in the module docstring. Locks the new key in EXPECTED_VULNERABILITY_KEYS.
Replaces the 2-key {project, dependencies} shape with the real FOSSA
attribution shape: copyrightsByLicense, deepDependencies,
directDependencies, licenses, project.
The SBOM project field is now the 2-key {name, revision} subset rather
than the 6-key analyze project shape. _partition_dependencies is a stub
returning ([], []) until Tasks 7-9 fill in per-dependency entries.
Add _build_dependency_entry and _build_dependency_licenses to produce the 14-key per-dependency dict that matches real FOSSA attribution output. License entries prefer licenseAttrib (full attribText + spdxExpr), fall back to declared license string, or emit [] when unlicensed. Also removes the stale test_fossa_attribution_payload_shape_is_stable test, which asserted the pre-Task-6 two-key shape and was already failing.
Replaces the stub that always returned [package.name] with real logic: direct deps emit just their name; transitive deps emit one "<ancestor> > <package>" chain per top-level ancestor, falling back to name-only when ancestors are absent or not in the lookup.
Pin project.id to dollar separator, replace 2-key SBOM with 5-key shape, and update per-dependency assertions to the 14-key _build_dependency_entry contract.
Contributor
Author
|
Eric Hibbs (@flowstate) review notes:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a compliance-oriented
--legalworkflow tosocketcliand an opt-in--legal-format fossamode for producing FOSSA-compatible artifact shapes.Changes
The
--legalworkflow enables license generation and default artifact output for:socket-report.jsonsocket-summary.txtsocket-report-link.txtsocket-sbom.jsonsocket-license.jsonThe new
--legal-format fossamode adapts those outputs to match the structural shapes the real FOSSA CLI emits — captured from a UiPath Azure DevOps FOSSA pipeline as reference (CE-199):fossa-analyze.json— the composed wrapper FOSSA pipelines actually produce:{project, vulnerability[], licensing[], quality[]}. Theprojectsub-object is the 6-keyfossa analyze --jsonshape withidformatted as<projectLocator>$<revision>.vulnerability[]items follow the/api/v2/issuesshape (28 fields includingsource,depths,statuses,projects[],remediation,metrics,epss, etc.).fossa-sbom.json— thefossa report --json attributionshape: 5 top-level keys (copyrightsByLicense,deepDependencies,directDependencies,licenses,project). Per-Dependencyentries are the 14-key FOSSA attribution shape, with attribution text sourced fromPackage.licenseAttrib[].attribText, direct/deep partitioning byPackage.direct, anddependencyPathsas<ancestor> > <package>chains computed fromtopLevelAncestors.fossa-analyze.json,fossa-test.txt,fossa-link.txt,fossa-sbom.json. The Socket-side--sbom-fileslot is suppressed in fossa mode (the FOSSA "SBOM" artifact is the attribution payload).indent=2.Adds
Documented gaps
Fields with no Socket data source are emitted as consistent documented defaults (see module docstring at top of
socketsecurity/fossa_compat.py). Examples:vulnerability[].epss,cvssVector,exploitability,cveStatus,published,customRiskScore, project timestamps, semver-distance labels; per-dependencydescription,downloadUrl,projectUrl,hash,isGolang,notes,otherLicenses; top-levelcopyrightsByLicenseandlicensesbody-text map.partialFixandcompleteFixcollapse to the same value since Socket has only one fix-version concept.Testing
--legaland--legal-formatdefaultstests/unit/test_fossa_parity.py) that load real FOSSA artifacts captured from the UiPath pipeline (committed totests/fixtures/fossa/) and assert our builder output's keysets match at every level (top-level, project, dependency). These guard against future drift from FOSSA's actual shape.Test plan
uv run pytest tests/)--legal-format fossaand confirm outputs satisfy the customer's validation pipeline gate (file exists, non-empty, parseable JSON for the two JSON files)