feat(core): native add-on importer verify-then-persist core (#3425) #3476
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!3476
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/native-addon-importer"
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?
What
The verify-then-persist core of the native add-on control-plane importer (build-signing §4.1/4.2).
ServiceRadar.Plugins.NativeAddonImporter(serviceradar_core) turns a verifiedserviceradar-native-addon-index.jsonentry + the add-on'saddon.yamlmanifest into a stagedAddonPackagewhose per-archartifactsmap is exactly whatAgentConfigGenerator.select_addon_artifact/3already reads ("os/arch" => {object_key, sha256, signature}).Per architecture it:
sha256,verifyAddonArtifactSignaturecheck, with the same hex/base64 decode parity, so a tarball the control plane accepts is one the agent will accept,:mirrorfunction,then maps the manifest →
AddonPackagecreate attrs (kind/delivery/supervision → atoms, fail-closed on unknown enums; binary/install_path/capabilities/requires; source oci ref/digest/release tag) and creates a staged package via an injected actor (aSystemActorfor background callers — neverauthorize?: false, perserviceradar_core/CLAUDE.md).Why injected deps
The OCI fetch, Cosign verify, and object-storage upload are injected so the verification + persistence logic is unit-testable without a registry or DB — mirroring the
ReleaseArtifactMirrorDI pattern.Tests
test/serviceradar/plugins/native_addon_importer_test.exs(no DB): valid-sig (hex + base64) / tampered / wrong-key / malformed-sig; sha256 match/mismatch; decode encodings; per-arch verify+mirror map and fail-closed-never-mirror; attrs mapping + unknown-delivery rejection + install_path default.mix testgreen (11 tests);mix compile --warnings-as-errors+mix credo --strictclean.Remaining (tasks.md §4, noted)
CosignVerifier), parse the bundle'saddon.yaml+config.schema.json, assemble the per-arch fetched artifacts, and callimport_entry/4.ServiceRadar.Sync.Client.upload_object(object keynative-addons/<addon_id>/<version>/<os>-<arch>/<sha256>-<file>), mirroringReleaseArtifactMirror.AddonPackage.🤖 Generated with Claude Code
build-signing §4.1/4.2 core. ServiceRadar.Plugins.NativeAddonImporter consumes a verified native-addon index entry + the add-on's addon.yaml manifest and produces a staged AddonPackage whose per-arch `artifacts` map AgentConfigGenerator already reads (keyed "os/arch" -> {object_key, sha256, signature}). Per architecture it: checks the tarball sha256, verifies the raw ed25519 signature over the tarball bytes against the agent release public key (the agent's exact verifyAddonArtifactSignature check, with the same hex/base64 decode parity so a tarball the control plane accepts is one the agent accepts), then mirrors via an injected mirror fn. It maps the manifest (kind/delivery/supervision -> atoms, fail-closed on unknown enums; binary/install_path/capabilities/requires; source oci ref/digest/release tag) to AddonPackage create attrs and creates a staged package via an injected actor (a SystemActor for background callers; never authorize?: false). The OCI fetch + Cosign verify + object-storage upload are injected so the verification + persistence logic is unit-tested without a registry or DB: verify/tamper/wrong-key/malformed-sig, sha256 match/mismatch, hex+base64 decode, per-arch verify+mirror map (+ fail-closed-never-mirror), and the attrs mapping. mix test green; mix compile --warnings-as-errors + credo --strict clean. Remaining (tasks.md §4): the web-ng OCI-fetch orchestration (fetch index from the trusted release, bounded-fetch + Cosign-verify the bundle, parse addon.yaml + config.schema.json, call import_entry/4) and the default object-storage mirror impl (ServiceRadar.Sync.Client.upload_object, ReleaseArtifactMirror pattern). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>