[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6D26AT80TS92M7NNN9P8QJA":3,"skill-same:01M6D26AT80TS92M7NNN9P8QJA":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":49,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6D26AT80TS92M7NNN9P8QJA","security-web",null,"Web application weaknesses and how to find them in code: broken access control and IDOR, injection of every kind, XSS, CSRF, SSRF, path traversal, unsafe uploads, open redirects, insecure deserialisation, mass assignment, XXE, prototype pollution, ReDoS, race conditions and misconfiguration, each with what to look for and the fix. Read before reviewing a web application or an API.","enowdev\u002Fenowxcli","enowdev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F179420349?v=4","01M6D1MVX2KC0X3Z9NESE7P22K","Enow Dev.","01M6D1MW1FMZGBDKWAJY4GQX81",67,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fsecurity-web\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"web","security web","security","access","Access Control","pollution","prototype pollution","path traversal","fix","read","broken","code","how","open","xxe","api","csrf","xss","injection","ssrf","2026-11-10 10:12:30",false,"---\nname: security-web\ndescription: \"Web application weaknesses and how to find them in code: broken access control and IDOR, injection of every kind, XSS, CSRF, SSRF, path traversal, unsafe uploads, open redirects, insecure deserialisation, mass assignment, XXE, prototype pollution, ReDoS, race conditions and misconfiguration, each with what to look for and the fix. Read before reviewing a web application or an API.\"\n---\n\n# Web application weaknesses\n\nThe naive review greps for `eval`, finds nothing and calls the app safe,\nwhile `GET \u002Fapi\u002Forders\u002F:id` returns any order to any account, checkout trusts\nthe price in the body, and a coupon applies twice when two requests land\ntogether. Each class below has the code that signals it, how to confirm it\nand where the fix lives (method and severity: `security`). Patterns are\nregexes for the `grep` tool or `rg -n`: leads, never findings on their own.\n\n## 1. Broken access control and IDOR\n\nThe commonest critical finding, invisible to scanners (CWE-862, 863, 639):\nroutes outside the auth middleware (registered before it, or exempted);\nserver actions that never read the session; admin actions behind a hidden\nbutton; records loaded by id with no owner or tenant condition (reads,\nupdates, deletes, downloads, exports, bulk actions, nested routes never\nchecked against their parent, socket channels, GraphQL `node(id:)`); a role,\nuser or tenant id taken from the body, a header or an unverified token.\n\n```sh\nrg -n 'findById\\(|findByPk\\(|findUnique\\(|findFirst\\(|findOne\\(|get_object_or_404\\(|objects\\.get\\(|::find(OrFail)?\\(|WHERE id = ' .\nrg -n -i 'skipAuth|isPublic|AllowAny|permitAll|AllowAnonymous|@Public\\(|withoutMiddleware|(body|headers)\\.(role|isAdmin|tenantId|orgId)' .\n```\n\nConfirm with two accounts in two organisations (a test or a local run): A\nasking for B's record gets `404` or `403`, and the query shows why. Fix:\n`backend-auth` section 6; review depth in `security-auth`.\n\n## 2. Injection\n\nInput that changes the structure of a query, command or template instead of\nfilling a slot in it.\n\n- **SQL** (CWE-89): placeholders are safe; identifiers (sort column, table)\n  come from an allowed list. A tagged template (the `sql` tag of postgres.js,\n  Drizzle or Slonik; Prisma's `$queryRaw` tag) binds values; a plain template\n  string given to `query(`, `$queryRawUnsafe(` or `knex.raw(` does not. In\n  psycopg `%s` with a second argument is safe; `%` on the string is not.\n- **NoSQL** (CWE-943): a JSON field arriving as an object of query operators\n  instead of a string; `$where`, `$function`, `$accumulator` run JavaScript.\n  Fix: schema types, Mongoose `sanitizeFilter`, keys starting `$` stripped.\n- **OS commands** (CWE-78): a shell given a string built from input. An\n  argument array avoids the shell, yet a value starting with `-` can become\n  an option (git, curl, tar, ssh): `--` before user values.\n- **Code and templates** (CWE-94, 1336): `eval`, `new Function`, `setTimeout`\n  with a string, Node's `vm` (not a sandbox), Python `exec`, Ruby `send` or\n  `constantize` on a parameter, `require()` of a user path; user text used\n  as the template itself. Authors of templates get Liquid or Mustache.\n- **Others**: LDAP and XPath built by concatenation (use the library's\n  escape); CR or LF in a response or mail header (CWE-113); newlines forging\n  plain-text logs (CWE-117); Log4j 2 before 2.17.1 running lookups in logged\n  text; spreadsheet cells starting `=`, `+`, `-` or `@` run as formulas.\n\n```sh\nrg -n -U -i '`\\s*(select|insert|update|delete|with)\\b[^`]*\\$\\{|queryRawUnsafe|executeRawUnsafe|\\.raw\\(|sequelize\\.query\\(' -t js -t ts .\nrg -n 'execute(many)?\\(\\s*f[\"\\x27]|[\"\\x27]\\s*(?i:select|insert|update|delete)\\b[^\"\\x27]*[\"\\x27]\\s*(%|\\.format\\()|text\\(\\s*f[\"\\x27]|\\.extra\\(|RawSQL\\(' -t py .\nrg -n 'fmt\\.Sprintf\\(\\s*\"\\s*(?i:select|insert|update|delete|with)\\b|(query|query_as|execute)\\(\\s*&?format!|(whereRaw|selectRaw|orderByRaw|DB::raw)\\(|(executeQuery|executeUpdate|createQuery|createNativeQuery)\\(\\s*\"[^\"]*\"\\s*\\+|(where|order|find_by_sql)\\(\\s*\"[^\"]*#\\{' .\nrg -n '\\.(find|findOne|updateOne|deleteMany)\\(\\s*req\\.|\\$where|\\$function|\\$accumulator' .\nrg -n 'child_process|shell:\\s*true|shell\\s*=\\s*True|os\\.system|os\\.popen|exec\\.Command\\(\\s*\"(sh|bash)\"|getRuntime\\(\\)\\.exec|shell_exec|passthru|proc_open|%x\\(' .\nrg -n 'eval\\(|new Function|runInNewContext|instance_eval|constantize|render_template_string|from_string\\(|Handlebars\\.compile|renderString\\(|createTemplate\\(' .\n```\n\n## 3. XSS\n\nInput rendered as markup or script in another user's browser (CWE-79):\nreflected, stored, or DOM-based (from the URL or `postMessage`).\n\n```sh\nrg -n 'innerHTML|outerHTML|insertAdjacentHTML|document\\.write|dangerouslySetInnerHTML|v-html|\\{@html|bypassSecurityTrust|\\.html\\(|\\|\\s*safe\\b|autoescape\\s+off|mark_safe\\(|Markup\\(|\\{!!|\u003C%-|\\{\\{\\{|html_safe|th:utext|Html\\.Raw\\(|template\\.HTML\\(' .\nrg -n 'href=\\{|:href=|location\\.(hash|search)|window\\.open\\(|addEventListener\\(\\s*[\"\\x27]message' .\n```\n\n- Framework escaping covers text and quoted attributes, not `\u003Cscript>`,\n  event handlers, `style`, unquoted attributes or URLs (`javascript:`).\n- Markdown: `marked` does not sanitise, `markdown-it` with `html: true` and\n  Python-Markdown pass raw HTML, `react-markdown` is safe until `rehype-raw`.\n  Sanitise output: DOMPurify, `sanitize-html`, `nh3` (bleach is deprecated).\n- Stored XSS hides in display names, file names, tickets and admin screens;\n  SVG uploads on the app's origin run script; server-side HTML-to-PDF turns\n  it into file reads and SSRF. `HttpOnly` does not make it minor: the script\n  acts as the user. Fix: `frontend-security`.\n\n## 4. CSRF and cross-site WebSockets\n\nAnother site makes the victim's browser send a state-changing request with\ncredentials it attaches by itself: cookies, basic auth, client certificates\n(CWE-352). A bearer token that script sets in a header is not exposed.\n\n- Exemptions: `csrf_exempt`, `verify_authenticity_token` skipped,\n  `validateCsrfTokens(except:`, `csrf().disable()` (fine for token-only\n  APIs), `csurf` (deprecated).\n- `SameSite=Lax` stops most of it, but not a state-changing `GET`, not a\n  sibling subdomain (same-site is not same-origin), and browsers differ for\n  cookies without the attribute: it must be explicit. JSON endpoints resist\n  forms only while they refuse other content types. WebSocket upgrades carry\n  cookies and ignore CORS: the server checks `Origin`.\n- Fix: explicit `SameSite`, the framework's token or an `Origin` or\n  `Sec-Fetch-Site` check on unsafe methods, no change of state on `GET`\n  (`backend-auth` section 2).\n\n## 5. SSRF\n\nThe server fetches a URL the user chose and reaches what the user cannot:\ninternal services, cloud metadata, admin ports (CWE-918). Link previews,\nimports from a URL, webhooks, image proxies, PDF and screenshot renderers,\ncustomer-supplied OIDC issuers, XML and SVG handling.\n\n```sh\nrg -n 'fetch\\(|axios|got\\(|undici|https?\\.(get|request)\\(|requests\\.(get|post|request)\\(|httpx\\.|urlopen\\(|aiohttp|http\\.(Get|Post|NewRequest)|reqwest::|Net::HTTP|URI\\.open|file_get_contents\\(|curl_setopt|RestTemplate|WebClient|page\\.goto\\(' .\n```\n\n- Partial control counts (a chosen path or port on an internal host).\n  Checks that fail: string blocklists; the host checked but not the address\n  it resolves to; no re-check after redirects; DNS rebinding; parsers that\n  disagree about `@`, backslashes or IP notations; `file:` and `gopher:`.\n- Rule out loopback, private ranges, link-local with `169.254.169.254` and\n  `fd00:ec2::254`, `100.100.100.200` (Alibaba), internal names, Docker's API.\n- Fix: an allow-list of hosts, or resolve, refuse private, loopback and\n  link-local addresses, connect to the checked address and re-check\n  redirects (`backend-security` section 2; `request-filtering-agent` in Node,\n  a `net.Dialer` `Control` hook in Go). IMDSv2 limits the damage.\n\n## 6. Paths, archives and uploads\n\nA user value in a path escapes its directory (CWE-22, 98); an upload becomes\ncode, markup on the app's origin or an outage (CWE-434).\n\n```sh\nrg -n 'sendFile\\(|createReadStream\\(|readFile(Sync)?\\(|send_file\\(|FileResponse\\(|os\\.path\\.join\\(|filepath\\.Join\\(|http\\.ServeFile\\(|new File\\(|Paths\\.get\\(|(include|require)(_once)?\\s*\\(?\\s*\\$' .\nrg -n 'multer|busboy|formidable|UploadFile|request\\.FILES|FormFile\\(|MultipartFile|move_uploaded_file|originalname|extractall|ZipEntry|zip\\.File' .\n```\n\n- `os.path.join`, `pathlib`, Rust `Path::join` and Node `path.resolve` drop\n  the base when the second part is absolute.\n- Zip slip: entries with `..`, absolute names or symlinks land outside the\n  target: Python `tarfile` without `filter=\"data\"` (the default only from\n  3.14), Java joining `ZipEntry.getName()`, Go joining `zip.File.Name`. Cap\n  total size and entry count (zip bombs).\n- Uploads: type from the content (magic bytes: `file-type`, `python-magic`,\n  `http.DetectContentType`), a size limit while streaming (nginx defaults to\n  1 MB), image bombs (Pillow `MAX_IMAGE_PIXELS`), generated names outside\n  the web root, never executable (PHP in uploads, `.htaccess`), served from\n  another domain or with `Content-Disposition: attachment`.\n- Fix: generated names, or resolve and check the result is under the base\n  with a trailing separator (Go 1.24 `os.Root`, `filepath.IsLocal`; Java\n  `toRealPath().startsWith(base)`) (`backend-security` section 3).\n\n## 7. Open redirects\n\nA redirect target from input (CWE-601): low alone, high in sign-in and OAuth\nflows where it carries codes or tokens away (`next`, `returnTo`, `continue`,\n`callbackUrl`). A \"starts with `\u002F`\" check fails: browsers read a leading `\u002F\u002F`\nor `\u002F\\` as another host. Django has `url_has_allowed_host_and_scheme()`;\nRails 7 raises with `raise_on_open_redirects`. Fix: named destinations, or\nparse against the app's origin and require it (`frontend-security`).\n\n## 8. Insecure deserialisation and XXE\n\nNative deserialisers can run code while rebuilding objects (CWE-502); XML\nparsers resolving external entities read files and make requests (CWE-611).\n\n```sh\nrg -n 'pickle\\.loads?|dill\\.loads?|joblib\\.load|torch\\.load|jsonpickle|marshal\\.loads|yaml\\.load\\(|unsafe_load|Loader=yaml\\.(Loader|UnsafeLoader|FullLoader)|ObjectInputStream|readObject\\(|XMLDecoder|XStream|enableDefaultTyping|activateDefaultTyping|JsonTypeInfo\\.Id\\.CLASS|new Yaml\\(' .\nrg -n 'unserialize\\(|phar:\u002F\u002F|Marshal\\.load|Oj\\.load|node-serialize|BinaryFormatter|TypeNameHandling\\.(All|Auto|Objects)|DocumentBuilderFactory|SAXParserFactory|XMLInputFactory|LIBXML_NOENT|resolve_entities' .\n```\n\n- Safe forms: PyYAML `safe_load`, js-yaml 4 `load`, Psych 4 `YAML.load`,\n  `torch.load` with `weights_only=True` (the default from PyTorch 2.6), PHP\n  `unserialize` with `allowed_classes` false; .NET 9 removed\n  `BinaryFormatter`. A leaked signing key turns signed native formats (some\n  Rails cookie and Java view-state formats) into code execution.\n- XXE: Java's XML factories resolve entities unless configured; PHP with\n  `LIBXML_NOENT`; lxml before 5.0 or with `resolve_entities=True`. SVG, DOCX,\n  XLSX, SAML and SOAP are XML too.\n- Fix: JSON with a schema; where a native format stays, a signature checked\n  first and a class allow-list (Java `ObjectInputFilter`); DTDs off\n  (`disallow-doctype-decl` in Java, `defusedxml` in Python).\n\n## 9. Mass assignment and prototype pollution\n\nThe body written as it came, so a caller sets `role`, `isAdmin`, `ownerId`,\n`tenantId`, `price` or `emailVerified` (CWE-915); or a whole row returned\nwith the password hash (OWASP API3:2023). In JavaScript a deep merge or path\nsetter over user keys writes to `Object.prototype` through `__proto__`,\n`constructor` or `prototype` (CWE-1321), and every object inherits it.\n\n```sh\nrg -n 'Object\\.assign\\([^)]*req\\.body|\\.\\.\\.req\\.body|\\(req\\.body\\)|data:\\s*req\\.body|fields\\s*=\\s*[\"\\x27]__all__|\\*\\*request\\.(data|POST)|permit!|\\$guarded\\s*=\\s*\\[\\]|->all\\(\\)\\)|forceFill\\(' .\nrg -n '__proto__|constructor\\[|\\bmerge\\(|deepmerge|defaultsDeep|extend\\(\\s*true|_\\.set\\(|setWith\\(|set-value|object-path' -t js -t ts .\n```\n\nFix: a schema per operation for what a caller may set and one for what they\nmay see (`backend-api` sections 3 and 4); merges that drop unknown keys, `Map`\nor `Object.create(null)`, the three keys refused, Node's\n`--disable-proto=delete`; old lodash, jQuery `extend` and `set-value` had it.\n\n## 10. ReDoS\n\nA backtracking regex on user input runs for seconds: nested quantifiers like\n`(a+)+`, overlapping alternatives, `new RegExp(input)` (CWE-1333).\nJavaScript, Python `re`, Java, .NET, PCRE and Ruby backtrack; Go, Rust\n`regex` and RE2 do not. Leads: `new RegExp\\(|re\\.compile\\(|Pattern\\.compile\\(`\nand `\\([^)]*[+*]\\)[+*{]`; `eslint-plugin-regexp` and `recheck` test patterns.\nFix: rewrite, cap input length first, a linear engine (`re2`, .NET\n`RegexOptions.NonBacktracking`) or a timeout (Ruby 3.2 `Regexp.timeout`);\nescape user text in a pattern (`RegExp.escape`, `re.escape`).\n\n## 11. Race conditions and business logic\n\nTwo requests at once pass a check meant for one (CWE-362, 367): a coupon or\nbalance spent twice, a trial claimed twice, stock below zero, a code guessed\npast its limit; READ COMMITTED (PostgreSQL's default) does not stop a read\nthen a write. Look for a read, a check in code, then a write; uniqueness by\nquery, not constraint; counters in code; client-sent prices, totals or\ncurrencies; negative quantities; skipped steps; replayed webhooks. Two\nparallel runs must leave one effect. Fix: a conditional update whose row\ncount is checked (`UPDATE ... SET used = true WHERE id = $1 AND NOT used`),\nconstraints, `SELECT ... FOR UPDATE`, idempotency keys, server-side prices\n(`backend-data` section 3).\n\n## 12. Misconfiguration\n\n```sh\nrg -n 'DEBUG\\s*=\\s*True|debug\\s*=\\s*True|APP_DEBUG=true|display_errors|consider_all_requests_local\\s*=\\s*true|exposure\\.include=\\*' .\nrg -n -i 'django-insecure-|changeme|your-256-bit-secret|keyboard cat|ALLOWED_HOSTS\\s*=\\s*\\[\\s*[\"\\x27]\\*|Access-Control-Allow-Origin|origin:\\s*(true|[\"\\x27]\\*)|allow_origins|CORS_ALLOW_ALL_ORIGINS|allowedOriginPatterns' .\n```\n\n- **Debug in production**: Django `DEBUG`, the Werkzeug debugger (a console\n  on the server), Laravel `APP_DEBUG`, Actuator exposing `env` or `heapdump`,\n  the Symfony profiler, public GraphQL IDEs, stack traces in responses\n  (`backend-errors`). **Defaults**: the placeholder secrets above, seeded\n  admins, unchanged dashboard passwords.\n- **CORS** that echoes the origin with credentials lets any site read\n  signed-in responses (high with cookie sessions): Express `origin: true`\n  with `credentials: true`, Spring `allowedOriginPatterns(\"*\")` with\n  credentials, Starlette or FastAPI `allow_origins=[\"*\"]` with\n  `allow_credentials=True` (the origin is echoed when cookies are sent),\n  unanchored regexes, suffix checks, `null` allowed.\n- **Headers** (HSTS, `nosniff`, CSP, `frame-ancestors`, `Referrer-Policy`)\n  missing are low unless they enable a concrete bug. **Served by mistake**:\n  `.git\u002F`, `.env`, backups, directory listings. Fixes: `backend-security`\n  section 5, `devops-security`.\n\n## 13. Limits and enumeration\n\nNo limit on sign-in, one-time codes (six digits fall to a million guesses),\nreset, sign-up, email or SMS (each costs money), search, exports or AI calls\n(CWE-307, 770); limits keyed on a client-supplied `X-Forwarded-For` (Express\n`trust proxy` set to `true`); GraphQL aliases and batching without depth or\ncost limits; no cap on page size, body or query time; different answers for\nknown and unknown accounts (CWE-204). Fix: `backend-security` section 6.\n\n## 14. LLM and agent features\n\nModel output is untrusted input, rendered or put in SQL, shell or a tool\ncall. Pages and emails the model reads can carry instructions (indirect\nprompt injection) that steer it into leaking data, for example through a\nmarkdown image whose URL carries it away. Tools act with the user's\npermissions; destructive actions need a confirmation; no secrets in prompts.\n\n## Check it\n\nEvery route has an access decision you read and every record lookup an owner\nor tenant condition, or a finding; each lead ends as a finding (source, sink,\nreach), not reachable (why) or suspected (the open question); framework\ndefaults were checked in the installed version, not assumed.\n\n## Avoid\n\nCalling an app safe because a grep for `eval` was empty; the IDOR missed\nwhile headers are listed; a sink with no attacker-controlled source; a WAF or\n`HttpOnly` as the XSS fix; a \"starts with \u002F\" redirect check; SSRF checks on\nthe hostname only; CORS echoing origins; check-then-write on money; payloads.\n","# Web application weaknesses\n\nThe naive review greps for `eval`, finds nothing and calls the app safe,\nwhile `GET \u002Fapi\u002Forders\u002F:id` returns any order to any account, checkout trusts\nthe price in the body, and a coupon applies twice when two requests land\ntogether. Each class below has the code that signals it, how to confirm it\nand where the fix lives (method and severity: `security`). Patterns are\nregexes for the `grep` tool or `rg -n`: leads, never findings on their own.\n\n## 1. Broken access control and IDOR\n\nThe commonest critical finding, invisible to scanners (CWE-862, 863, 639):\nroutes outside the auth middleware (registered before it, or exempted);\nserver actions that never read the session; admin actions behind a hidden\nbutton; records loaded by id with no owner or tenant condition (reads,\nupdates, deletes, downloads, exports, bulk actions, nested routes never\nchecked against their parent, socket channels, GraphQL `node(id:)`); a role,\nuser or tenant id taken from the body, a header or an unverified token.\n\n```sh\nrg -n 'findById\\(|findByPk\\(|findUnique\\(|findFirst\\(|findOne\\(|get_object_or_404\\(|objects\\.get\\(|::find(OrFail)?\\(|WHERE id = ' .\nrg -n -i 'skipAuth|isPublic|AllowAny|permitAll|AllowAnonymous|@Public\\(|withoutMiddleware|(body|headers)\\.(role|isAdmin|tenantId|orgId)' .\n```\n\nConfirm with two accounts in two organisations (a test or a local run): A\nasking for B's record gets `404` or `403`, and the query shows why. Fix:\n`backend-auth` section 6; review depth in `security-auth`.\n\n## 2. Injection\n\nInput that changes the structure of a query, command or template instead of\nfilling a slot in it.\n\n- **SQL** (CWE-89): placeholders are safe; identifiers (sort column, table)\n  come from an allowed list. A tagged template (the `sql` tag of postgres.js,\n  Drizzle or Slonik; Prisma's `$queryRaw` tag) binds values; a plain template\n  string given to `query(`, `$queryRawUnsafe(` or `knex.raw(` does not. In\n  psycopg `%s` with a second argument is safe; `%` on the string is not.\n- **NoSQL** (CWE-943): a JSON field arriving as an object of query operators\n  instead of a string; `$where`, `$function`, `$accumulator` run JavaScript.\n  Fix: schema types, Mongoose `sanitizeFilter`, keys starting `$` stripped.\n- **OS commands** (CWE-78): a shell given a string built from input. An\n  argument array avoids the shell, yet a value starting with `-` can become\n  an option (git, curl, tar, ssh): `--` before user values.\n- **Code and templates** (CWE-94, 1336): `eval`, `new Function`, `setTimeout`\n  with a string, Node's `vm` (not a sandbox), Python `exec`, Ruby `send` or\n  `constantize` on a parameter, `require()` of a user path; user text used\n  as the template itself. Authors of templates get Liquid or Mustache.\n- **Others**: LDAP and XPath built by concatenation (use the library's\n  escape); CR or LF in a response or mail header (CWE-113); newlines forging\n  plain-text logs (CWE-117); Log4j 2 before 2.17.1 running lookups in logged\n  text; spreadsheet cells starting `=`, `+`, `-` or `@` run as formulas.\n\n```sh\nrg -n -U -i '`\\s*(select|insert|update|delete|with)\\b[^`]*\\$\\{|queryRawUnsafe|executeRawUnsafe|\\.raw\\(|sequelize\\.query\\(' -t js -t ts .\nrg -n 'execute(many)?\\(\\s*f[\"\\x27]|[\"\\x27]\\s*(?i:select|insert|update|delete)\\b[^\"\\x27]*[\"\\x27]\\s*(%|\\.format\\()|text\\(\\s*f[\"\\x27]|\\.extra\\(|RawSQL\\(' -t py .\nrg -n 'fmt\\.Sprintf\\(\\s*\"\\s*(?i:select|insert|update|delete|with)\\b|(query|query_as|execute)\\(\\s*&?format!|(whereRaw|selectRaw|orderByRaw|DB::raw)\\(|(executeQuery|executeUpdate|createQuery|createNativeQuery)\\(\\s*\"[^\"]*\"\\s*\\+|(where|order|find_by_sql)\\(\\s*\"[^\"]*#\\{' .\nrg -n '\\.(find|findOne|updateOne|deleteMany)\\(\\s*req\\.|\\$where|\\$function|\\$accumulator' .\nrg -n 'child_process|shell:\\s*true|shell\\s*=\\s*True|os\\.system|os\\.popen|exec\\.Command\\(\\s*\"(sh|bash)\"|getRuntime\\(\\)\\.exec|shell_exec|passthru|proc_open|%x\\(' .\nrg -n 'eval\\(|new Function|runInNewContext|instance_eval|constantize|render_template_string|from_string\\(|Handlebars\\.compile|renderString\\(|createTemplate\\(' .\n```\n\n## 3. XSS\n\nInput rendered as markup or script in another user's browser (CWE-79):\nreflected, stored, or DOM-based (from the URL or `postMessage`).\n\n```sh\nrg -n 'innerHTML|outerHTML|insertAdjacentHTML|document\\.write|dangerouslySetInnerHTML|v-html|\\{@html|bypassSecurityTrust|\\.html\\(|\\|\\s*safe\\b|autoescape\\s+off|mark_safe\\(|Markup\\(|\\{!!|\u003C%-|\\{\\{\\{|html_safe|th:utext|Html\\.Raw\\(|template\\.HTML\\(' .\nrg -n 'href=\\{|:href=|location\\.(hash|search)|window\\.open\\(|addEventListener\\(\\s*[\"\\x27]message' .\n```\n\n- Framework escaping covers text and quoted attributes, not `\u003Cscript>`,\n  event handlers, `style`, unquoted attributes or URLs (`javascript:`).\n- Markdown: `marked` does not sanitise, `markdown-it` with `html: true` and\n  Python-Markdown pass raw HTML, `react-markdown` is safe until `rehype-raw`.\n  Sanitise output: DOMPurify, `sanitize-html`, `nh3` (bleach is deprecated).\n- Stored XSS hides in display names, file names, tickets and admin screens;\n  SVG uploads on the app's origin run script; server-side HTML-to-PDF turns\n  it into file reads and SSRF. `HttpOnly` does not make it minor: the script\n  acts as the user. Fix: `frontend-security`.\n\n## 4. CSRF and cross-site WebSockets\n\nAnother site makes the victim's browser send a state-changing request with\ncredentials it attaches by itself: cookies, basic auth, client certificates\n(CWE-352). A bearer token that script sets in a header is not exposed.\n\n- Exemptions: `csrf_exempt`, `verify_authenticity_token` skipped,\n  `validateCsrfTokens(except:`, `csrf().disable()` (fine for token-only\n  APIs), `csurf` (deprecated).\n- `SameSite=Lax` stops most of it, but not a state-changing `GET`, not a\n  sibling subdomain (same-site is not same-origin), and browsers differ for\n  cookies without the attribute: it must be explicit. JSON endpoints resist\n  forms only while they refuse other content types. WebSocket upgrades carry\n  cookies and ignore CORS: the server checks `Origin`.\n- Fix: explicit `SameSite`, the framework's token or an `Origin` or\n  `Sec-Fetch-Site` check on unsafe methods, no change of state on `GET`\n  (`backend-auth` section 2).\n\n## 5. SSRF\n\nThe server fetches a URL the user chose and reaches what the user cannot:\ninternal services, cloud metadata, admin ports (CWE-918). Link previews,\nimports from a URL, webhooks, image proxies, PDF and screenshot renderers,\ncustomer-supplied OIDC issuers, XML and SVG handling.\n\n```sh\nrg -n 'fetch\\(|axios|got\\(|undici|https?\\.(get|request)\\(|requests\\.(get|post|request)\\(|httpx\\.|urlopen\\(|aiohttp|http\\.(Get|Post|NewRequest)|reqwest::|Net::HTTP|URI\\.open|file_get_contents\\(|curl_setopt|RestTemplate|WebClient|page\\.goto\\(' .\n```\n\n- Partial control counts (a chosen path or port on an internal host).\n  Checks that fail: string blocklists; the host checked but not the address\n  it resolves to; no re-check after redirects; DNS rebinding; parsers that\n  disagree about `@`, backslashes or IP notations; `file:` and `gopher:`.\n- Rule out loopback, private ranges, link-local with `169.254.169.254` and\n  `fd00:ec2::254`, `100.100.100.200` (Alibaba), internal names, Docker's API.\n- Fix: an allow-list of hosts, or resolve, refuse private, loopback and\n  link-local addresses, connect to the checked address and re-check\n  redirects (`backend-security` section 2; `request-filtering-agent` in Node,\n  a `net.Dialer` `Control` hook in Go). IMDSv2 limits the damage.\n\n## 6. Paths, archives and uploads\n\nA user value in a path escapes its directory (CWE-22, 98); an upload becomes\ncode, markup on the app's origin or an outage (CWE-434).\n\n```sh\nrg -n 'sendFile\\(|createReadStream\\(|readFile(Sync)?\\(|send_file\\(|FileResponse\\(|os\\.path\\.join\\(|filepath\\.Join\\(|http\\.ServeFile\\(|new File\\(|Paths\\.get\\(|(include|require)(_once)?\\s*\\(?\\s*\\$' .\nrg -n 'multer|busboy|formidable|UploadFile|request\\.FILES|FormFile\\(|MultipartFile|move_uploaded_file|originalname|extractall|ZipEntry|zip\\.File' .\n```\n\n- `os.path.join`, `pathlib`, Rust `Path::join` and Node `path.resolve` drop\n  the base when the second part is absolute.\n- Zip slip: entries with `..`, absolute names or symlinks land outside the\n  target: Python `tarfile` without `filter=\"data\"` (the default only from\n  3.14), Java joining `ZipEntry.getName()`, Go joining `zip.File.Name`. Cap\n  total size and entry count (zip bombs).\n- Uploads: type from the content (magic bytes: `file-type`, `python-magic`,\n  `http.DetectContentType`), a size limit while streaming (nginx defaults to\n  1 MB), image bombs (Pillow `MAX_IMAGE_PIXELS`), generated names outside\n  the web root, never executable (PHP in uploads, `.htaccess`), served from\n  another domain or with `Content-Disposition: attachment`.\n- Fix: generated names, or resolve and check the result is under the base\n  with a trailing separator (Go 1.24 `os.Root`, `filepath.IsLocal`; Java\n  `toRealPath().startsWith(base)`) (`backend-security` section 3).\n\n## 7. Open redirects\n\nA redirect target from input (CWE-601): low alone, high in sign-in and OAuth\nflows where it carries codes or tokens away (`next`, `returnTo`, `continue`,\n`callbackUrl`). A \"starts with `\u002F`\" check fails: browsers read a leading `\u002F\u002F`\nor `\u002F\\` as another host. Django has `url_has_allowed_host_and_scheme()`;\nRails 7 raises with `raise_on_open_redirects`. Fix: named destinations, or\nparse against the app's origin and require it (`frontend-security`).\n\n## 8. Insecure deserialisation and XXE\n\nNative deserialisers can run code while rebuilding objects (CWE-502); XML\nparsers resolving external entities read files and make requests (CWE-611).\n\n```sh\nrg -n 'pickle\\.loads?|dill\\.loads?|joblib\\.load|torch\\.load|jsonpickle|marshal\\.loads|yaml\\.load\\(|unsafe_load|Loader=yaml\\.(Loader|UnsafeLoader|FullLoader)|ObjectInputStream|readObject\\(|XMLDecoder|XStream|enableDefaultTyping|activateDefaultTyping|JsonTypeInfo\\.Id\\.CLASS|new Yaml\\(' .\nrg -n 'unserialize\\(|phar:\u002F\u002F|Marshal\\.load|Oj\\.load|node-serialize|BinaryFormatter|TypeNameHandling\\.(All|Auto|Objects)|DocumentBuilderFactory|SAXParserFactory|XMLInputFactory|LIBXML_NOENT|resolve_entities' .\n```\n\n- Safe forms: PyYAML `safe_load`, js-yaml 4 `load`, Psych 4 `YAML.load`,\n  `torch.load` with `weights_only=True` (the default from PyTorch 2.6), PHP\n  `unserialize` with `allowed_classes` false; .NET 9 removed\n  `BinaryFormatter`. A leaked signing key turns signed native formats (some\n  Rails cookie and Java view-state formats) into code execution.\n- XXE: Java's XML factories resolve entities unless configured; PHP with\n  `LIBXML_NOENT`; lxml before 5.0 or with `resolve_entities=True`. SVG, DOCX,\n  XLSX, SAML and SOAP are XML too.\n- Fix: JSON with a schema; where a native format stays, a signature checked\n  first and a class allow-list (Java `ObjectInputFilter`); DTDs off\n  (`disallow-doctype-decl` in Java, `defusedxml` in Python).\n\n## 9. Mass assignment and prototype pollution\n\nThe body written as it came, so a caller sets `role`, `isAdmin`, `ownerId`,\n`tenantId`, `price` or `emailVerified` (CWE-915); or a whole row returned\nwith the password hash (OWASP API3:2023). In JavaScript a deep merge or path\nsetter over user keys writes to `Object.prototype` through `__proto__`,\n`constructor` or `prototype` (CWE-1321), and every object inherits it.\n\n```sh\nrg -n 'Object\\.assign\\([^)]*req\\.body|\\.\\.\\.req\\.body|\\(req\\.body\\)|data:\\s*req\\.body|fields\\s*=\\s*[\"\\x27]__all__|\\*\\*request\\.(data|POST)|permit!|\\$guarded\\s*=\\s*\\[\\]|->all\\(\\)\\)|forceFill\\(' .\nrg -n '__proto__|constructor\\[|\\bmerge\\(|deepmerge|defaultsDeep|extend\\(\\s*true|_\\.set\\(|setWith\\(|set-value|object-path' -t js -t ts .\n```\n\nFix: a schema per operation for what a caller may set and one for what they\nmay see (`backend-api` sections 3 and 4); merges that drop unknown keys, `Map`\nor `Object.create(null)`, the three keys refused, Node's\n`--disable-proto=delete`; old lodash, jQuery `extend` and `set-value` had it.\n\n## 10. ReDoS\n\nA backtracking regex on user input runs for seconds: nested quantifiers like\n`(a+)+`, overlapping alternatives, `new RegExp(input)` (CWE-1333).\nJavaScript, Python `re`, Java, .NET, PCRE and Ruby backtrack; Go, Rust\n`regex` and RE2 do not. Leads: `new RegExp\\(|re\\.compile\\(|Pattern\\.compile\\(`\nand `\\([^)]*[+*]\\)[+*{]`; `eslint-plugin-regexp` and `recheck` test patterns.\nFix: rewrite, cap input length first, a linear engine (`re2`, .NET\n`RegexOptions.NonBacktracking`) or a timeout (Ruby 3.2 `Regexp.timeout`);\nescape user text in a pattern (`RegExp.escape`, `re.escape`).\n\n## 11. Race conditions and business logic\n\nTwo requests at once pass a check meant for one (CWE-362, 367): a coupon or\nbalance spent twice, a trial claimed twice, stock below zero, a code guessed\npast its limit; READ COMMITTED (PostgreSQL's default) does not stop a read\nthen a write. Look for a read, a check in code, then a write; uniqueness by\nquery, not constraint; counters in code; client-sent prices, totals or\ncurrencies; negative quantities; skipped steps; replayed webhooks. Two\nparallel runs must leave one effect. Fix: a conditional update whose row\ncount is checked (`UPDATE ... SET used = true WHERE id = $1 AND NOT used`),\nconstraints, `SELECT ... FOR UPDATE`, idempotency keys, server-side prices\n(`backend-data` section 3).\n\n## 12. Misconfiguration\n\n```sh\nrg -n 'DEBUG\\s*=\\s*True|debug\\s*=\\s*True|APP_DEBUG=true|display_errors|consider_all_requests_local\\s*=\\s*true|exposure\\.include=\\*' .\nrg -n -i 'django-insecure-|changeme|your-256-bit-secret|keyboard cat|ALLOWED_HOSTS\\s*=\\s*\\[\\s*[\"\\x27]\\*|Access-Control-Allow-Origin|origin:\\s*(true|[\"\\x27]\\*)|allow_origins|CORS_ALLOW_ALL_ORIGINS|allowedOriginPatterns' .\n```\n\n- **Debug in production**: Django `DEBUG`, the Werkzeug debugger (a console\n  on the server), Laravel `APP_DEBUG`, Actuator exposing `env` or `heapdump`,\n  the Symfony profiler, public GraphQL IDEs, stack traces in responses\n  (`backend-errors`). **Defaults**: the placeholder secrets above, seeded\n  admins, unchanged dashboard passwords.\n- **CORS** that echoes the origin with credentials lets any site read\n  signed-in responses (high with cookie sessions): Express `origin: true`\n  with `credentials: true`, Spring `allowedOriginPatterns(\"*\")` with\n  credentials, Starlette or FastAPI `allow_origins=[\"*\"]` with\n  `allow_credentials=True` (the origin is echoed when cookies are sent),\n  unanchored regexes, suffix checks, `null` allowed.\n- **Headers** (HSTS, `nosniff`, CSP, `frame-ancestors`, `Referrer-Policy`)\n  missing are low unless they enable a concrete bug. **Served by mistake**:\n  `.git\u002F`, `.env`, backups, directory listings. Fixes: `backend-security`\n  section 5, `devops-security`.\n\n## 13. Limits and enumeration\n\nNo limit on sign-in, one-time codes (six digits fall to a million guesses),\nreset, sign-up, email or SMS (each costs money), search, exports or AI calls\n(CWE-307, 770); limits keyed on a client-supplied `X-Forwarded-For` (Express\n`trust proxy` set to `true`); GraphQL aliases and batching without depth or\ncost limits; no cap on page size, body or query time; different answers for\nknown and unknown accounts (CWE-204). Fix: `backend-security` section 6.\n\n## 14. LLM and agent features\n\nModel output is untrusted input, rendered or put in SQL, shell or a tool\ncall. Pages and emails the model reads can carry instructions (indirect\nprompt injection) that steer it into leaking data, for example through a\nmarkdown image whose URL carries it away. Tools act with the user's\npermissions; destructive actions need a confirmation; no secrets in prompts.\n\n## Check it\n\nEvery route has an access decision you read and every record lookup an owner\nor tenant condition, or a finding; each lead ends as a finding (source, sink,\nreach), not reachable (why) or suspected (the open question); framework\ndefaults were checked in the installed version, not assumed.\n\n## Avoid\n\nCalling an app safe because a grep for `eval` was empty; the IDOR missed\nwhile headers are listed; a sink with no attacker-controlled source; a WAF or\n`HttpOnly` as the XSS fix; a \"starts with \u002F\" redirect check; SSRF checks on\nthe hostname only; CORS echoing origins; check-then-write on money; payloads.\n",{"name":5,"description":7},"main","38293fe1b096e6bf3646c7344c38786ed688f464","crates\u002Fenowx-core\u002Fskills\u002Fsecurity-web",21,"https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli","https:\u002F\u002Fenowx.ai","https:\u002F\u002Fgithub.com\u002Fenowdev","Pretending to be a Developer","2026-10-06 02:05:35",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add enowdev\u002Fenowxcli --skill security-web",{"tool":59,"command":60},"bunx","bunx skills add enowdev\u002Fenowxcli --skill security-web",{"tool":62,"command":63},"pnpm","pnpm dlx skills add enowdev\u002Fenowxcli --skill security-web","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fsecurity-web\u002FSKILL.md",true,[67,73],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fadvanced-usage.md","REFERENCE","参考文档",7469,"https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fopenscience\u002Fbackend\u002Fcli\u002Fskills\u002Fcloud-compute\u002Fskypilot\u002Freferences\u002Fadvanced-usage.md",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Ftroubleshooting.md",10493,"https:\u002F\u002Fgithub.com\u002Ffadrienne\u002FMyGitHub\u002Fblob\u002Fmain\u002Fopenscience\u002Fbackend\u002Fcli\u002Fskills\u002Fcloud-compute\u002Fskypilot\u002Freferences\u002Ftroubleshooting.md",[78,89,106,119,139,157],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":39},"01M6D2HQYSQD9N7MTNDT4A7CBM","demo-skill","Project-scope demo skill for tests.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fworkspace\u002F.agents\u002Fskills\u002Fdemo-skill\u002FSKILL.md",[],[85,86,87,88,28],"demo skill","demo","tests","project",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":39},"01M6D2HM0GCPM0TM2HPG9HHR2R","writing","Writing words people read: the specific thing instead of claims, words to drop, sentences, interface copy (buttons, labels, errors, empty states, confirmations), page copy, notifications and emails, alt text and link text, numbers and dates, words that translate well, documentation and voice. Read before writing a page's copy, an interface's text or a document.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fwriting\u002FSKILL.md",[],[91,96,97,98,99,100,28,101,102,103,104,105],"text","emails","empty","drop","document","page","voice","notifications","documentation","translate",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":39},"01M6D2HG07YS49NM196Q0R3AZ8","ui","Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui\u002FSKILL.md",[],[108,113,114,115,116,101,117,28,118],"icons","components","SET","responsive","layout","before building",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":39},"01M6D2HB59HZHWG1RYZDV4SJ91","ui-themes","Light and dark themes, and colour that holds in both: tokens with a value per theme, and what each kind of content needs to stay visible (icons, SVG drawings and line art, logos, photos, screenshots, charts, code, maps, borders, shadows, focus, form controls), switching without a flash, and checking both. Read before building a second theme or a theme toggle, and before any drawing, logo or chart on a page that has two themes.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-themes\u002FSKILL.md",[],[108,126,127,128,129,130,131,132,133,28,118,134,101,30,135,136,113,137,138],"ui themes","switching","photos","tokens","drawing","focus","maps","Art","flash","Charts","content","screenshots","logo",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":145,"publishedAt":39},"01M6D2H5R5KRAE524C8QX0T7Q0","ui-structure","Structure before styling: the blueprint written before any interface code (the screen's job, the regions its kind of page needs, their order and why, the layout skeleton in numbers, the components and their states), the anatomy and order of a homepage, a dashboard, a list, a detail page, settings, a form, sign-in, pricing, docs, an article and a checkout, and how to turn the blueprint into code (tokens, layout primitives, components, sections, page). Read first, before building or rebuilding any page or screen.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-structure\u002FSKILL.md",[],[146,108,147,114,148,149,30,150,151,152,117,129,153,154,155,28,118,101,156,31],"structure","ui structure","pricing","dashboard","Blueprint","article","anatomy","styling","primitives","list","why",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":39},"01M6D2H0ZZBJG77MBGPZHA6MWD","ui-stack-vue","Building interfaces in Vue 3 and Nuxt: project layout, script setup with typed defineProps, defineEmits and defineModel, attribute fallthrough, slots and scoped slots, template refs, ref, reactive and computed, watch versus watchEffect, composables and VueUse, provide and inject, Pinia, keyed v-for, transitions, Nuxt 4 (app directory, pages, layouts, useFetch and useAsyncData keys, $fetch in handlers, server routes, runtime config, useSeoMeta, NuxtImg, middleware), VeeValidate forms, Reka UI and Nuxt UI, testing, vue-tsc, and the traps. Read when the project uses Vue or Nuxt.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-stack-vue\u002FSKILL.md",[],[108,164,165,166,167,168,169,170,117,88,171,172,28,173,174,175,176,177,178,179],"vue","stack","ui stack vue","forms","pages","watch","runtime","transitions","fetch","pinia","nuxt","template","server","config","directory","testing"]