Skip to content

Stabilize GitLab report serialization and workspace baselines - #337

Open
lelia wants to merge 5 commits into
mainfrom
lelia/gitlab-integration-stability
Open

Stabilize GitLab report serialization and workspace baselines#337
lelia wants to merge 5 commits into
mainfrom
lelia/gitlab-integration-stability

Conversation

@lelia

@lelia lelia commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • normalize full-scan package identities and links when the SDK returns enum-backed ecosystem types and namespaced packages
  • emit GitLab dependency-scanning CVE and GHSA identifiers from current API payload fields while retaining legacy compatibility
  • resolve implicit diff baselines from the same workspace, scan type, repository, and default branch
  • bump the CLI version to 2.8.1

Why these belong together

These failures occur at the boundaries between Socket API data and GitLab-facing output. Keeping the normalization and baseline rules together gives the integration one consistent compatibility layer instead of addressing each customer symptom independently.

Testing

  • 527 passed, 2 skipped
  • Ruff passed for all changed implementation and test files

Refs: CE-435, CE-438, CE-441

@lelia
lelia requested a review from a team as a code owner September 3, 2026 19:31
@lelia
lelia deployed to socket-firewall September 3, 2026 19:34 — with GitHub Actions Active
lelia and others added 3 commits September 4, 2026 12:07
The workspace-scoped head scan lookup treated any failed request as "no
baseline". The SDK logs and returns {} for every non-200, so a transient API
error resolved to None, and create_new_diff answers None by creating an empty
baseline scan -- reporting every dependency in the repository as newly added.
An absent "results" key now raises APIFailure, and resolve_base_full_scan_id
surfaces it the same way a missing --base-commit-sha baseline is surfaced.

Selecting the newest scan on the default branch also reintroduced temporary
scans, which the repository head pointer had excluded. The empty baseline scan
that create_new_diff creates inherits the branch and commit of the run that
created it, so a default-branch run whose real scan fails leaves that empty scan
as the newest one. Both baseline lookups now skip tmp scans.

Also unwrap scan_type before it is URL encoded. FullScanParams types it as a
ScanType enum, and urlencode renders a (str, Enum) member as its repr-style
name, which would filter on a scan type that does not exist.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Issue.props reaches the GitLab formatter from several sources, and
core.alert_selection already matches both ghsaId/ghsa_id and cveId/cve_id when
deciding reachability. The identifier extractor only read the camelCase
spellings, so an alert carrying ghsa_id was selected for the report but emitted
with only its socket_alert identifier -- the CVE and GHSA values GitLab dedupes
and links on were dropped.

Values that are neither a string nor a sequence are now skipped rather than
iterated, so a malformed prop cannot raise out of the whole report.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fixture named a real organization. Public test data should not, so use the
reserved com.example namespace instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lelia
lelia deployed to socket-firewall September 4, 2026 16:07 — with GitHub Actions Active
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.

1 participant