Scout: scanning your own app
Scout is a security scanner that runs inside your API, the way GORM Studio and Pulse do. It checks the things that are true of a deployment rather than of a line of code: which headers you send, what your TLS offers, whether a .env is reachable, whether a dependency has a CVE anything actually calls.
grit add scout when you want it. A scanner that appears because you ran grit new is one nobody decided to run, and an undecided scanner gets either ignored or trusted without being read.Adding it
grit add scout
That writes apps/api/internal/routes/scout.go, adds four settings to your config and .env.example, and mounts the dashboard at /scout. It installs disabled. Turn it on when you have set a password:
# .env, beside grit.jsonSCOUT_ENABLED=trueSCOUT_USERNAME=adminSCOUT_PASSWORD=something-longSCOUT_DB=scout.db
With no password it logs a line saying so and does not mount. The dashboard lists everywhere your application is weakest, which is the one page you least want to serve to anybody who finds the URL.
grit doctor reports both ways of getting this wrong: enabled with no password, where you think a scanner is running and none is, and enabled with a guessable one, which is an error in production. A project that has not added Scout reports nothing.
Running a scan
There are two scans, they look at different things, and neither does the other one's job. Knowing which one you are running is most of knowing how to read the result.
| The mounted dashboard | The CLI, with --repo | |
|---|---|---|
| Looks at | Your app as it is running, over HTTP, at APP_URL | Your source tree on disk |
| Finds | Headers, cookies, TLS, DNS, served files that should not be served, default credentials, and the route-table checks that use the access table | Hard-coded secrets, dangerous sinks, unpinned and vulnerable dependencies: the code.* checks |
| Needs | The app to be running. In development it also reads the source, so it covers both columns | Nothing running, and the scout binary |
| Use it | To see what the internet can see, and to keep a history you can diff | In CI, and before a release, where there is no deployment to point at yet |
Since v3.411.6 the dashboard runs the code.* checks too, in development. grit add scout hands Scout the project root, so the source findings and the live findings land in one scan series you can diff, rather than in two. Scout honours that path only when the environment is dev and logs a line otherwise, because a finding quotes the source line it found and a dashboard reachable in staging or production has no business reading the tree. So the CLI stays the way to get code findings anywhere but your own machine, and it is still the one for CI.
The dashboard
Start the API and open it. Sign in with the username and password you set above: it is not your application's login, and the two have no accounts in common.
grit start # or: cd apps/api && go run cmd/server/main.go# then open, and sign in with SCOUT_USERNAME / SCOUT_PASSWORDhttp://localhost:8080/scout/ui/
Press Scan. Nothing runs until you do: Grit mounts Scout with no schedule, so it scans when asked and never on its own. The run streams as it goes, and when it finishes you get the findings, the attack surface, a compliance view and a diff against the previous scan of the same target. Every scan is kept in SCOUT_DB, which is what makes the diff possible: history is the feature, because the useful question is not "what is wrong" but "what is new since Friday".
The CLI
Install it once. It is the same engine the dashboard runs, driven from a terminal.
go install github.com/MUKE-coder/scout/cmd/scout@v0.4.9# the code checks, from the project root. No server neededscout scan --repo .# the live checks, against a running appscout scan --target http://localhost:8080# both at once, written out as files you can read laterscout scan --repo . --target http://localhost:8080 --export md,html# what changed since the last scan of this targetscout diff# fail a build. Exit 1 on a finding at or above the gate, 2 on an errorscout ci --repo . --fail-on high# the same gate, counting only what is new since the last scan. This is the# one that works on a project that already has findingsscout ci --repo . --fail-on high --new-only# the dashboard, without mounting anything in your appscout serve
scout scan --json prints the findings as JSON, which is the form to reach for when something else has to read them. --sarif <file> writes SARIF 2.1.0, which GitHub code scanning accepts directly. scout init writes a scout.yaml holding every default, for when flags stop being enough, and scout prune drops scans past the retention period.
Choosing a mode
--mode decides how hard Scout pushes, and the environment caps it, so a mode you ask for is not always the mode you get. Safe is the default and the one to leave alone unless you have a reason.
scout scan --target https://staging.example.com --mode safe # the defaultscout scan --target https://staging.example.com --mode active # sends real payloads
Active against production and intrusive against staging both need two things: the target marked allow_active in your scout.yaml, and proof you own the host. Scout prints what to publish:
scout ownership --target https://example.com
Publish the token it gives you as a DNS TXT record on _scout-verify.<host> with the value scout-verify=<token>, or serve it at /.well-known/scout-verify.txt, and the scan will run. A local address needs none of this, which is why development never asks. The point of the ceremony is that an active scan sends real attack payloads, and the one thing a scanner must never do is send those at somebody else's server.
If you want to try the aggressive modes against something built to be attacked, scout lab clones a deliberately vulnerable app and scans it.
The part Grit can give it that a scanner usually cannot
A scanner looking at your application from outside sees URLs. It cannot see which of them are protected, so when it wants to report "this endpoint has no authentication" it has to infer that from the shape of the path, and the shape of the path does not say. /api/v1/auth/login and /api/v1/auth/me sit in the same place and want opposite things.
Nor can it ask the router. Gin's route table carries each route's method, path and last handler, and nothing about the middleware in front of it. The running process genuinely does not know.
Grit already solved this for its own Routes screen: grit parses your route files, resolves each group's middleware chain, and writes internal/access, which grit doctor fails on when it goes stale. grit add scout hands that table over, so Scout reads what each route requires instead of guessing:
POST /api/v1/auth/login middleware: []GET /api/v1/auth/me middleware: ["AuthRequired"]GET /api/v1/admin/blogs middleware: ["AuthRequired","RequireRole(ADMIN)","RequirePermission(blogs.view)"]
A route that should be behind a role and is not is then a finding Scout can state rather than suspect, and it finds it without sending a single request.
/api as sensitive, so its missing-auth check reports every deliberately public route, your sign-in included, as lacking authentication. The check is active mode, so a default scan never runs it. Tracked at scout#2.Modes
Every check declares the most aggressive thing it does, and a scan runs only the checks at or below the mode you asked for. The default is safe.
| Mode | What it sends | When |
|---|---|---|
| passive | Nothing. Reads response headers, the TLS handshake, DNS records, your Dockerfile, your repository and the route table. | A scan you can run against production without telling anyone first. |
| safe | Harmless probes: a GET for /.git/config, a version banner, a canary string. The default. | Routine. Nothing it sends would be logged as an attack. |
| active | Real injection payloads: SQL, command, path traversal, SSRF, auth bypass. | A target you own, with permission, knowing it will appear in your logs as an attack. |
| intrusive | Brute force, load, state-changing requests. | A throwaway environment. Not production, not staging that anyone depends on. |
What it checks
Headers
Eight checks on what every response carries.
TLS
Five checks on the handshake and the certificate.
DNS
Six checks on mail authentication and dangling records.
Exposure
Seven checks for files and endpoints that should not answer.
Code
Seven checks over the repository itself, plus govulncheck.
Config
Six checks on how this deployment is configured.
Application
Nine that send something and read the answer, plus two on API surface.
Auth
CORS, JWT claims, and the route table.
Network
Ports answering that nobody meant to publish.
Every category, in detail
Fifty-four checks. The names below are the ids Scout reports findings under, so a finding on the dashboard can be traced back to what produced it. The mode in brackets is the lowest mode that runs the check.
Headers (passive)
Reads what your responses already carry; sends nothing unusual. headers.csp, headers.hsts, headers.clickjacking, headers.nosniff, headers.referrer-policy, headers.permissions-policy, headers.cookie-flags and headers.server-disclosure.
Cookie flags is the one that finds real bugs most often: a session cookie without HttpOnly is readable by any script on the page, and one without Secure goes out over plain HTTP. Expect one finding you will keep: Grit's grit_csrf cookie is deliberately not HttpOnly, because the double-submit pattern needs JavaScript to read it and echo it back. Mark it accepted and it stays marked.
TLS (passive)
tls.weak-protocols and tls.weak-ciphers report anything old enough to be a problem. tls.cert-chain catches a chain that your browser completes from its own cache but a Go client or a phone will not, which is the classic "works for me" outage. tls.cert-expiry gives you the renewal date before your users do, and tls.hsts-preload says whether the domain qualifies for the browser preload list.
DNS (passive)
dns.spf, dns.dkim and dns.dmarc are about whether somebody else can send mail as you, which is phishing with your name on it. dns.caa is which authorities may issue certificates for the domain.
dns.dangling-cname and dns.subdomain-takeover are the pair worth understanding: a CNAME pointing at a service you stopped paying for can be claimed by whoever registers that name next, and then they are serving content on your subdomain, with your cookies in scope.
Exposure (safe)
Asks for things that should not answer: exposure.git (a served .git directory is your whole source history), exposure.dotenv, exposure.backup-files, exposure.dir-listing, exposure.swagger, exposure.metrics and exposure.dashboards.
These are plain GETs for well-known paths. Nothing here is an attack; a 404 is the answer it hopes for.
Code and dependencies (passive)
Reads the repository rather than the running app. code.secrets finds credentials committed to the tree, code.secret-logging finds them being written to logs, which is the same leak with a longer fuse. code.dangerous-sink, code.insecure-random and code.weak-crypto are the static checks: math/rand where a token is being generated, a hash that should not still be in use. code.unpinned-deps covers the supply chain, and code.dockerfile covers image practice (filed under config, since it is about how this is built and run rather than what the code says).
code.go-vulncheck runs govulncheck over the module and reports reachable CVEs: a vulnerability in a function nothing in your code path calls is not a finding, which is what makes the output short enough to read. It degrades quietly, so a repo that is not a Go module, or a machine without govulncheck installed, reports nothing rather than failing the scan.
Config (passive)
The checks that know what framework this is. config.gin-debug catches Gin left in debug mode, which prints routes and stack traces. config.default-creds catches a dashboard still on what it shipped with. config.inmemory-storage-prod catches a store that loses everything on restart being used where that matters.
Two are specifically about the tools beside it. config.sentinel-misconfig reads /sentinel/api/health and reports a WAF left in log-only mode, which detects attacks and allows them through: protection that exists on the dashboard and not in the request path. config.pulse-misconfig reports Pulse running in dev mode against a production target.
Application (safe and active)
The ones that send something and read the answer. Safe mode covers app.reflected-xss, app.open-redirect, app.csrf-form, app.info-disclosure, app.host-header, plus api.graphql-introspection and api.improper-asset-mgmt, which is an old API version still answering after everyone moved to the new one.
Active mode adds app.sqli, app.cmd-injection, app.path-traversal and app.ssrf. These send real payloads. Your logs will record an attack, because one happened, and Sentinel will block some of them, which is the correct outcome and makes the results harder to read. Run them against something you own, deliberately.
Auth (passive and active)
auth.cors reads your CORS policy for the combination that undoes it: reflecting any origin while allowing credentials means any site can make authenticated requests as your signed-in user. auth.jwt inspects a token you supply, passively, for alg: none, a missing signature and a missing expiry. It does not try to crack anything.
auth.missing is the route-table check described above, and the one this integration exists for. Two checks are deliberately not registered at all, auth.idor and auth.mass-assignment, because both need two configured test identities to compare what each can reach, and shipping them without that would mean a check that always passes.
Network (safe)
network.exposed-services checks the common ports for something answering that nobody meant to publish: a database, a cache, an admin port that was bound to 0.0.0.0 instead of 127.0.0.1. It is a short list of well-known ports, not a full port sweep.
Findings you have already decided about
A finding can be marked accepted-risk with a date, or a false positive. An accepted risk reopens itself when the date passes, which is the difference between deciding to live with something and forgetting about it.
What a clean project scores
Worth knowing before your first scan, because a number with nothing to compare it to tells you very little. A freshly generated monorepo, scanned with scout scan --repo . --mode safe on Scout v0.4.10, reports 66 findings. Not one of them is a way in. They break down like this.
| Count | Check | What it is |
|---|---|---|
| 62 | code.unpinned-deps | A caret range in a package.json. A real decision rather than a bug: a range means a fresh install can pick up a version nobody tested. |
| 1 | code.secrets | The demo users' shared admin123 in users_seeder.go. The literal is real and the seeder refuses to run outside APP_ENV=development, which a pattern match cannot see. Accept it. |
| 2 | code.vulnerable-deps | golang.org/x/crypto (the advisory that openpgp is unmaintained, and nothing imports openpgp) and disintegration/imaging (its TIFF decoder, which is never registered). Both are in the module graph and neither is in the build. Neither has a fixed version to move to. |
| 1 | code.secret-logging | The API key seeder printing the secret it just minted. That line is inside a development-only branch as of v3.411.0, and the check reads the call rather than the branch around it. Accept it. |
The useful reading of that table is the ratio. A scanner is worth running when a new finding stands out, and it stops being worth running when there are so many that nobody looks. If your own scan is much longer than this, the extra findings are yours and worth reading one at a time.
It was 73 on v0.4.9. Seven of those were signing keys in test files, which is not a finding anyone can act on: a test that signs a token has to contain a key, so there is no version of that file without one. Scout skips test fixtures as of v0.4.10.
That is a repo scan. Point Scout at a running app with --target and you also get the grit_csrf cookie finding described above, which is the one deliberate exception in the cookie checks.
What it is not
Scout is not Sentinel. Sentinel is a WAF: it sits in the request path and blocks things as they happen. Scout runs on a schedule and tells you what it found. One defends, the other looks. They answer different questions and the answers do not substitute for each other.
It is also not a penetration test. It finds the classes of problem a tool can find. Business logic, a broken permission model, an authorization rule that is right for every case but one: those need somebody thinking about your application, and nothing here replaces that.
