refactor(web-ng): dedup FirstPartyImporter onto ForgejoOciClient + native add-on import e2e (#3425) #3480
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!3480
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/fpi-shared-transport-dedup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Completes
add-native-addon-build-signing§4.1's two follow-ups (from #3479) and hardens the native add-on import path.1. Dedup
FirstPartyImporteronto the sharedForgejoOciClientThe shared transport client landed in #3479 and is in use by the native importer, but
FirstPartyImporterstill held its own copies. It now does:and drops its ~45 duplicated HTTP/OCI/Cosign/URL transport
defps — 1006 → 470 lines. The kept code is only the Wasm-bundle-specific discovery/verify/result-shaping; bare transport calls resolve to the imported shared functions, so no call-site rewrites were needed.default_repo_url/0stays a public accessor (delegating to the client) for theplugin_package_livecaller.Behavior is preserved — including the importer's historical 20-release scan ceiling (the shared client allows up to 50 for native add-ons, so FPI clamps before calling). Gated by the unchanged
first_party_importer_test.exs, which drives every moved transport path (direct + OCI fetch, bearer challenge, redirects, digest/cosign/upload-sig verify) through FPI's public API.2. End-to-end test of the web-ng native importer
native_addon_importer_test.exsexercises the full orchestration end to end: a fakeForgejoOciClientHTTP backend serves the release, theserviceradar-native-addon-index.jsonasset, the OCI manifest, and the bundle + per-arch blobs by digest; Cosign and the datasvc upload are stubbed (the upload via a new, test-only:native_addon_artifact_uploadseam +build_mirror/2). The real core then verifies each tarball's sha256 + agent-release ed25519 and persists a stagedAddonPackage. Covers the happy path + fail-closed paths.3. Hardening (high-severity, found in review)
fetch_layer_blobpreviously only asserted a digest was a declared layer of the Cosign-verified manifest — it never re-hashed the returned bytes. The per-arch tarball is covered by the core's sha256 + ed25519, but the bundle (sole source ofaddon.yaml/config.schema.json) was otherwise unsigned, so a tampering/buggy registry could swap it. It now re-hashes every fetched blob against its digest (Client.digest_matches?), mirroring what the WasmFirstPartyImporteralready does. A regression test serves tampered bundle bytes under the still-declared digest and asserts{:error, {:blob_digest_mismatch, _}}.Test coverage (native e2e)
AddonPackage:invalid_signature:digest_not_in_manifest:blob_digest_mismatchValidation
mix compile --warnings-as-errors+mix credo --strictcleansrql-fixturesscratch CNPG DB🤖 Generated with Claude Code
lgtm