Updates for runZero 5.1#47
Draft
hdm wants to merge 6 commits into
Draft
Conversation
d0db9f0 to
75fd2b6
Compare
- Migrate integrations to runZero 5.0 API - Add incremental asset reporting via report_assets() - Remove deprecated/unused functions - Bug fixes and regenerated integrations JSON/README
3ff0dc5 to
341af67
Compare
This was referenced Jun 10, 2026
Contributor
Author
|
placeholder of 5.1 until we pick the revision for this (to enable version compat checks) |
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.
Updates for runZero 5.1: a bigger Starlark toolkit and self-describing integration scripts
Important
This branch requires runZero 5.0 or newer. The scripts here load builtins
(
get_json,network_interface,to_custom_attributes,kwargs, therunzero.*protocol modules, ...) and declare embeddedCONFIGblocks thatonly the 5.0 Explorer and console understand. Running them on an earlier
release will fail. Scripts that set
minVersionenforce this automatically.TL;DR
Every integration in this repo has been refactored onto the new 5.0 custom-integration
API surface. The result is dramatically less boilerplate, scripts that describe their
own credential form, new non-HTTP data sources, and explicit control over how imported
assets merge.
custom-attribute flattening are now builtins instead of copy-pasted helpers.
CONFIGblock at the top of each script renders thecredential form, validates input, and encrypts secrets — no platform change needed
to add a new integration.
matchBehaviorflag lets each script tell the cruncher howaggressively to merge the assets it imports.
Before vs. after
Authentication — before, scripts base64-encoded basic auth and hand-built bearer headers:
Fetching JSON with retries/pagination — before, every script re-implemented status
checks, JSON decoding, and backoff:
Reading credentials — before, raw
kwargs.get(...)with manual casting; now typed,validating accessors:
Building network interfaces — before, scripts looped to classify v4/v6 and normalize
MACs; now one helper does it (mixed list,
addr:port/%zonestripping, dedupe, caps):New capabilities
Self-describing scripts (embedded
CONFIG). Each script now declares a top-levelCONFIG = {...}literal with itsid/name/type,version, optionalminVersion,and credential
params. The platform renders the form from it, applies defaults, coercesand validates types (
required/min/max/pattern/enum), and routestype: "secret"fields through encrypted storage. Shared
OPTIONS_HTTP/OPTIONS_TLSincludes give everyintegration consistent connection/TLS controls without copy-paste. This replaces the old
config.jsonmetadata files, which have been removed.Reach beyond HTTP. New modules open raw connections to sources without a REST API:
socket(tcp/udp/tls),runzero.ssh,runzero.smb,runzero.winrm,runzero.wmirunzero.sqlfor Postgres/MySQL/SQL Server (parameterizedquery/exec)Connections opened by a script are tracked and closed automatically when the run ends.
A real standard library.
re(RE2 regex),xml,csv,jsonstream(streaming largearrays/NDJSON),
jwt(encode/decode/verify),runzero.progress(progress bar + log linesin the UI), plus crypto (
hmac_*, AWS SigV4sign_v4,random_bytes/random_hex) andhex/base32encodings. URL helpers (url_parse/url_join/multipart) andhttp.head/http.putround out the HTTP verbs.Richer assets and merge control.
runzero.typesgainsService/ServiceProtocolDataand ato_custom_attributeshelperthat flattens arbitrary values into the
string -> stringshape (nested dicts, lists,length caps) the platform expects.
matchBehavioronImportAssetaccepts a flag string so each script chooses how thecruncher merges — e.g.
"no-mac-break no-ip-break no-name-break"when it has a stableforeign id, or
"no-id-match no-id-break"for ephemeral ids.What changed in this repo
to_custom_attributes(...),network_interface(...),get_json/post_json,basic/bearer/oauth2_token, and thetyped
kwargsaccessors, removing hand-rolled flattening, header building, and pagination.CONFIGblock to every script and removed the oldconfig.jsonmetadata files. Credential field names were normalized away from the generic
access_key/access_secretpair to descriptive keys (api_token,client_id,username/password, etc.) that match each API.custom-integration-/custom_integration-filename prefix. Each directory now contains a
<name>.star(e.g.tailscale.star,cisco-ise.star,boilerplate.star).Services) from the Kubernetes API using a ServiceAccount bearer token.
docs/starlark-helpers.md), updatedAGENTS.mdand PR template for the
CONFIGconvention and<name>.starnaming, a new"Asset IDs and match behavior" README section, and refreshed cross-references in
docs/integrations.jsonand individual READMEs.Match behavior reference
ImportAssetaccepts an optionalmatchBehaviorstring. The default matches and breaks onall four dimensions (id, MAC, IP, name), which is correct when the integration owns a strong
id. When the id is weak or absent, use the knobs below to tell the cruncher which dimensions
are unreliable for matching (finding the right existing asset to merge into) and which
are unreliable for breaking (refusing a merge that one dimension would otherwise block).
no-id-matchno-id-breakno-mac-matchno-mac-breakno-ip-matchno-ip-breakno-name-matchno-name-breakCombine flags with spaces. Recommended presets:
matchBehaviorunset.The default uses every signal.
workloads, VPN clients):
matchBehavior="no-mac-break no-ip-break no-name-break". Keepsid-based merging authoritative, but stops drift in the other dimensions from blocking a
legitimate merge.
matchBehavior="no-id-match no-id-break". Falls back to MAC / IP / name matching. Pair itwith
id=new_uuid()or a hash of stable attributes so the row still has a unique key butthe cruncher ignores it for correlation.
attributes: use
no-id-match no-id-breakon the enrichment-only integration so it alwaysmerges into the primary asset by MAC/IP/name rather than creating a parallel record.
Rule of thumb: if the upstream id is not both stable and unique, relax id matching. If
MAC / IP / hostname are known to be unreliable for this source, relax the corresponding
-breakflags so a conflict there doesn't fragment one real asset into many.Safety notes for authors
at rest.
jwtrejects thenonealgorithm;xml.parseis XXE-safe.cleaned up on cancel.
Docs
Authoring guidance and a runnable example that exercises the new helpers live in this repo:
the helpers reference (
docs/starlark-helpers.md),AGENTS.md, andboilerplate/boilerplate.star.