secure-input-output
Skill11 starsChanged 10 days agoMITView on GitHub
Use when handling untrusted input, database queries, HTML rendering, file uploads, URL fetching, serialization, output encoding, or validation in web applications and APIs.
In this repository46 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- accessibility-automationSkill
- accessibility-reviewSkill
- accessible-componentsSkill
- accessible-motionSkill
- animation-performanceSkill
- anti-slop-uiSkill
- api-securitySkill
- authentication-sessionsSkill
- authorization-access-controlSkill
- component-engineeringSkill
- core-web-vitalsSkill
- design-directionSkill
- design-system-architectureSkill
- document-head-seoSkill
- font-performanceSkill
- forms-and-validationSkill
- frontend-architectureSkill
- gsap-fundamentalsSkill
- icon-engineeringSkill
- image-asset-optimizationSkill
- independent-reviewSkill
- interactive-storytellingSkill
- javascript-performanceSkill
- keyboard-focusSkill
- modern-cssSkill
- motion-design-systemsSkill
- network-cachingSkill
- performance-auditingSkill
- performance-testingSkill
- premium-landing-pagesSkill
- quickstart-onboardingSkill
- rendering-performanceSkill
- responsive-engineeringSkill
- screen-reader-testingSkill
- scrolltrigger-experiencesSkill
- secrets-configurationSkill
- secure-application-designSkill
- security-reviewSkill
- security-testingSkill
- semantic-accessibilitySkill
- visual-design-reviewSkill
- visual-reference-analysisSkill
- wcag-auditingSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Treat all data crossing a trust boundary as untrusted.
- Distinctive: line 17
Use allowlists for structured values and reject unexpected fields for sensitive operations.
- Distinctive: line 23
Use parameterized queries or safe ORM APIs.
- Distinctive: line 25
Prefer safe DOM APIs such as textContent over unsafe HTML insertion.
- Distinctive: line 26
Use framework-supported template escaping and avoid bypass/safe-HTML escape hatches for untrusted content.
- Distinctive: line 29
Use explicit serialization models to prevent accidental exposure of internal fields.
- Distinctive: line 43
Avoid server-side fetching of arbitrary user-provided URLs.
- Distinctive: line 44
Prefer strict host allowlists and controlled egress.
- Distinctive: line 51
Test malformed encodings, oversized values, injection payloads, unexpected object properties, path traversal, unsafe redirects, …
- Distinctive: line 55
All trust-boundary inputs have server-side schemas, queries and rendering use context-safe APIs, file and URL handling are constrained, and …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Secure Input and Output Handling
Objective
Treat all data crossing a trust boundary as untrusted. Validate it for the operation, use safe APIs and encode output for its destination context.
Input workflow
- Identify every source: browser fields, headers, cookies, path/query parameters, uploaded files, webhooks, queues, imported data and third-party API responses.
- Define strict schemas for type, length, format, allowed values and cross-field business rules.
- Validate on the server at the point of use. Client validation improves usability but is not a security boundary.
- Use allowlists for structured values and reject unexpected fields for sensitive operations.
- Normalize carefully and avoid validation on one representation followed by use of another.
- Apply request size, collection size, pagination and processing limits.
Output and query safety
- Use parameterized queries or safe ORM APIs; never concatenate untrusted values into SQL or command strings.
- Encode output for its exact context: HTML text, HTML attributes, JavaScript, CSS, URL or JSON.
- Prefer safe DOM APIs such as textContent over unsafe HTML insertion.
- Use framework-supported template escaping and avoid bypass/safe-HTML escape hatches for untrusted content.
- Validate redirect destinations against an explicit allowlist or same-origin policy.
- Protect state-changing cookie-authenticated requests against CSRF.
- Use explicit serialization models to prevent accidental exposure of internal fields.
File handling
- Allowlist business-required extensions and verify file signatures; do not trust filename or Content-Type alone.
- Enforce size and decompression limits.
- Generate server-side storage names and store uploads outside executable web roots.
- Prevent path traversal and unsafe archive extraction.
- Scan or quarantine files when the threat model requires it.
- Serve files with safe content-disposition and content-type behavior.
- Authorize both upload and download operations.
URL fetching and SSRF
- Avoid server-side fetching of arbitrary user-provided URLs.
- Prefer strict host allowlists and controlled egress.
- Reject loopback, private, link-local and metadata-service destinations where not explicitly required.
- Revalidate resolved addresses and redirect targets; DNS resolution and redirects can change the destination.
- Apply timeouts, response-size limits and protocol restrictions.
Verification
Test malformed encodings, oversized values, injection payloads, unexpected object properties, path traversal, unsafe redirects, content-type confusion, archive bombs and SSRF boundary cases using a safe test environment.
Completion criteria
All trust-boundary inputs have server-side schemas, queries and rendering use context-safe APIs, file and URL handling are constrained, and negative tests cover malformed and adversarial inputs.
Common AI failure mode
Failure: An agent inserts untrusted user-controlled text into an HTML rendering context without context-appropriate output encoding or a safe text API.
Why it matters: Attacker-controlled markup or script can execute in another user's browser, exposing session data or performing actions with the victim's authority. Input validation alone does not make a value safe for every output context.
Symptoms:
- User-controlled strings reach
innerHTML, unsafe template escape hatches, or equivalent HTML sinks. - A value validated for one context is reused in HTML, an attribute, JavaScript, CSS, or a URL without context-specific handling.
- Tests cover ordinary input but omit markup and event-handler payloads in rendered output.
Prevention: Keep untrusted values as text using safe DOM APIs such as textContent and framework auto-escaping. When rich HTML is a genuine requirement, use a maintained sanitizer with an explicit allowlist and verify the sanitized output at the final sink. Apply context-specific encoding, prohibit unsafe bypasses for untrusted data, and test representative injection payloads in a safe environment.
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.

