feat(supplier): the supplier uploads an SBOM through its invite (#1027) #1048

Merged
sharang merged 2 commits from feat/supplier-invite-uploads into main 2026-11-18 11:55:19 +00:00
Owner

Part of #1027 (supplier SBOM epic #1029, phase 3). Stacked on #1047: this PR's base is feat/supplier-invites and will be retargeted to main once #1047 merges.

What it adds

Two more platform endpoints, which the portal calls with its service token. The portal resolves its link token to the invite id.

Call What it does
GET …/tenants/{id}/supplier-invites/{invite}/supplier-view What the supplier's page shows: the component (by the customer's name for it, product and version), the link's end, the CSAF provider, and the uploads through this invite. Nothing else of the workspace.
POST …/tenants/{id}/supplier-invites/{invite}/sboms/check Checks a file before it is uploaded, the same check as the wizard's (/api/v1/supplier-sboms/check). It stores and records nothing. The supplier page shows the format and counts from it.
POST …/tenants/{id}/supplier-invites/{invite}/sboms (multipart file, optional csaf_provider) The supplier's upload. Answers 201 with its record.

How an upload is handled

  • It takes the customer's own upload path. The steps after the file is on disk moved out of upload_artifact into onboarding::attach_upload, and the customer's upload now calls that function too. So the file is read and refused the same way, becomes the component's SBOM, replaces the one before, and keeps its hash and ingested_at.
  • A scan starts (NewContent). Scans already queued for the target are merged as usual.
  • A CSAF provider given with the upload must be https. It becomes the component's provider only when the component has none, so one the customer set stays; the upload record keeps what the supplier gave. A new provider is fetched right away through the guarded client (NetGuard), so it can reach only public addresses.

What is recorded

  • Every upload goes into the tenant's supplier_uploads, refused ones included. Each record has the invite, the time, the file name (with any path removed) and the outcome. A refused one keeps its code: too_large, too_many_components, empty, unknown_format, malformed or csaf_provider.
  • In the invite list, each invite now carries its uploads, and each upload shows whether it is the current SBOM.

What is refused

  • An expired or withdrawn invite answers 410 (expired, withdrawn) and records nothing. An unknown invite, one in another tenant, or one for a component whose supplier was removed answers 404.
  • A workspace that the registry has read-only, halted or archived answers 403 (read_only), as does a registry answer of not entitled. An answer without a status limits nothing, as for a person's request. When the registry cannot answer, the upload gets 503.
  • An invite takes at most 20 uploads a day, refused ones included; more answer 429 (too_many_uploads). Each accepted upload starts a scan the customer pays for, so this caps what a leaked link can cost.

Also

  • Deleting a target deletes its uploads along with its invites.
  • Body limit: 20 MiB plus multipart overhead, as for the SBOM check.
  • Docs: docs/guide/sbom.md.

Tests

  • In tests/supplier_invites.rs:
    • The supplier view.
    • Three versions: each replaces the one before, and the current flag moves.
    • The same file name twice keeps the new SBOM's file.
    • An accepted upload starts a scan (scan_runs).
    • The CSAF provider is set once and not replaced, and a path in the file name is dropped.
    • The invite-scoped check: it records nothing, and it refuses once the supplier is removed.
    • Against a fake registry: active and no-status tenants take the upload; frozen, read-only, halted and not-entitled tenants get 403.
    • Refused uploads are recorded with their codes, while a request with no file is not recorded.
    • Another tenant or an unknown invite gets 404, the daily cap gets 429, and withdrawn or expired invites get 410 with nothing recorded.
  • A unit test for the shown file name. The cascade test now covers uploads.
  • The existing onboarding, upload-change and archive-password tests still pass with attach_upload, which now takes the file name with the upload (five parameters).

