feat: Go port of CloudSecurity-AF — installing this repo now gives you the Go node - #8
Merged
Conversation
The shared substrate every ported package builds on: afx (map<->struct binding, both _unwrap variants incl. the strict phases/orchestrator one, exclude_none), pyfmt (Python round/str/repr/json.dumps parity), appx (the Harness/AI/Note/Call agent seam + recording test fake), harnessx (generic structured-harness runner resolving committed pydantic schema fixtures by Go type name), aix (the .ai(schema=) path with the Python SDK's strictify, salvage and parse-retry semantics), byte-verbatim embedded prompts with a drift test, config (env parity, depth tables, scan config), schemas (every pydantic model with default-seeding UnmarshalJSON, strict enums, pydantic-isoformat timestamps) and scoring (risk model pinned by a 600-row Python-generated matrix). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The deterministic Terraform inventory parser (hcl/v2 port of the pyhcl2 walk, same inventory.json shape) with the harness fallback, the fast graph builder, cloud connector and drift detector, the 7 hunters over the shared graph-context assembly, the attack-path constructor, the static/live provers and the fix generator, plus the SARIF/JSON/Markdown emitters. Prompts and artifacts are golden-tested byte-for-byte against the Python implementations. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
internal/phases carries recon/hunt/chain/prove/remediation_phase with the exact Python call targets, kwargs, depth tables, semaphore bounds and fallback shapes, so the control-plane DAG is identical to the Python node's. internal/orch ports ScanOrchestrator: the five sequential phase calls, checkpoints, budget bookkeeping and generate_output (benchmark severity floors, risk scores, drift/shadow-IT counts, SARIF). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
internal/reasoners registers scan/prove plus the 20 router reasoners under their exact Python names, tags and signature-derived input schemas (captured from a live Python node and embedded as the parity fixture). internal/node ports app.py: agent construction from the environment, the scan/prove handlers building CloudSecurityInput, the workspaces resolver with the writability fallback, and error mapping. The packaging parity test pins manifests, compose and CI against the Python sources. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The root manifest gains superseded_by pointing at go/, whose manifest declares the same package name and the node id the process actually registers (cloudsecurity), so a git install lands the Go node and replaces an existing Python install in place; a local-path install remains the documented Python escape hatch. Adds the multi-stage Go Dockerfile (checksum-verified AForge fetch + opencode, non-root user), the model-aware entrypoint, a compose add-on joining the Python stack under the cloudsecurity-go id, Makefile, go/README, a root-README section and a Go CI workflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Complete 1:1 port of CloudSecurity-AF from Python to Go on the AgentField Go SDK, following the porting pattern established by pr-af (Agent-Field/pr-af#53, #54, #64) and SWE-AF (Agent-Field/SWE-AF#94), and the sibling SEC-AF port (Agent-Field/sec-af#130). The Python implementation is byte-untouched — every diff lives under
go/, plusdocker-compose.go.yml, one root-README section, the root-manifest redirect, and a new Go CI workflow (this repo previously had no.github/).The root manifest declares
superseded_by: …//go, soaf install https://github.com/Agent-Field/cloudsecurity-afinstalls the Go package and replaces an existing Python install in place. The Go manifest registers the node id the process actually uses —cloudsecurity(the Python code's default; the root manifest's stalecloudsecurity-afid is corrected alongside, with a packaging parity test pinning both manifests toapp.py). Default port 8015;docker-compose.go.ymlruns the Go node ascloudsecurity-gobeside the Python stack.Parity contract honored
scan,proveplus the 20 router reasoners tagged["cloud","security","infrastructure"]— each publishing the same signature-derived input schema the Python SDK registers (captured from a live Python node into a committed fixture and asserted through/discover).agent.Calls with identical targets/kwargs; the phases fan out exactly as Python does (depth-mapped hunters with a semaphore, one path constructor with depth-mappedmax_paths, static/live provers by tier with the attack-path kwarg only when applicable, fix generators for confirmed/likely findings)._terraform_parser.pyis ported on hcl/v2 producing the sameinventory.jsonshape (ids, providers, references, reverse references); the committed Python-generated inventory for the repo's own vulnerable fixture is the test oracle, and the fast graph builder is byte-identical on it. Harness fallbacks preserved.model_dump()key sets, defaults, strict enums (this repo's models reject unknown enum values — reproduced, unlike pr-af's coercing pattern),exclude_noneat the same sites, pydantic-isoformat timestamps..ai()parity: the structured-output path reproduces the Python SDK's tolerant parsing (salvage + retries), shared with the SEC-AF port.Verification
go build ./… && go vet ./… && go test ./… && go test -race ./…green;gofmt -lempty; ~500 Go test functions derived from the Python tests/behavior; also run on the CI-pinned go1.21 toolchain;golangci-lintclean.opencodeharness; the samescan(depthstandard) triggered on the repo'svulnerable_infrafixture. The Go and Python runs are strictly identical: same 37 executions, same 18-edge multiset, same statuses — and the final scan payloads (findings, verdicts, risk scores, SARIF, counts) are byte-identical after canonicalizing concurrent-completion list order. CloudSecurity has no live-LLM DAG nondeterminism (verdicts come from the harness-driven provers), so the comparison is exact with no allowances.opencode.json).git diff origin/main -- src tests pyproject.toml Dockerfile docker-compose.ymlis empty.Known accepted differences (documented in code)
/healthbody ({"status":"ok"}) — consumers only check the status code.AGENT_CALLBACK_URLunset: the SDK derives the real listen address instead of Python's hardcoded Docker-Desktop-onlyhost.docker.internal:8020fallback.test_schemas.pyimports removed classes;test_graph_context.py/test_utils.pytarget moved paths/signatures) don't run against today'ssrc/; the port pins the current code's interpreter-verified behavior and documents the staleness.🤖 Generated with Claude Code