What the agent does
The agent reads what the project already checks before it looks for what it does not. In a Gin API like gothinkster/golang-gin-realworld-example-app, go.mod declares Go 1.21 with gin-gonic/gin v1.10.0, GORM v1.25.12 on SQLite, golang-jwt/jwt/v5 v5.2.1, go-playground/validator/v10 v10.24.0 and golang.org/x/crypto v0.32.0; .github/workflows/ci.yml runs go mod verify, a gofmt check, the coverage script on Go 1.21 to 1.23, golangci-lint v1.61 with only staticcheck, unused and misspell enabled in .golangci.yml, and gosec v2.21.4 with -no-fail, so a gosec finding uploads to code scanning but never fails the build. AGENTS.md ends with a security section that says the JWT secret in common/utils.go must not be exposed in production and that GORM parameterises queries.
Then it reads the trust boundaries in the code. common/utils.go holds JWTSecret and RandomPassword as string constants, the first annotated // #nosec G101 to silence gosec, and GenToken signs HS256 tokens carrying only id and a 24-hour exp. users/middlewares.go accepts a token from the Authorization: Token … header or from an access_token query parameter, which puts bearer tokens into the request line that gin.Default()'s logger writes for every request, and AuthMiddleware(false) lets a request with an invalid token continue as anonymous. users/validators.go requires a username of 4 to 255 characters, an email, a password of 8 to 255, a bio up to 1024 and an optional image url, and NewUserModelValidatorFillWith pre-fills the password field with the RandomPassword constant so UserUpdate keeps the stored hash when the client sends it back, a sentinel that lives in the public repository. users/routers.go returns the same 401 message for an unknown email and a wrong password, which is right, but UsersRegistration answers 422 with common.NewError("database", err), the raw GORM error text, which for a taken email names the unique constraint. hello.go has no body size limit, no CORS or security headers, and never calls SetTrustedProxies, and common/database.go opens the SQLite file from DB_PATH after MkdirAll with mode 0750.
The agent proves each point against a running copy rather than from reading alone. It starts the service with go run hello.go and a DB_PATH in a temporary directory, registers a user and logs in with curl, then calls /api/user with the token in access_token and shows the token in the Gin access log line; sends a token signed with none and shows the HMAC method check rejects it; registers the same email twice and records the exact 422 body; sends an oversized article body to see what size:2048 on the GORM model does at the database and whether anything stops it earlier; and updates a user with the sentinel password to confirm the hash is untouched. It runs gosec ./... without -no-fail, govulncheck ./... against the pinned module versions, and go vet ./..., and lists each tool's output beside its own reproduction.
The report, security-audit.md, goes on the session as an artifact. It opens with how the service was built and run, then a findings table: each with the file and line, the request that demonstrates it, a severity, and the fix, such as reading the signing secret from the environment and refusing to start without one, dropping the query-parameter token or scrubbing it from logs, returning a generic 422 on registration, adding jwt.WithValidMethods and WithExpirationRequired to the parser, a MaxBytesReader on bodies, trusted proxies from configuration, and a login rate limit. A section lists what passed (bcrypt at DefaultCost, GORM parameterisation, the HMAC method check, the uniform login message), and anything a tool reported that the agent could not reproduce is marked unconfirmed rather than dropped or promoted.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Audit this Gin API for security problems and write security-audit.md. First read go.mod, hello.go, the scripts directory, .golangci.yml, AGENTS.md and the CI workflow, and record the Go version, the test commands and what the project already checks and what it lets pass. Map the trust boundaries from the code: how tokens are issued and parsed in common/utils.go and users/middlewares.go, where a token may be carried, what the validators under users and articles accept, what error bodies reveal, body size and proxy trust in hello.go, and how the database file is opened. Start the service with a temporary DB_PATH, register and log in with curl, and for each boundary make real requests that demonstrate the finding, keeping the exact request and response. Run gosec without -no-fail, govulncheck and go vet and list their results. Record every finding with file and line, the demonstrating request, a severity and the fix, list what passed, and mark anything you could not reproduce as unconfirmed. Change no code and open no pull request.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is security-audit.md as an artifact on the session, with a download link good for an hour that reading the session again renews. It opens with how the service was built and run: the Go version from go.mod, the go run hello.go command and the temporary DB_PATH, the port it answered on, and the user it registered, so every finding is tied to known conditions.
Its findings table carries, per row, the file and line, the curl request and the response that demonstrate it, a severity and the fix, followed by a section of what passed and a section of tool output from gosec, govulncheck and go vet with each line matched to a finding, marked unconfirmed, or explained as a false positive with the reason. The transcript on the session keeps every request the agent sent and every response, so a reviewer can replay any of them.
A reader checks the severity against where the service runs: a token in a query string matters more behind a logging proxy, the hard-coded secret matters only if production uses the same build, and the registration error text matters if sign-up is public. The report is the input to a fix, not the fix; a follow-up sent to the same session can start one on a branch.
Run it on every Monday morning
In the Project, add an automation with this prompt and a schedule trigger with a weekly cron in your timezone, and each week's report lands as that run's artifact, with the session read listing it by name. A github trigger on pull_request.opened filtered to your release branch gives the same report per release instead, with the event added after the prompt.
From your own server, send this request before a release with the repository in resources and a request_id that is a UUID v5 of the release tag, and give the key a webhook_url: run.completed arrives with data.session_url, from which the artifact's download link is read. One run per service, each in its own sandbox.
The use case this job follows, with its automation and trigger: Produce a report or file, no repo.
Why run it on Rush?
The findings in this API are in the code for anyone to read, but a report that only reads code gets argued with. The agent runs the service in its own sandbox, registers, logs in, sends the requests, and keeps the responses, so each row of the table is a reproduction rather than an opinion, and the tool runs happen without -no-fail for once.
Nothing touches a developer machine or a shared environment: the SQLite file lives in a temporary directory in the sandbox and is gone with it. Several services can be audited at once, each with its own report, and a follow-up on the same session starts the fix with the findings already in context.
Frequently asked questions
Does it change any code?
No. The prompt ends with change no code and open no pull request, so the result is the report alone. Send a follow-up to the session naming the findings to fix and it opens a branch and a pull request from the same sandbox, with the audit's requests available to turn into tests.
gosec runs in CI with -no-fail. Will the report say anything new?
It runs gosec without that flag and reads the results next to its own reproductions, so a #nosec annotation that hides a real finding, like the one on JWTSecret, shows up with the request that demonstrates it. govulncheck is not in CI at all, so its output is new.
Does it audit the deployed service?
No. It audits the code and a copy it runs itself in the sandbox. Production differences, such as a proxy that strips query strings from logs or a secret injected at build time, are for the reader to apply to the severities, and the report says which findings those would change.
What goes in the unconfirmed section?
Anything a tool flagged that the agent could not demonstrate with a request, and anything the code suggests but the running copy did not show. They are listed with the reason rather than dropped, so a reader can decide whether to chase them.