map-the-attack-surface
Skill2 starsChanged 3 months agoApache-2.0View on GitHub
Use before exposing something, after inheriting a system you did not build, or when a security review says "looks fine". Finds who can reach what, the authorisation gaps scanners never report, and what not to put in the findings list.
In this repository53 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- block-dangerous-git-commandsSkill
- break-work-into-ticketsSkill
- build-a-domain-modelSkill
- build-a-throwaway-prototypeSkill
- check-if-data-is-safe-to-deleteSkill
- check-the-licence-before-you-copySkill
- choose-the-right-code-reviewSkill
- debug-a-silent-failureSkill
- deploy-to-production-safelySkill
- design-deep-modulesSkill
- detect-stale-documentationSkill
- diagnose-a-hard-bugSkill
- document-with-evidenceSkill
- edit-a-live-config-safelySkill
- find-architecture-improvementsSkill
- generate-a-setup-wizardSkill
- get-a-second-model-opinionSkill
- implement-from-a-specSkill
- investigate-an-unfamiliar-systemSkill
- keep-agent-memory-accurateSkill
- keep-secrets-out-of-the-repositorySkill
- know-what-a-change-costsSkill
- look-at-the-rendered-pageSkill
- make-the-next-failure-loudSkill
- map-an-undocumented-systemSkill
- pick-the-right-skillSkill
- plan-work-too-big-for-one-sessionSkill
- research-with-primary-sourcesSkill
- resolve-merge-conflictsSkill
- review-a-plan-before-you-buildSkill
- review-changes-against-spec-and-standardsSkill
- review-code-you-did-not-writeSkill
- root-cause-analysis-firstSkill
- route-work-to-the-right-modelSkill
- set-up-pre-commit-hooksSkill
- set-up-the-issue-trackerSkill
- set-up-verified-documentationSkill
- stress-test-a-decisionSkill
- stress-test-a-plan-with-docsSkill
- supersede-outdated-docsSkill
- survive-someone-elses-breaking-changeSkill
- tddSkill
- teach-a-conceptSkill
- triage-issues-and-prsSkill
- turn-a-decision-into-a-questionnaireSkill
- validate-your-validatorSkill
- verify-before-saying-doneSkill
- write-a-handover-that-worksSkill
- write-a-spec-from-a-conversationSkill
- write-docs-for-agentsSkill
- write-docs-people-can-findSkill
- write-the-rollback-plan-firstSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 9 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Before exposing anything to the internet, or widening who can reach it
- Distinctive: line 26
After inheriting a system nobody can fully explain
- Distinctive: line 27
When a scan came back clean and you want to know what it could not see
- Distinctive: line 28
Before handling customer data, money or credentials
- Distinctive: line 29
After any credential leak, to work out what it could reach
- Distinctive: line 33
1. List the entrances: Every way in: public endpoints, admin interfaces, APIs, webhooks, file uploads, scheduled jobs that fetch from …
- Distinctive: line 39
Write it as a sentence. Vagueness here is the finding: if nobody can state the rule, nobody is enforcing it.
- Very specific: line 80
Quote the line that made you say it: Every finding carries file:line and the code itself.
- Distinctive: line 91
If you cannot reach the vulnerable function from the code you can see, say so: *"not directly called — may still be reachable through …
- Distinctive: line 125
"Test data is not real.": Check. Test environments are frequently refreshed from production, and often with weaker access controls.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Map the attack surface
Most security work in ordinary projects is not cryptography. It is answering one question honestly:
Who can reach what, and what stops them from reaching more?
The bugs that actually hurt are rarely exotic. They are an endpoint that checks you are logged in but not that the record is yours, a test environment sharing production credentials, an admin panel reachable from the internet because a proxy rule was broader than intended.
🔴 Automated scanners find injection. They do not find authorisation. A scanner cannot know that record 41 belongs to a different customer than record 42. That gap is where the expensive findings live, and it is found by asking, not by tooling.
When to use this
- Before exposing anything to the internet, or widening who can reach it
- After inheriting a system nobody can fully explain
- When a scan came back clean and you want to know what it could not see
- Before handling customer data, money or credentials
- After any credential leak, to work out what it could reach
The procedure
1. List the entrances. Every way in: public endpoints, admin interfaces, APIs, webhooks, file uploads, scheduled jobs that fetch from outside, database ports, management planes, SSH. Include the ones you assume are internal — then check whether they are.
2. For each entrance, name what is on the other side and who is allowed. Write it as a sentence. Vagueness here is the finding: if nobody can state the rule, nobody is enforcing it.
3. Test authorisation with two accounts, not one. This is the step that finds the real bugs. Log in as tenant A, take an identifier belonging to tenant B, and ask for it. Do it for every object type that has an owner. A scanner will never do this for you.
| Question | What it finds |
| Can A read B's record by changing an id? | Broken object-level authorisation |
| Can a normal user reach an admin action directly? | Missing function-level checks |
| Does the list endpoint filter by owner, or the detail one only? | The most common variant |
| Do the test and production systems share a credential? | One breach becoming two |
| Does an error message differ for "not yours" and "does not exist"? | Enumeration |
4. Follow every credential to everything it opens. A key is not a secret, it is a set of permissions. Write down what each one can do, and whether it is shared between environments.
5. Ask what a compromise would let someone do, not whether it is likely. Likelihood is a guess; blast radius is a fact you can establish today.
6. Write down what you did not check. An attack-surface map that implies completeness is worse than a partial one that is honest about its edges.
Before you report it
Finding things is half the work. The other half is not crying wolf, because a report padded with maybes gets skimmed once and never opened again — and the real finding was on page three.
Score every finding, and keep the low ones to yourself.
| Score | What it means | What to do |
| 9–10 | You read the code. You could write the exploit. | Report it |
| 8 | A known-exploitable pattern, path traced. | Report it |
| 5–7 | Plausible. You have not traced it end to end. | Report only if asked for a wide sweep, marked tentative |
| Below 5 | A shape that looks suspicious. | Keep it in your notes |
Quote the line that made you say it. Every finding carries file:line and
the code itself. A finding you cannot anchor to a specific line is a hunch, and
half the time the field it complains about does not exist.
Prove it by reading, never by firing. Trace the path in the code: does the signature check exist anywhere in the middleware chain, can this URL actually reach an internal host, is the vulnerable function imported and called. Do not send the request, do not test the key against the live API. You are auditing a system, not attacking it — and a "harmless" probe is how audits become incidents.
If you cannot reach the vulnerable function from the code you can see, say so: "not directly called — may still be reachable through framework internals." That sentence is worth more than a confident guess in either direction.
These are not findings. Reporting them is how a security review loses its audience:
- Denial of service, resource exhaustion, rate limits. Except uncapped spend on a metered third-party service — that is financial risk with a real number on it.
- Missing hardening. A concrete reachable weakness is a finding; the absence of a best practice is a recommendation, and they do not belong in the same list.
- Memory safety in a memory-safe language.
- Input validation on fields with no security consequence.
- Absence of audit logs. Logging secrets is a finding; not logging is not.
- Weak randomness where the value is not a secret — a UI element id, a cache key.
- Anything only reachable from test fixtures that nothing else imports.
- Race conditions without a concrete path someone can walk.
- Containers running as root in a local development compose file. In a production image, it is a finding.
Say what you did not look at. Same rule as the map itself. A findings list that implies completeness is the one that gets trusted for years after it stopped being true.
Anti-patterns
- "It's behind a VPN." So is everyone who is already inside, including anything compromised.
- "Nobody knows the URL." Obscurity is not a control. Certificate transparency logs, referrers, browser history and crawlers all know the URL.
- "The scanner is clean." It tested for the classes it knows. Authorisation is not one of them.
- "Test data is not real." Check. Test environments are frequently refreshed from production, and often with weaker access controls.
- Threat-modelling the exotic attacker while an unauthenticated admin path sits open.
The incident
A security review of a multi-tenant panel came back clean on the automated axes: no injection, credentials handled correctly, dependencies current.
Asking the two-account question found that a customer could read another customer's records by changing an identifier in the URL. The list endpoint filtered correctly by owner; the detail endpoint did not check at all. Every automated tool had passed it, because from the outside the request looked exactly like a legitimate one — which is precisely what it was, except for who was making it.
The same review found the test environment authenticating to a third-party service with the same key as production. Individually a housekeeping note; combined with any weakness in the less-guarded environment, it is a path into the real one.
Related
keep-secrets-out-of-the-repository— where credentials leak from, and what to do the moment one doesroute-work-to-the-right-model— anything on this page is level 3: three validations, one trying to break itmap-an-undocumented-system— you cannot secure what nobody can describereview-code-you-did-not-write— authorisation checks are exactly what a plausible-looking diff omits
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