Mockup of the portal pages (awaiting approval): https://claude.ai/artifact/FKKpDUkTgY1rezxwJwjXDT

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part of #1027 (supplier SBOM epic #1029, phase 3). **Stacked on #1047**: this PR's base is `feat/supplier-invites` and will be retargeted to `main` once #1047 merges. ## What it adds Two more platform endpoints, which the portal calls with its service token. The portal resolves its link token to the invite id. | Call | What it does | |---|---| | `GET …/tenants/{id}/supplier-invites/{invite}/supplier-view` | What the supplier's page shows: the component (by the customer's name for it, product and version), the link's end, the CSAF provider, and the uploads through this invite. Nothing else of the workspace. | | `POST …/tenants/{id}/supplier-invites/{invite}/sboms/check` | Checks a file before it is uploaded, the same check as the wizard's (`/api/v1/supplier-sboms/check`). It stores and records nothing. The supplier page shows the format and counts from it. | | `POST …/tenants/{id}/supplier-invites/{invite}/sboms` (multipart `file`, optional `csaf_provider`) | The supplier's upload. Answers `201` with its record. | **How an upload is handled** - It takes the customer's own upload path. The steps after the file is on disk moved out of `upload_artifact` into `onboarding::attach_upload`, and the customer's upload now calls that function too. So the file is read and refused the same way, becomes the component's SBOM, replaces the one before, and keeps its hash and `ingested_at`. - A scan starts (`NewContent`). Scans already queued for the target are merged as usual. - A CSAF provider given with the upload must be https. It becomes the component's provider **only when the component has none**, so one the customer set stays; the upload record keeps what the supplier gave. A new provider is fetched right away through the guarded client (`NetGuard`), so it can reach only public addresses. **What is recorded** - Every upload goes into the tenant's `supplier_uploads`, refused ones included. Each record has the invite, the time, the file name (with any path removed) and the outcome. A refused one keeps its code: `too_large`, `too_many_components`, `empty`, `unknown_format`, `malformed` or `csaf_provider`. - In the invite list, each invite now carries its uploads, and each upload shows whether it is the current SBOM. **What is refused** - An expired or withdrawn invite answers `410` (`expired`, `withdrawn`) and records nothing. An unknown invite, one in another tenant, or one for a component whose supplier was removed answers `404`. - A workspace that the registry has read-only, halted or archived answers `403` (`read_only`), as does a registry answer of not entitled. An answer without a status limits nothing, as for a person's request. When the registry cannot answer, the upload gets `503`. - An invite takes at most 20 uploads a day, refused ones included; more answer `429` (`too_many_uploads`). Each accepted upload starts a scan the customer pays for, so this caps what a leaked link can cost. **Also** - Deleting a target deletes its uploads along with its invites. - Body limit: 20 MiB plus multipart overhead, as for the SBOM check. - Docs: `docs/guide/sbom.md`. ## Tests - In `tests/supplier_invites.rs`: - The supplier view. - Three versions: each replaces the one before, and the `current` flag moves. - The same file name twice keeps the new SBOM's file. - An accepted upload starts a scan (`scan_runs`). - The CSAF provider is set once and not replaced, and a path in the file name is dropped. - The invite-scoped check: it records nothing, and it refuses once the supplier is removed. - Against a fake registry: active and no-status tenants take the upload; frozen, read-only, halted and not-entitled tenants get `403`. - Refused uploads are recorded with their codes, while a request with no file is not recorded. - Another tenant or an unknown invite gets `404`, the daily cap gets `429`, and withdrawn or expired invites get `410` with nothing recorded. - A unit test for the shown file name. The cascade test now covers uploads. - The existing onboarding, upload-change and archive-password tests still pass with `attach_upload`, which now takes the file name with the upload (five parameters). Mockup of the portal pages (awaiting approval): https://claude.ai/artifact/FKKpDUkTgY1rezxwJwjXDT 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang changed target branch from feat/supplier-invites to main 2026-11-18 11:32:59 +00:00
sharang added 2 commits 2026-11-18 11:33:14 +00:00
The second half of the phase 3 API: what the portal's supplier page shows
and the upload through an invite.

- `GET …/supplier-invites/{invite}/supplier-view`: the component by the
  customer's name for it, the link's end, the CSAF provider and the uploads
  through this invite, nothing else of the workspace.
- `POST …/supplier-invites/{invite}/sboms` (multipart `file`, optional
  `csaf_provider`): takes the customer's own upload path, now
  `onboarding::attach_upload`, so it is read and refused the same way, becomes
  the component's SBOM, replacing the one before, and starts a scan. A CSAF
  provider given with it (https only) becomes the component's.
- Every upload is recorded in `supplier_uploads` with its invite, time, file
  name and outcome; a refused one keeps its code. The invite list carries each
  invite's uploads and which one is current.
- An expired or withdrawn invite answers 410 and records nothing; a workspace
  the registry has read-only, halted or archived answers 403; an invite takes
  at most 20 uploads a day (429).
- Deleting a target deletes its uploads with its invites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
fix(supplier): check through an invite, keep the customer's CSAF provider (#1027)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m25s
CI / Check (pull_request) Successful in 21m43s
4ee44af4d2
- `POST …/supplier-invites/{invite}/sboms/check`: the supplier page checks a
  file before it is uploaded, as the wizard does; nothing is stored.
- A CSAF provider from the supplier is set only when the component has none.
- A component whose supplier was removed takes no upload (404).
- A registry answer without a status limits nothing, as for a person's
  request; tested against a fake registry for every status.
- `attach_upload` takes the file name with the upload (five parameters).
- Tests: the same file name twice keeps the new file, an accepted upload
  starts a scan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang force-pushed feat/supplier-invite-uploads from c1f2d2b8ab to 4ee44af4d2 2026-11-18 11:33:14 +00:00 Compare
sharang merged commit 497318e50d into main 2026-11-18 11:55:19 +00:00
sharang deleted branch feat/supplier-invite-uploads 2026-11-18 11:55:19 +00:00
Sign in to join this conversation.