@raybase/create 0.0.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/THIRD_PARTY_NOTICES.md +38 -0
- package/assets/apple-touch-icons/0.png +0 -0
- package/assets/apple-touch-icons/1.png +0 -0
- package/assets/apple-touch-icons/2.png +0 -0
- package/assets/apple-touch-icons/3.png +0 -0
- package/assets/apple-touch-icons/4.png +0 -0
- package/assets/apple-touch-icons/5.png +0 -0
- package/assets/apple-touch-icons/6.png +0 -0
- package/assets/apple-touch-icons/7.png +0 -0
- package/assets/apple-touch-icons/8.png +0 -0
- package/assets/apple-touch-icons/9.png +0 -0
- package/assets/apple-touch-icons/A.png +0 -0
- package/assets/apple-touch-icons/B.png +0 -0
- package/assets/apple-touch-icons/C.png +0 -0
- package/assets/apple-touch-icons/D.png +0 -0
- package/assets/apple-touch-icons/E.png +0 -0
- package/assets/apple-touch-icons/F.png +0 -0
- package/assets/apple-touch-icons/G.png +0 -0
- package/assets/apple-touch-icons/H.png +0 -0
- package/assets/apple-touch-icons/I.png +0 -0
- package/assets/apple-touch-icons/J.png +0 -0
- package/assets/apple-touch-icons/K.png +0 -0
- package/assets/apple-touch-icons/L.png +0 -0
- package/assets/apple-touch-icons/M.png +0 -0
- package/assets/apple-touch-icons/N.png +0 -0
- package/assets/apple-touch-icons/O.png +0 -0
- package/assets/apple-touch-icons/P.png +0 -0
- package/assets/apple-touch-icons/Q.png +0 -0
- package/assets/apple-touch-icons/R.png +0 -0
- package/assets/apple-touch-icons/S.png +0 -0
- package/assets/apple-touch-icons/T.png +0 -0
- package/assets/apple-touch-icons/U.png +0 -0
- package/assets/apple-touch-icons/V.png +0 -0
- package/assets/apple-touch-icons/W.png +0 -0
- package/assets/apple-touch-icons/X.png +0 -0
- package/assets/apple-touch-icons/Y.png +0 -0
- package/assets/apple-touch-icons/Z.png +0 -0
- package/assets/apple-touch-icons/default.png +0 -0
- package/dist/.source-hash +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2351 -0
- package/dist/index.js.map +1 -0
- package/dist/raybase-package-ranges.d.ts +11 -0
- package/dist/raybase-package-ranges.d.ts.map +1 -0
- package/dist/raybase-package-ranges.js +11 -0
- package/dist/raybase-package-ranges.js.map +1 -0
- package/dist/source-fetch.d.ts +91 -0
- package/dist/source-fetch.d.ts.map +1 -0
- package/dist/source-fetch.js +325 -0
- package/dist/source-fetch.js.map +1 -0
- package/dist/source-hash.d.ts +2 -0
- package/dist/source-hash.d.ts.map +1 -0
- package/dist/source-hash.js +23 -0
- package/dist/source-hash.js.map +1 -0
- package/dist/starter-description.d.ts +44 -0
- package/dist/starter-description.d.ts.map +1 -0
- package/dist/starter-description.js +273 -0
- package/dist/starter-description.js.map +1 -0
- package/dist/starter-source.d.ts +43 -0
- package/dist/starter-source.d.ts.map +1 -0
- package/dist/starter-source.js +156 -0
- package/dist/starter-source.js.map +1 -0
- package/dist/store-app-apply.d.ts +27 -0
- package/dist/store-app-apply.d.ts.map +1 -0
- package/dist/store-app-apply.js +100 -0
- package/dist/store-app-apply.js.map +1 -0
- package/dist/store-app-manifest.d.ts +86 -0
- package/dist/store-app-manifest.d.ts.map +1 -0
- package/dist/store-app-manifest.js +110 -0
- package/dist/store-app-manifest.js.map +1 -0
- package/dist/store-app-registry.d.ts +30 -0
- package/dist/store-app-registry.d.ts.map +1 -0
- package/dist/store-app-registry.js +232 -0
- package/dist/store-app-registry.js.map +1 -0
- package/models/recommended.json +42 -0
- package/modules/api/templates/react-router/app/api/operations.ts +8 -0
- package/modules/api/templates/tanstack-start/src/api/operations.ts +15 -0
- package/modules/docs/templates/astro-emdash/content/docs/getting-started.mdx +13 -0
- package/modules/docs/templates/astro-emdash/content/docs/index.mdx +13 -0
- package/modules/docs/templates/astro-emdash/content/docs/mcp.mdx +11 -0
- package/modules/docs/templates/astro-emdash/content/docs/meta.json +4 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/getting-started.mdx +12 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/index.mdx +12 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/mcp.mdx +10 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/meta.json +4 -0
- package/modules/docs/templates/astro-emdash/site/source.config.ts +10 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-assets.ts +1 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-client.tsx +22 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-data.ts +24 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-handler.tsx +105 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-layout.tsx +56 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-mdx.tsx +79 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-page-actions.tsx +146 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-page.tsx +70 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/llm-text.ts +61 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/source.ts +7 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/docs/[...slug].ts +6 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/docs/api/markdown.ts +4 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/docs/api/search.ts +4 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/llms.txt.ts +8 -0
- package/modules/docs/templates/astro-emdash/site/src/styles-docs.css +3 -0
- package/modules/docs/templates/astro-emdash/source.config.ts +10 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-assets.ts +1 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-client.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-data.ts +24 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-handler.tsx +105 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-layout.tsx +56 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-mdx.tsx +79 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-page-actions.tsx +146 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-page.tsx +70 -0
- package/modules/docs/templates/astro-emdash/src/docs/llm-text.ts +61 -0
- package/modules/docs/templates/astro-emdash/src/docs/source.ts +7 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs/$.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs/api/markdown.ts +12 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs/api/search.ts +12 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs.index.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/styles-docs.css +3 -0
- package/modules/docs/templates/react-router/app/components/mdx.tsx +79 -0
- package/modules/docs/templates/react-router/app/lib/layout.shared.tsx +54 -0
- package/modules/docs/templates/react-router/app/lib/source.ts +7 -0
- package/modules/docs/templates/react-router/app/routes/docs.$.tsx +49 -0
- package/modules/docs/templates/react-router/app/routes/docs.api.search.ts +10 -0
- package/modules/docs/templates/react-router/app/routes/docs.tsx +13 -0
- package/modules/docs/templates/react-router/content/docs/getting-started.mdx +8 -0
- package/modules/docs/templates/react-router/content/docs/index.mdx +8 -0
- package/modules/docs/templates/react-router/content/docs/mcp.mdx +121 -0
- package/modules/docs/templates/react-router/content/docs/meta.json +4 -0
- package/modules/docs/templates/react-router/source.config.ts +5 -0
- package/modules/docs/templates/tanstack-start/content/docs/getting-started.mdx +10 -0
- package/modules/docs/templates/tanstack-start/content/docs/index.mdx +8 -0
- package/modules/docs/templates/tanstack-start/content/docs/mcp.mdx +121 -0
- package/modules/docs/templates/tanstack-start/content/docs/meta.json +4 -0
- package/modules/docs/templates/tanstack-start/source.config.ts +10 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-assets.ts +1 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-client.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-data.ts +24 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-handler.tsx +105 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-layout.tsx +56 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-mdx.tsx +79 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-page-actions.tsx +146 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-page.tsx +70 -0
- package/modules/docs/templates/tanstack-start/src/docs/llm-text.ts +61 -0
- package/modules/docs/templates/tanstack-start/src/docs/source.ts +7 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs/$.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs/api/markdown.ts +12 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs/api/search.ts +12 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs.index.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/styles-docs.css +3 -0
- package/modules/guide/templates/astro-emdash/content/guide/capability-map.md +17 -0
- package/modules/guide/templates/astro-emdash/src/components/guide-widget.tsx +41 -0
- package/modules/guide/templates/astro-emdash/src/guide/actions.ts +8 -0
- package/modules/guide/templates/astro-emdash/src/guide/config.ts +21 -0
- package/modules/guide/templates/astro-emdash/src/guide/corpus.gen.ts +4 -0
- package/modules/guide/templates/astro-emdash/src/guide/corpus.manifest.json +72 -0
- package/modules/guide/templates/astro-emdash/src/guide/corpus.ts +4 -0
- package/modules/guide/templates/astro-emdash/src/guide/resources.json +4 -0
- package/modules/guide/templates/react-router/app/components/guide-widget.tsx +29 -0
- package/modules/guide/templates/react-router/app/guide/actions.ts +3 -0
- package/modules/guide/templates/react-router/app/guide/config.ts +21 -0
- package/modules/guide/templates/react-router/app/guide/corpus.gen.ts +4 -0
- package/modules/guide/templates/react-router/app/guide/corpus.manifest.json +22 -0
- package/modules/guide/templates/react-router/app/guide/corpus.ts +4 -0
- package/modules/guide/templates/react-router/app/guide/resources.json +4 -0
- package/modules/guide/templates/react-router/content/guide/capability-map.md +13 -0
- package/modules/guide/templates/tanstack-start/content/guide/capability-map.md +17 -0
- package/modules/guide/templates/tanstack-start/src/components/guide-widget.tsx +41 -0
- package/modules/guide/templates/tanstack-start/src/guide/actions.ts +17 -0
- package/modules/guide/templates/tanstack-start/src/guide/config.ts +21 -0
- package/modules/guide/templates/tanstack-start/src/guide/corpus.gen.ts +4 -0
- package/modules/guide/templates/tanstack-start/src/guide/corpus.manifest.json +22 -0
- package/modules/guide/templates/tanstack-start/src/guide/corpus.ts +4 -0
- package/modules/guide/templates/tanstack-start/src/guide/resources.json +4 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
- package/modules/openai-subscription/templates/astro-emdash/src/openai-subscription.ts +11 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
- package/modules/openai-subscription/templates/react-router/app/openai-subscription.ts +11 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
- package/modules/openai-subscription/templates/tanstack-start/src/openai-subscription.ts +11 -0
- package/package.json +34 -8
- package/skills/README.md +122 -0
- package/skills/raybase-actions/SKILL.md +223 -0
- package/skills/raybase-actions/references/action-patterns.md +190 -0
- package/skills/raybase-actions/references/adapting-actions.md +93 -0
- package/skills/raybase-actions/references/testing-actions.md +48 -0
- package/skills/raybase-agent-debugging/SKILL.md +230 -0
- package/skills/raybase-ai/SKILL.md +1310 -0
- package/skills/raybase-api/SKILL.md +45 -0
- package/skills/raybase-astro-emdash/SKILL.md +143 -0
- package/skills/raybase-astro-emdash-content-model/SKILL.md +217 -0
- package/skills/raybase-astro-emdash-content-model/references/LICENSE-emdash +9 -0
- package/skills/raybase-astro-emdash-content-model/references/emdash-collections.md +265 -0
- package/skills/raybase-astro-emdash-design/LICENSE-impeccable +60 -0
- package/skills/raybase-astro-emdash-design/SKILL.md +170 -0
- package/skills/raybase-astro-emdash-design/reference/color.md +91 -0
- package/skills/raybase-astro-emdash-design/reference/copy.md +73 -0
- package/skills/raybase-astro-emdash-design/reference/direction.md +115 -0
- package/skills/raybase-astro-emdash-design/reference/imagery.md +84 -0
- package/skills/raybase-astro-emdash-design/reference/layout.md +69 -0
- package/skills/raybase-astro-emdash-design/reference/motion.md +75 -0
- package/skills/raybase-astro-emdash-design/reference/polish.md +75 -0
- package/skills/raybase-astro-emdash-design/reference/typography.md +72 -0
- package/skills/raybase-astro-emdash-galley/SKILL.md +265 -0
- package/skills/raybase-astro-emdash-migration/SKILL.md +218 -0
- package/skills/raybase-astro-emdash-migration/references/inventory-and-conversion.md +242 -0
- package/skills/raybase-astro-emdash-security-review/SKILL.md +68 -0
- package/skills/raybase-astro-emdash-theme-selection/SKILL.md +216 -0
- package/skills/raybase-auth/SKILL.md +358 -0
- package/skills/raybase-background-jobs/SKILL.md +774 -0
- package/skills/raybase-building/SKILL.md +409 -0
- package/skills/raybase-building/references/interview-and-spec.md +87 -0
- package/skills/raybase-building/references/planning-docs.md +26 -0
- package/skills/raybase-building/references/schema-and-config.md +70 -0
- package/skills/raybase-changing-a-live-app/SKILL.md +119 -0
- package/skills/raybase-data-and-policies/SKILL.md +377 -0
- package/skills/raybase-deploy/SKILL.md +136 -0
- package/skills/raybase-docs-writing/SKILL.md +119 -0
- package/skills/raybase-guide/SKILL.md +235 -0
- package/skills/raybase-mcp/SKILL.md +309 -0
- package/skills/raybase-mcp/agents/openai.yaml +4 -0
- package/skills/raybase-notifications/SKILL.md +138 -0
- package/skills/raybase-pro-migration/SKILL.md +28 -0
- package/skills/raybase-react-router/SKILL.md +241 -0
- package/skills/raybase-react-router-design/LICENSE-impeccable +60 -0
- package/skills/raybase-react-router-design/SKILL.md +135 -0
- package/skills/raybase-react-router-design/reference/color.md +87 -0
- package/skills/raybase-react-router-design/reference/copy.md +83 -0
- package/skills/raybase-react-router-design/reference/delight.md +48 -0
- package/skills/raybase-react-router-design/reference/interaction.md +91 -0
- package/skills/raybase-react-router-design/reference/layout.md +82 -0
- package/skills/raybase-react-router-design/reference/motion.md +86 -0
- package/skills/raybase-react-router-design/reference/polish.md +79 -0
- package/skills/raybase-react-router-design/reference/typography.md +71 -0
- package/skills/raybase-react-router-security-review/LICENSE +22 -0
- package/skills/raybase-react-router-security-review/SKILL.md +190 -0
- package/skills/raybase-react-router-security-review/agents/openai.yaml +4 -0
- package/skills/raybase-react-router-security-review/references/api-security.md +519 -0
- package/skills/raybase-react-router-security-review/references/authentication.md +353 -0
- package/skills/raybase-react-router-security-review/references/authorization.md +372 -0
- package/skills/raybase-react-router-security-review/references/business-logic.md +443 -0
- package/skills/raybase-react-router-security-review/references/cryptography.md +329 -0
- package/skills/raybase-react-router-security-review/references/csrf.md +398 -0
- package/skills/raybase-react-router-security-review/references/data-protection.md +378 -0
- package/skills/raybase-react-router-security-review/references/deserialization.md +410 -0
- package/skills/raybase-react-router-security-review/references/error-handling.md +436 -0
- package/skills/raybase-react-router-security-review/references/file-security.md +457 -0
- package/skills/raybase-react-router-security-review/references/injection.md +259 -0
- package/skills/raybase-react-router-security-review/references/logging.md +433 -0
- package/skills/raybase-react-router-security-review/references/misconfiguration.md +435 -0
- package/skills/raybase-react-router-security-review/references/modern-threats.md +475 -0
- package/skills/raybase-react-router-security-review/references/raybase-react-router-security.md +235 -0
- package/skills/raybase-react-router-security-review/references/ssrf.md +413 -0
- package/skills/raybase-react-router-security-review/references/supply-chain.md +405 -0
- package/skills/raybase-react-router-security-review/references/xss.md +336 -0
- package/skills/raybase-realtime/SKILL.md +158 -0
- package/skills/raybase-realtime/agents/openai.yaml +4 -0
- package/skills/raybase-schema/SKILL.md +209 -0
- package/skills/raybase-search/SKILL.md +137 -0
- package/skills/raybase-search/agents/openai.yaml +4 -0
- package/skills/raybase-settings/SKILL.md +139 -0
- package/skills/raybase-settings/agents/openai.yaml +4 -0
- package/skills/raybase-tanstack-start/SKILL.md +166 -0
- package/skills/raybase-tanstack-start-design/LICENSE-impeccable +60 -0
- package/skills/raybase-tanstack-start-design/SKILL.md +140 -0
- package/skills/raybase-tanstack-start-design/reference/color.md +80 -0
- package/skills/raybase-tanstack-start-design/reference/copy.md +83 -0
- package/skills/raybase-tanstack-start-design/reference/delight.md +48 -0
- package/skills/raybase-tanstack-start-design/reference/interaction.md +91 -0
- package/skills/raybase-tanstack-start-design/reference/layout.md +82 -0
- package/skills/raybase-tanstack-start-design/reference/motion.md +86 -0
- package/skills/raybase-tanstack-start-design/reference/polish.md +79 -0
- package/skills/raybase-tanstack-start-design/reference/typography.md +71 -0
- package/skills/raybase-tanstack-start-security-review/LICENSE +22 -0
- package/skills/raybase-tanstack-start-security-review/SKILL.md +194 -0
- package/skills/raybase-tanstack-start-security-review/agents/openai.yaml +4 -0
- package/skills/raybase-tanstack-start-security-review/references/api-security.md +519 -0
- package/skills/raybase-tanstack-start-security-review/references/authentication.md +353 -0
- package/skills/raybase-tanstack-start-security-review/references/authorization.md +372 -0
- package/skills/raybase-tanstack-start-security-review/references/business-logic.md +443 -0
- package/skills/raybase-tanstack-start-security-review/references/cryptography.md +329 -0
- package/skills/raybase-tanstack-start-security-review/references/csrf.md +398 -0
- package/skills/raybase-tanstack-start-security-review/references/data-protection.md +378 -0
- package/skills/raybase-tanstack-start-security-review/references/deserialization.md +410 -0
- package/skills/raybase-tanstack-start-security-review/references/error-handling.md +436 -0
- package/skills/raybase-tanstack-start-security-review/references/file-security.md +457 -0
- package/skills/raybase-tanstack-start-security-review/references/injection.md +259 -0
- package/skills/raybase-tanstack-start-security-review/references/logging.md +433 -0
- package/skills/raybase-tanstack-start-security-review/references/misconfiguration.md +435 -0
- package/skills/raybase-tanstack-start-security-review/references/modern-threats.md +475 -0
- package/skills/raybase-tanstack-start-security-review/references/raybase-tanstack-security.md +208 -0
- package/skills/raybase-tanstack-start-security-review/references/ssrf.md +413 -0
- package/skills/raybase-tanstack-start-security-review/references/supply-chain.md +405 -0
- package/skills/raybase-tanstack-start-security-review/references/xss.md +336 -0
- package/skills-manifest.json +41 -0
- package/templates/astro-emdash/.dev.vars.example +7 -0
- package/templates/astro-emdash/AGENTS.md +122 -0
- package/templates/astro-emdash/DESIGN.md +90 -0
- package/templates/astro-emdash/components.json +21 -0
- package/templates/astro-emdash/content/docs/getting-started.mdx +20 -0
- package/templates/astro-emdash/content/docs/index.mdx +13 -0
- package/templates/astro-emdash/content/docs/mcp.mdx +11 -0
- package/templates/astro-emdash/content/docs/meta.json +4 -0
- package/templates/astro-emdash/content/docs/site-templates.mdx +62 -0
- package/templates/astro-emdash/dev/CODEBASE-MAP.md +46 -0
- package/templates/astro-emdash/dev/SPEC-OVERVIEW.md +15 -0
- package/templates/astro-emdash/dev/SPEC.md +84 -0
- package/templates/astro-emdash/dev/features/archive/.gitkeep +1 -0
- package/templates/astro-emdash/docs/theme-previews/base.svg +24 -0
- package/templates/astro-emdash/docs/theme-previews/steel.svg +24 -0
- package/templates/astro-emdash/docs/theme-previews/zen.svg +24 -0
- package/templates/astro-emdash/docs/themes.md +106 -0
- package/templates/astro-emdash/drizzle.config.ts +5 -0
- package/templates/astro-emdash/gitignore +11 -0
- package/templates/astro-emdash/migrations/app/meta/_journal.json +5 -0
- package/templates/astro-emdash/package.json +79 -0
- package/templates/astro-emdash/pnpm-workspace.yaml +71 -0
- package/templates/astro-emdash/public/_headers +4 -0
- package/templates/astro-emdash/site/astro.config.mjs +120 -0
- package/templates/astro-emdash/site/demo/README.md +72 -0
- package/templates/astro-emdash/site/demo/content/collection.json +43 -0
- package/templates/astro-emdash/site/demo/content/entries.json +120 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-card/manifest.json +51 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-card/sample-content.json +5 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-card/template.liquid +48 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/host.json +9 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/manifest.json +38 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/sample-content.json +34 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/template.liquid +84 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/manifest.json +64 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/page.json +7 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/sample-content.json +24 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/template.liquid +100 -0
- package/templates/astro-emdash/site/demo/templates/demo-menu-nav/manifest.json +51 -0
- package/templates/astro-emdash/site/demo/templates/demo-menu-nav/sample-content.json +5 -0
- package/templates/astro-emdash/site/demo/templates/demo-menu-nav/template.liquid +70 -0
- package/templates/astro-emdash/site/gitignore +1 -0
- package/templates/astro-emdash/site/package.json +56 -0
- package/templates/astro-emdash/site/scripts/apply-site-templates.mjs +560 -0
- package/templates/astro-emdash/site/scripts/galley-demo.mjs +298 -0
- package/templates/astro-emdash/site/scripts/seed-galley-starter.mjs +360 -0
- package/templates/astro-emdash/site/scripts/site-origin.mjs +45 -0
- package/templates/astro-emdash/site/seed/seed.json +154 -0
- package/templates/astro-emdash/site/seed/templates/.gitkeep +1 -0
- package/templates/astro-emdash/site/src/components/RaybaseSignedInMenu.astro +163 -0
- package/templates/astro-emdash/site/src/components/blocks/RaybaseActionIsland.astro +41 -0
- package/templates/astro-emdash/site/src/content-door/raybase-routes.ts +738 -0
- package/templates/astro-emdash/site/src/content-door/resolve-page.ts +142 -0
- package/templates/astro-emdash/site/src/content-door/seed.ts +85 -0
- package/templates/astro-emdash/site/src/env.d.ts +12 -0
- package/templates/astro-emdash/site/src/layouts/SiteLayout.astro +68 -0
- package/templates/astro-emdash/site/src/lib/palettes.gen.ts +7 -0
- package/templates/astro-emdash/site/src/lib/site-motion.ts +169 -0
- package/templates/astro-emdash/site/src/lib/site-shell.ts +294 -0
- package/templates/astro-emdash/site/src/live.config.ts +8 -0
- package/templates/astro-emdash/site/src/middleware.ts +20 -0
- package/templates/astro-emdash/site/src/pages/[...slug].astro +113 -0
- package/templates/astro-emdash/site/src/pages/_raybase/handoff/consume.ts +6 -0
- package/templates/astro-emdash/site/src/pages/_raybase/islands/action.ts +8 -0
- package/templates/astro-emdash/site/src/pages/_raybase/sign-out/index.ts +6 -0
- package/templates/astro-emdash/site/src/styles/palette-fonts.gen.css +1 -0
- package/templates/astro-emdash/site/src/styles/palettes.gen.css +3 -0
- package/templates/astro-emdash/site/src/styles.css +607 -0
- package/templates/astro-emdash/site/tsconfig.json +12 -0
- package/templates/astro-emdash/site/wrangler.jsonc +34 -0
- package/templates/astro-emdash/source.config.ts +10 -0
- package/templates/astro-emdash/src/actions.ts +58 -0
- package/templates/astro-emdash/src/ai/agents.ts +20 -0
- package/templates/astro-emdash/src/ai/retrieval.ts +36 -0
- package/templates/astro-emdash/src/auth-door.ts +18 -0
- package/templates/astro-emdash/src/client.tsx +25 -0
- package/templates/astro-emdash/src/components/.gitkeep +1 -0
- package/templates/astro-emdash/src/components/account-menu.tsx +91 -0
- package/templates/astro-emdash/src/components/auth-shell.tsx +69 -0
- package/templates/astro-emdash/src/components/mode-toggle.tsx +32 -0
- package/templates/astro-emdash/src/components/search-command-palette.tsx +107 -0
- package/templates/astro-emdash/src/components/setup-token-page.tsx +196 -0
- package/templates/astro-emdash/src/components/ui/avatar.tsx +107 -0
- package/templates/astro-emdash/src/components/ui/badge.tsx +52 -0
- package/templates/astro-emdash/src/components/ui/button.tsx +69 -0
- package/templates/astro-emdash/src/components/ui/checkbox.tsx +29 -0
- package/templates/astro-emdash/src/components/ui/dialog.tsx +158 -0
- package/templates/astro-emdash/src/components/ui/dropdown-menu.tsx +303 -0
- package/templates/astro-emdash/src/components/ui/input.tsx +20 -0
- package/templates/astro-emdash/src/components/ui/label.tsx +20 -0
- package/templates/astro-emdash/src/components/ui/scroll-area.tsx +53 -0
- package/templates/astro-emdash/src/components/ui/select.tsx +215 -0
- package/templates/astro-emdash/src/components/ui/separator.tsx +23 -0
- package/templates/astro-emdash/src/components/ui/sheet.tsx +138 -0
- package/templates/astro-emdash/src/components/ui/sidebar.tsx +728 -0
- package/templates/astro-emdash/src/components/ui/skeleton.tsx +13 -0
- package/templates/astro-emdash/src/components/ui/textarea.tsx +18 -0
- package/templates/astro-emdash/src/components/ui/tooltip.tsx +66 -0
- package/templates/astro-emdash/src/db/migrations.gen.ts +6 -0
- package/templates/astro-emdash/src/db/schema.ts +6 -0
- package/templates/astro-emdash/src/db/seed.ts +16 -0
- package/templates/astro-emdash/src/db/storage.ts +32 -0
- package/templates/astro-emdash/src/docs/docs-assets.ts +1 -0
- package/templates/astro-emdash/src/docs/docs-client.tsx +22 -0
- package/templates/astro-emdash/src/docs/docs-data.ts +24 -0
- package/templates/astro-emdash/src/docs/docs-handler.tsx +105 -0
- package/templates/astro-emdash/src/docs/docs-layout.tsx +56 -0
- package/templates/astro-emdash/src/docs/docs-mdx.tsx +79 -0
- package/templates/astro-emdash/src/docs/docs-page-actions.tsx +146 -0
- package/templates/astro-emdash/src/docs/docs-page.tsx +70 -0
- package/templates/astro-emdash/src/docs/llm-text.ts +61 -0
- package/templates/astro-emdash/src/docs/source.ts +7 -0
- package/templates/astro-emdash/src/guide/corpus.gen.ts +4 -0
- package/templates/astro-emdash/src/guide/corpus.manifest.json +72 -0
- package/templates/astro-emdash/src/hooks/use-mobile.ts +19 -0
- package/templates/astro-emdash/src/jobs.example.ts +48 -0
- package/templates/astro-emdash/src/lib/account.ts +12 -0
- package/templates/astro-emdash/src/lib/auth-client.ts +181 -0
- package/templates/astro-emdash/src/lib/utils.ts +6 -0
- package/templates/astro-emdash/src/mcp-app.ts +57 -0
- package/templates/astro-emdash/src/notifications.example.ts +37 -0
- package/templates/astro-emdash/src/raybase.auth.ts +70 -0
- package/templates/astro-emdash/src/raybase.config.ts +49 -0
- package/templates/astro-emdash/src/raybase.server.ts +56 -0
- package/templates/astro-emdash/src/realtime.example.ts +18 -0
- package/templates/astro-emdash/src/router.tsx +19 -0
- package/templates/astro-emdash/src/routes/__root.tsx +56 -0
- package/templates/astro-emdash/src/routes/_app/admin.tsx +13 -0
- package/templates/astro-emdash/src/routes/_app/forgot-password.tsx +97 -0
- package/templates/astro-emdash/src/routes/_app/index.tsx +169 -0
- package/templates/astro-emdash/src/routes/_app/invite.$token.tsx +11 -0
- package/templates/astro-emdash/src/routes/_app/login.tsx +193 -0
- package/templates/astro-emdash/src/routes/_app/profile.tsx +98 -0
- package/templates/astro-emdash/src/routes/_app/reset-password.$token.tsx +15 -0
- package/templates/astro-emdash/src/routes/_app/reset-password.tsx +115 -0
- package/templates/astro-emdash/src/routes/_app/setup.$token.tsx +11 -0
- package/templates/astro-emdash/src/routes/_app/signup.tsx +141 -0
- package/templates/astro-emdash/src/routes/_app/verify-email.$token.tsx +15 -0
- package/templates/astro-emdash/src/routes/_app/verify-email.tsx +154 -0
- package/templates/astro-emdash/src/routes/_app.tsx +33 -0
- package/templates/astro-emdash/src/routes/admin/$.ts +20 -0
- package/templates/astro-emdash/src/routes/api/$.ts +19 -0
- package/templates/astro-emdash/src/routes/docs/$.tsx +22 -0
- package/templates/astro-emdash/src/routes/docs/api/markdown.ts +12 -0
- package/templates/astro-emdash/src/routes/docs/api/search.ts +12 -0
- package/templates/astro-emdash/src/routes/docs.index.tsx +22 -0
- package/templates/astro-emdash/src/routes/docs.tsx +22 -0
- package/templates/astro-emdash/src/search.ts +6 -0
- package/templates/astro-emdash/src/settings.ts +12 -0
- package/templates/astro-emdash/src/styles-docs.css +3 -0
- package/templates/astro-emdash/src/styles.css +101 -0
- package/templates/astro-emdash/src/themes/base.css +76 -0
- package/templates/astro-emdash/src/themes/carbon.css +76 -0
- package/templates/astro-emdash/src/themes/fonts.css +25 -0
- package/templates/astro-emdash/src/themes/sage.css +76 -0
- package/templates/astro-emdash/src/themes/sand.css +76 -0
- package/templates/astro-emdash/src/themes/slate.css +81 -0
- package/templates/astro-emdash/src/themes/ultra.css +76 -0
- package/templates/astro-emdash/src/themes/zen.css +76 -0
- package/templates/astro-emdash/src/worker-entry.ts +31 -0
- package/templates/astro-emdash/tests/raybase-patterns.test.ts +29 -0
- package/templates/astro-emdash/tsconfig.json +36 -0
- package/templates/astro-emdash/vite.config.ts +130 -0
- package/templates/astro-emdash/vitest.config.ts +8 -0
- package/templates/astro-emdash/wrangler.jsonc +112 -0
- package/templates/react-router/.dev.vars.example +5 -0
- package/templates/react-router/.editorconfig +15 -0
- package/templates/react-router/AGENTS.md +54 -0
- package/templates/react-router/README.md +52 -0
- package/templates/react-router/app/app.css +44 -0
- package/templates/react-router/app/components/mdx.tsx +79 -0
- package/templates/react-router/app/components/ui/button.tsx +45 -0
- package/templates/react-router/app/components/ui/card.tsx +87 -0
- package/templates/react-router/app/components/ui/separator.tsx +22 -0
- package/templates/react-router/app/db/migrations.gen.ts +6 -0
- package/templates/react-router/app/db/schema.ts +56 -0
- package/templates/react-router/app/db/seed.ts +14 -0
- package/templates/react-router/app/entry.server.tsx +41 -0
- package/templates/react-router/app/globals.d.ts +1 -0
- package/templates/react-router/app/lib/layout.shared.tsx +52 -0
- package/templates/react-router/app/lib/source.ts +7 -0
- package/templates/react-router/app/lib/utils.ts +6 -0
- package/templates/react-router/app/raybase.server.ts +65 -0
- package/templates/react-router/app/root.tsx +23 -0
- package/templates/react-router/app/routes/_index.tsx +53 -0
- package/templates/react-router/app/routes/docs.$.tsx +49 -0
- package/templates/react-router/app/routes/docs.api.search.ts +10 -0
- package/templates/react-router/app/routes/docs.tsx +13 -0
- package/templates/react-router/app/routes.ts +3 -0
- package/templates/react-router/components.json +22 -0
- package/templates/react-router/content/docs/getting-started.mdx +15 -0
- package/templates/react-router/content/docs/index.mdx +8 -0
- package/templates/react-router/content/docs/mcp.mdx +121 -0
- package/templates/react-router/content/docs/meta.json +4 -0
- package/templates/react-router/dev/CODEBASE-MAP.md +48 -0
- package/templates/react-router/dev/SPEC-OVERVIEW.md +35 -0
- package/templates/react-router/dev/SPEC.md +93 -0
- package/templates/react-router/dev/features/archive/.gitkeep +1 -0
- package/templates/react-router/drizzle.config.ts +5 -0
- package/templates/react-router/env.d.ts +53 -0
- package/templates/react-router/gitignore +23 -0
- package/templates/react-router/migrations/app/meta/_journal.json +1 -0
- package/templates/react-router/package.json +70 -0
- package/templates/react-router/public/_headers +4 -0
- package/templates/react-router/public/favicon.ico +0 -0
- package/templates/react-router/react-router.config.ts +9 -0
- package/templates/react-router/source.config.ts +5 -0
- package/templates/react-router/tests/raybase-patterns.test.ts +23 -0
- package/templates/react-router/tsconfig.json +27 -0
- package/templates/react-router/vite.config.ts +59 -0
- package/templates/react-router/vitest.config.ts +8 -0
- package/templates/react-router/workers/app.ts +40 -0
- package/templates/react-router/wrangler.jsonc +111 -0
- package/templates/tanstack-start/.dev.vars.example +5 -0
- package/templates/tanstack-start/AGENTS.md +95 -0
- package/templates/tanstack-start/DESIGN.md +65 -0
- package/templates/tanstack-start/components.json +21 -0
- package/templates/tanstack-start/content/docs/getting-started.mdx +65 -0
- package/templates/tanstack-start/content/docs/index.mdx +10 -0
- package/templates/tanstack-start/content/docs/mcp.mdx +122 -0
- package/templates/tanstack-start/content/docs/meta.json +4 -0
- package/templates/tanstack-start/dev/CODEBASE-MAP.md +84 -0
- package/templates/tanstack-start/dev/SPEC-OVERVIEW.md +46 -0
- package/templates/tanstack-start/dev/SPEC.md +213 -0
- package/templates/tanstack-start/dev/features/archive/.gitkeep +1 -0
- package/templates/tanstack-start/docs/theme-previews/base.svg +24 -0
- package/templates/tanstack-start/docs/theme-previews/steel.svg +24 -0
- package/templates/tanstack-start/docs/theme-previews/zen.svg +24 -0
- package/templates/tanstack-start/docs/themes.md +116 -0
- package/templates/tanstack-start/drizzle.config.ts +5 -0
- package/templates/tanstack-start/gitignore +11 -0
- package/templates/tanstack-start/migrations/app/0000_low_karen_page.sql +26 -0
- package/templates/tanstack-start/migrations/app/meta/0000_snapshot.json +196 -0
- package/templates/tanstack-start/migrations/app/meta/_journal.json +13 -0
- package/templates/tanstack-start/package.json +77 -0
- package/templates/tanstack-start/public/_headers +8 -0
- package/templates/tanstack-start/public/icons/app-icon-maskable.svg +1 -0
- package/templates/tanstack-start/public/icons/app-icon.svg +1 -0
- package/templates/tanstack-start/public/icons/apple-touch-icon.png +0 -0
- package/templates/tanstack-start/public/manifest.webmanifest +14 -0
- package/templates/tanstack-start/public/raybase-push-sw.js +32 -0
- package/templates/tanstack-start/source.config.ts +10 -0
- package/templates/tanstack-start/src/actions.ts +560 -0
- package/templates/tanstack-start/src/ai/agents.ts +78 -0
- package/templates/tanstack-start/src/ai/retrieval.ts +36 -0
- package/templates/tanstack-start/src/auth-door.ts +18 -0
- package/templates/tanstack-start/src/client.tsx +25 -0
- package/templates/tanstack-start/src/components/.gitkeep +1 -0
- package/templates/tanstack-start/src/components/account-menu.tsx +127 -0
- package/templates/tanstack-start/src/components/auth-shell.tsx +69 -0
- package/templates/tanstack-start/src/components/install-app.tsx +35 -0
- package/templates/tanstack-start/src/components/mode-toggle.tsx +32 -0
- package/templates/tanstack-start/src/components/search-command-palette.tsx +107 -0
- package/templates/tanstack-start/src/components/setup-token-page.tsx +197 -0
- package/templates/tanstack-start/src/components/ui/avatar.tsx +107 -0
- package/templates/tanstack-start/src/components/ui/badge.tsx +52 -0
- package/templates/tanstack-start/src/components/ui/button.tsx +69 -0
- package/templates/tanstack-start/src/components/ui/checkbox.tsx +29 -0
- package/templates/tanstack-start/src/components/ui/dialog.tsx +158 -0
- package/templates/tanstack-start/src/components/ui/dropdown-menu.tsx +303 -0
- package/templates/tanstack-start/src/components/ui/input.tsx +20 -0
- package/templates/tanstack-start/src/components/ui/label.tsx +20 -0
- package/templates/tanstack-start/src/components/ui/scroll-area.tsx +53 -0
- package/templates/tanstack-start/src/components/ui/select.tsx +215 -0
- package/templates/tanstack-start/src/components/ui/separator.tsx +23 -0
- package/templates/tanstack-start/src/components/ui/sheet.tsx +138 -0
- package/templates/tanstack-start/src/components/ui/sidebar.tsx +728 -0
- package/templates/tanstack-start/src/components/ui/skeleton.tsx +13 -0
- package/templates/tanstack-start/src/components/ui/textarea.tsx +18 -0
- package/templates/tanstack-start/src/components/ui/tooltip.tsx +66 -0
- package/templates/tanstack-start/src/db/migrations.gen.ts +6 -0
- package/templates/tanstack-start/src/db/schema.ts +90 -0
- package/templates/tanstack-start/src/db/seed.ts +106 -0
- package/templates/tanstack-start/src/db/storage.ts +32 -0
- package/templates/tanstack-start/src/docs/docs-assets.ts +1 -0
- package/templates/tanstack-start/src/docs/docs-client.tsx +22 -0
- package/templates/tanstack-start/src/docs/docs-data.ts +24 -0
- package/templates/tanstack-start/src/docs/docs-handler.tsx +105 -0
- package/templates/tanstack-start/src/docs/docs-layout.tsx +56 -0
- package/templates/tanstack-start/src/docs/docs-mdx.tsx +79 -0
- package/templates/tanstack-start/src/docs/docs-page-actions.tsx +146 -0
- package/templates/tanstack-start/src/docs/docs-page.tsx +70 -0
- package/templates/tanstack-start/src/docs/llm-text.ts +61 -0
- package/templates/tanstack-start/src/docs/source.ts +7 -0
- package/templates/tanstack-start/src/hooks/use-mobile.ts +19 -0
- package/templates/tanstack-start/src/hooks/use-pwa-install.ts +77 -0
- package/templates/tanstack-start/src/jobs.example.ts +56 -0
- package/templates/tanstack-start/src/lib/account.ts +13 -0
- package/templates/tanstack-start/src/lib/auth-client.ts +187 -0
- package/templates/tanstack-start/src/lib/push-client.ts +98 -0
- package/templates/tanstack-start/src/lib/utils.ts +6 -0
- package/templates/tanstack-start/src/mcp-app.ts +74 -0
- package/templates/tanstack-start/src/notifications.example.ts +37 -0
- package/templates/tanstack-start/src/raybase.auth.ts +86 -0
- package/templates/tanstack-start/src/raybase.config.ts +86 -0
- package/templates/tanstack-start/src/raybase.server.ts +155 -0
- package/templates/tanstack-start/src/realtime.example.ts +46 -0
- package/templates/tanstack-start/src/router.tsx +19 -0
- package/templates/tanstack-start/src/routes/__root.tsx +73 -0
- package/templates/tanstack-start/src/routes/_app/admin.tsx +13 -0
- package/templates/tanstack-start/src/routes/_app/forgot-password.tsx +97 -0
- package/templates/tanstack-start/src/routes/_app/index.tsx +1316 -0
- package/templates/tanstack-start/src/routes/_app/invite.$token.tsx +11 -0
- package/templates/tanstack-start/src/routes/_app/login.tsx +193 -0
- package/templates/tanstack-start/src/routes/_app/profile.tsx +98 -0
- package/templates/tanstack-start/src/routes/_app/reset-password.$token.tsx +16 -0
- package/templates/tanstack-start/src/routes/_app/reset-password.tsx +115 -0
- package/templates/tanstack-start/src/routes/_app/setup.$token.tsx +11 -0
- package/templates/tanstack-start/src/routes/_app/signup.tsx +141 -0
- package/templates/tanstack-start/src/routes/_app/verify-email.$token.tsx +15 -0
- package/templates/tanstack-start/src/routes/_app/verify-email.tsx +154 -0
- package/templates/tanstack-start/src/routes/_app.tsx +33 -0
- package/templates/tanstack-start/src/routes/admin/$.ts +20 -0
- package/templates/tanstack-start/src/routes/api/$.ts +19 -0
- package/templates/tanstack-start/src/routes/docs/$.tsx +22 -0
- package/templates/tanstack-start/src/routes/docs/api/markdown.ts +12 -0
- package/templates/tanstack-start/src/routes/docs/api/search.ts +12 -0
- package/templates/tanstack-start/src/routes/docs.index.tsx +22 -0
- package/templates/tanstack-start/src/routes/docs.tsx +22 -0
- package/templates/tanstack-start/src/search.ts +26 -0
- package/templates/tanstack-start/src/settings.ts +12 -0
- package/templates/tanstack-start/src/styles-docs.css +3 -0
- package/templates/tanstack-start/src/styles.css +73 -0
- package/templates/tanstack-start/src/themes/base.css +76 -0
- package/templates/tanstack-start/src/themes/carbon.css +76 -0
- package/templates/tanstack-start/src/themes/fonts.css +18 -0
- package/templates/tanstack-start/src/themes/sage.css +76 -0
- package/templates/tanstack-start/src/themes/sand.css +76 -0
- package/templates/tanstack-start/src/themes/slate.css +76 -0
- package/templates/tanstack-start/src/themes/ultra.css +76 -0
- package/templates/tanstack-start/src/themes/zen.css +76 -0
- package/templates/tanstack-start/src/worker-entry.ts +30 -0
- package/templates/tanstack-start/tests/raybase-patterns.test.ts +247 -0
- package/templates/tanstack-start/tsconfig.json +33 -0
- package/templates/tanstack-start/vite.config.ts +132 -0
- package/templates/tanstack-start/vitest.config.ts +8 -0
- package/templates/tanstack-start/wrangler.jsonc +112 -0
- package/README.md +0 -3
package/skills/raybase-react-router-security-review/references/raybase-react-router-security.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Raybase React Router Security Reference
|
|
2
|
+
|
|
3
|
+
Use this reference with `raybase-react-router-security-review`.
|
|
4
|
+
|
|
5
|
+
## How To Use The Reference Pack
|
|
6
|
+
|
|
7
|
+
This file is the Raybase/React Router overlay. It is not a replacement for the issue-class references copied from Sentry's security-review skill.
|
|
8
|
+
|
|
9
|
+
For any suspected issue, load the matching detailed reference:
|
|
10
|
+
|
|
11
|
+
- API shape, methods, request validation, CORS, rate limits, mass assignment: `api-security.md`
|
|
12
|
+
- Auth flows, sessions, cookies, invite/setup/login behavior: `authentication.md`
|
|
13
|
+
- Roles, policies, IDOR, object ownership, privilege escalation: `authorization.md`
|
|
14
|
+
- Multi-step workflows, race conditions, numeric tampering, idempotency: `business-logic.md`
|
|
15
|
+
- Secrets, token generation, hashing, encryption, randomness: `cryptography.md`
|
|
16
|
+
- Cross-site state changes, React Router actions, CORS with credentials: `csrf.md`
|
|
17
|
+
- PII, secrets, logs, backups, exports, cache headers, response filtering: `data-protection.md`
|
|
18
|
+
- JSON/YAML/XML/custom serialized blobs, unsafe parsing: `deserialization.md`
|
|
19
|
+
- Fail-open logic, stack traces, differential errors, cleanup on failure: `error-handling.md`
|
|
20
|
+
- Uploads, R2 object keys, downloads, archives, XML, temp files: `file-security.md`
|
|
21
|
+
- SQL, command, template, NoSQL, LDAP/XPath-style injection: `injection.md`
|
|
22
|
+
- Audit trail gaps, sensitive logs, log injection, retention: `logging.md`
|
|
23
|
+
- Security headers, CSP, CORS, debug endpoints, cookies, file permissions: `misconfiguration.md`
|
|
24
|
+
- Prototype pollution, DOM clobbering, WebSockets, LLM prompt/tool injection: `modern-threats.md`
|
|
25
|
+
- Server-side fetches, webhooks, URL previews, redirects to internal services: `ssrf.md`
|
|
26
|
+
- Dependency, npm registry, package script, CI, lockfile risks: `supply-chain.md`
|
|
27
|
+
- React/DOM/rich text/URL XSS: `xss.md`
|
|
28
|
+
|
|
29
|
+
When a reference uses another language's examples, translate the underlying issue to TypeScript, React Router, Cloudflare Workers, Drizzle, and Raybase. Do not dismiss a reference because its examples are Python, Java, or framework-specific.
|
|
30
|
+
|
|
31
|
+
## App Layout
|
|
32
|
+
|
|
33
|
+
- `dev/SPEC.md`: business owner intent, roles, data, permissions.
|
|
34
|
+
- `app/db/schema.ts`: `appConfig` (app name, roles, signup mode, public routes, AI/MCP/realtime config) and app tables with their policies.
|
|
35
|
+
- `app/raybase.server.ts`: Raybase handler (`createRaybaseApp`), seed, search, modules, `raybasePathPrefixes`, `isRaybaseRequest`, `handleRaybaseRequest`, and `currentUser`.
|
|
36
|
+
- `workers/app.ts`: Cloudflare Worker entry. It sends Raybase-owned paths to the Raybase handler and everything else to React Router, and exports `RaybaseDatabaseObject`.
|
|
37
|
+
- `app/routes/*.tsx` and `app/routes/*.ts`: React Router route modules — loaders, actions, resource routes, and UI.
|
|
38
|
+
- `app/root.tsx`: document shell.
|
|
39
|
+
- `wrangler.jsonc`: Durable Object, R2, AI, queue, compatibility, and environment bindings.
|
|
40
|
+
- `env.d.ts`: hand-maintained `Env` types; a binding declared here but missing from `wrangler.jsonc` is a type, not a binding.
|
|
41
|
+
|
|
42
|
+
Generated apps must explicitly declare invite-only, public, or provider-only
|
|
43
|
+
self-signup in `dev/SPEC.md` and `appConfig.auth.signupMode`; invite-only
|
|
44
|
+
remains the default placeholder. Both public modes create normal `user` users
|
|
45
|
+
only. `"public"` opens provider and password signup; `"provider-only"` opens
|
|
46
|
+
configured providers and closes password signup while preserving password
|
|
47
|
+
sign-in for existing accounts. Raybase `/admin` remains invite/operator-only in
|
|
48
|
+
every mode.
|
|
49
|
+
|
|
50
|
+
Core external login providers are app-owned login buttons for one invite-only
|
|
51
|
+
app. Review `app/raybase.auth.ts` (where `raybase doctor` expects the provider
|
|
52
|
+
configuration, passed to `createRaybaseApp` as `auth`) and
|
|
53
|
+
`auth.externalProviders` together:
|
|
54
|
+
credentials must be env/Worker secrets, provider callbacks must stay under
|
|
55
|
+
Core-owned `/api/auth/*`, provider-created users must require a setup or invite
|
|
56
|
+
token, and unverified or mismatched provider emails must be rejected. Suite SSO,
|
|
57
|
+
hosted brokers, domain auto-provisioning, SAML/SCIM, directory groups, and
|
|
58
|
+
group-to-role mapping are Pro/future work, not Core app code.
|
|
59
|
+
|
|
60
|
+
## What Doctor Already Owns
|
|
61
|
+
|
|
62
|
+
`raybase doctor` checks deterministic invariants: policy coverage for every table/bucket, reserved roles, unsafe public routes, app-only migration sync, handler wiring, the React Router docs-search path, Durable Object/R2/AI/jobs/realtime wiring, `unsafeDb`, `RAYBASE_DEV_MODE`, runtime DDL, raw R2, raw Workers AI, app-role misuse, and required template files.
|
|
63
|
+
|
|
64
|
+
Use doctor output to guide the review, but do not restate doctor findings unless you confirm an exploitable path or a bypass doctor cannot understand.
|
|
65
|
+
|
|
66
|
+
## React Router Boundaries
|
|
67
|
+
|
|
68
|
+
**Raybase's auth wall covers only what Raybase serves.** `workers/app.ts` sends a request to Raybase only when `isRaybaseRequest(url)` matches one of `raybasePathPrefixes`; every other path goes straight to React Router. So a React Router route is public unless its loader (or action) asks Raybase who is there with `currentUser(request, context.cloudflare.env, context.cloudflare.ctx)` and redirects or refuses when it returns `null`. `auth.publicRoutes` does not make router routes public or private. Report:
|
|
69
|
+
|
|
70
|
+
- A loader that returns private data, or an action that changes state, without a `currentUser()` check (or a check whose result is ignored).
|
|
71
|
+
- An action that relies on its route's loader for the check. Actions are separate POST endpoints; each needs its own check.
|
|
72
|
+
- Resource routes (a `loader` or `action` with no default component, such as `docs.api.search.ts`) that return private data without a check.
|
|
73
|
+
- Docs routes (`docs.tsx`, `docs.$.tsx`, `docs.api.search.ts`) without a check when `dev/SPEC.md` says `Docs exposure: signed-in only`. The starter's docs routes do not check, which matches the default `Docs exposure: public`; a builder who chose signed-in only must have added the check.
|
|
74
|
+
- Role or operator decisions made from anything other than Raybase's answer: `isOperator` from `currentUser()`, or Raybase action/row policies. Hidden UI is not a check.
|
|
75
|
+
|
|
76
|
+
**The split itself is a security boundary.** Investigate changes to `isRaybaseRequest`, `raybasePathPrefixes`, or `workers/app.ts`:
|
|
77
|
+
|
|
78
|
+
- Removing a prefix (for example `/api` or `/admin`) hands that path to the router, where an app route can shadow it.
|
|
79
|
+
- An app route that re-implements or proxies a Raybase path instead of letting the Worker hand it to Raybase.
|
|
80
|
+
- Handling `/admin`, `/api/*`, `/mcp`, or the auth pages in `workers/app.ts` instead of passing them unchanged to `handleRaybaseRequest`.
|
|
81
|
+
- Dropping the `isDisabledRaybaseAdminRequest` check that returns 404 when the admin panel is disabled.
|
|
82
|
+
- Wrapping Raybase responses (not only router responses) with `withRaybaseLocalDevChrome`, or calling it with a config that is not `appConfig`.
|
|
83
|
+
|
|
84
|
+
**Loaders and actions run on the server; their results go to the browser.** Everything a loader returns is serialized into the page. Report loaders that return whole rows, secrets, tokens, other users' data, or fields the page does not show. Keep `*.server.ts` modules (`app/raybase.server.ts` and anything importing bindings) out of client-reachable modules.
|
|
85
|
+
|
|
86
|
+
**Calling Raybase from a loader or action.** Server code that calls Raybase's API through `handleRaybaseRequest` should forward the incoming `cookie` header, so Raybase applies the signed-in user's policies. Report:
|
|
87
|
+
|
|
88
|
+
- Calls that forward no session and instead use a service context or `adminOverride` to read or write data on a user's behalf without scoping it to that user.
|
|
89
|
+
- POSTs that set `Origin` from the request URL (or any constant) to satisfy Raybase's CSRF check. Forward the browser's own `Origin`/`Referer`; synthesising one switches Raybase's check off for every request that reaches the action, including ones that arrive with no `Origin`, which React Router lets through.
|
|
90
|
+
|
|
91
|
+
**CSRF in React Router actions.** React Router (7.x, as the starter pins) aborts an action whose `Origin` header names a different origin than the request URL, unless `allowedActionOrigins` in `react-router.config.ts` allows it; a POST with no `Origin` passes. Raybase's session cookie is `SameSite=Lax`, so a cross-site form post does not carry it, and Raybase's own CSRF check refuses `/api/*` mutations without a same-host `Origin` or `Referer`. Report an `allowedActionOrigins` that admits origins the app does not control, a state-changing loader (loaders run on GET: links, prefetch, `<form method="get">`), and server code that sets `Origin` itself when forwarding to Raybase. Load `csrf.md` for any state-changing action.
|
|
92
|
+
|
|
93
|
+
**Redirects.** `redirect()` targets and `?next=` values built from request input are open-redirect candidates. Allow only same-origin paths.
|
|
94
|
+
|
|
95
|
+
Load `api-security.md`, `authorization.md`, `business-logic.md`, and `csrf.md` for any loader or action that reads or writes private app data.
|
|
96
|
+
|
|
97
|
+
## Raybase Boundaries
|
|
98
|
+
|
|
99
|
+
High-risk bypasses:
|
|
100
|
+
|
|
101
|
+
- `unsafeDb`, raw D1 executors, or ad hoc SQL returning app rows without Raybase policies.
|
|
102
|
+
- Direct `env.RAYBASE_FILES.get/put/delete/list` calls instead of Raybase storage helpers.
|
|
103
|
+
- Direct `env.AI.run` calls instead of Raybase AI helpers when AI is enabled.
|
|
104
|
+
- Runtime `CREATE`, `ALTER`, or `DROP` in routes, loaders, actions, MCP tools, or jobs.
|
|
105
|
+
- Direct Better Auth APIs or custom auth routes in app code.
|
|
106
|
+
- Provider secrets, access tokens, refresh tokens, ID tokens, or raw profile
|
|
107
|
+
payloads in source, docs, app tables, settings, or audit metadata.
|
|
108
|
+
- `auth.publicRoutes` with `/api`, `/api/*`, `*`, `/*`, or a private page/API route.
|
|
109
|
+
- `auth.publicRoutes` with `/signup`, `/api/auth/signup`, `/api/auth/*`,
|
|
110
|
+
`/api`, `/api/*`, `*`, `/*`, or a private page/API route.
|
|
111
|
+
- MCP `generatedTools` exposing every table or destructive actions without a clear business requirement.
|
|
112
|
+
- AI actions or MCP tools that perform writes without Raybase policy checks or explicit user authorization.
|
|
113
|
+
|
|
114
|
+
Policy review:
|
|
115
|
+
|
|
116
|
+
- Every app table needs `read`, `create`, `update`, and `delete` policies.
|
|
117
|
+
- Policies should use business roles and ownership helpers such as `owns("createdBy")`; generic app roles like `admin` and `owner` are not business roles in Core apps.
|
|
118
|
+
- Check horizontal access: a user should not access another user's records unless the spec says the role can.
|
|
119
|
+
- Check vertical access: a regular user should not perform manager/operator actions by changing an id, status, role field, route param, or request body.
|
|
120
|
+
- Check mass assignment: a user should not set role, owner, status, price, approval, or workflow fields just because those fields exist in submitted data.
|
|
121
|
+
- Check workflow integrity: server code should enforce state transitions, idempotency, inventory/quantity/resource limits, and approval order. Client-only state machines are not security boundaries.
|
|
122
|
+
- Check race conditions around quotas, approvals, balance/amount fields, invitation use, destructive actions, and one-time tokens. Durable Objects serialize many app database operations, but app code can still create TOCTOU bugs by splitting checks and side effects across external services, queues, AI tools, or separate requests.
|
|
123
|
+
|
|
124
|
+
## Attacker-Controlled Sources
|
|
125
|
+
|
|
126
|
+
Investigate these as user controlled:
|
|
127
|
+
|
|
128
|
+
- Route params (`params`) and search params from React Router.
|
|
129
|
+
- Form data read in actions (`await request.formData()`), JSON bodies, and `useFetcher` submissions.
|
|
130
|
+
- Raw `Request` body, headers, cookies, and URL.
|
|
131
|
+
- File names, file content, MIME types, and metadata.
|
|
132
|
+
- Database rows created or edited by users.
|
|
133
|
+
- AI chat messages, tool arguments, Agent outputs reused as commands/queries, and retrieval documents from users.
|
|
134
|
+
- MCP requests and generated tool arguments.
|
|
135
|
+
- Third-party API/webhook payloads unless authenticated and verified.
|
|
136
|
+
|
|
137
|
+
Usually server-controlled:
|
|
138
|
+
|
|
139
|
+
- Cloudflare bindings and env vars.
|
|
140
|
+
- `wrangler.jsonc`, `appConfig` in `app/db/schema.ts`, package metadata, hardcoded constants.
|
|
141
|
+
- Raybase signed sessions and core-owned auth state, unless app code parses unsigned cookies or headers directly.
|
|
142
|
+
|
|
143
|
+
Database content from other users is attacker-controlled when the current render/action consumes it. Stored XSS, prompt injection, CSV injection, log injection, and workflow tampering often flow through trusted-looking rows.
|
|
144
|
+
|
|
145
|
+
## Web And React Sinks
|
|
146
|
+
|
|
147
|
+
Do not flag JSX interpolation; React escapes it.
|
|
148
|
+
|
|
149
|
+
Investigate and report when attacker-controlled input reaches:
|
|
150
|
+
|
|
151
|
+
- `dangerouslySetInnerHTML`, `innerHTML`, `outerHTML`, `insertAdjacentHTML`, `document.write`.
|
|
152
|
+
- `href`, `src`, `window.location`, `window.open`, or redirects without scheme/host allowlisting.
|
|
153
|
+
- `eval`, `new Function`, string `setTimeout`/`setInterval`.
|
|
154
|
+
- `child_process.exec`, shell execution, dynamic imports, or code generation.
|
|
155
|
+
- `fetch(userUrl)` or HTTP clients using user-controlled URLs.
|
|
156
|
+
- File-system paths or R2 keys built from user input without normalization and authorization.
|
|
157
|
+
|
|
158
|
+
For rich text, require a sanitizer such as DOMPurify with a narrow allowlist before raw HTML rendering.
|
|
159
|
+
|
|
160
|
+
Also check DOM clobbering and prototype pollution in `modern-threats.md` when code merges parsed JSON, accepts arbitrary object keys, uses `Object.assign`/deep merge helpers, or queries DOM nodes by attacker-influenced names/ids.
|
|
161
|
+
|
|
162
|
+
## SSRF And External Calls
|
|
163
|
+
|
|
164
|
+
Server-side `fetch()` is risky only when attackers influence the URL, host, protocol, path in a sensitive target, redirects, or request headers. Load `ssrf.md` for any external fetch, URL preview, webhook callback, import, unfurl, or app integration.
|
|
165
|
+
|
|
166
|
+
For Raybase/Cloudflare apps, prefer fixed host allowlists. Block local, private, link-local, and metadata addresses; validate redirects; and do not forward user cookies, Raybase tokens, third-party provider tokens, or Cloudflare secrets to user-controlled destinations.
|
|
167
|
+
|
|
168
|
+
## AI, MCP, And Tooling
|
|
169
|
+
|
|
170
|
+
Do not report "prompt injection" by itself. Report when a prompt/tool path can cross a security boundary, such as:
|
|
171
|
+
|
|
172
|
+
- Reading records the user could not read through Raybase policies.
|
|
173
|
+
- Writing records or changing status without a policy check.
|
|
174
|
+
- Calling external URLs, shell commands, or webhooks from model-controlled text.
|
|
175
|
+
- Exposing secrets, env vars, auth cookies, tokens, or private retrieval documents.
|
|
176
|
+
- Letting generated MCP tools mutate/delete tables outside the spec.
|
|
177
|
+
|
|
178
|
+
AI output is attacker-controlled if it is influenced by user prompts or user-provided documents.
|
|
179
|
+
|
|
180
|
+
Load `modern-threats.md`, `authorization.md`, `data-protection.md`, and `logging.md` for AI/MCP changes. The issue is not "the prompt can be manipulated"; the issue is a model/tool path that can cross a policy, data, secret, logging, or side-effect boundary.
|
|
181
|
+
|
|
182
|
+
## Secrets, Logs, And Exports
|
|
183
|
+
|
|
184
|
+
Load `data-protection.md`, `logging.md`, and `cryptography.md` when code touches env vars, tokens, audit logs, backup/export flows, generated files, CSVs, emails, notifications, or error responses.
|
|
185
|
+
|
|
186
|
+
Report if app code exposes secrets to the client bundle, logs credentials or tokens, returns stack traces or raw SQL errors to users, exports fields outside the user's policy scope, uses predictable one-time tokens, or stores sensitive app data without a business need.
|
|
187
|
+
|
|
188
|
+
Do not require custom app crypto for ordinary Raybase rows. Prefer Cloudflare/Raybase platform protections and app-level minimization unless the spec introduces regulated secrets, credentials, or external tokens.
|
|
189
|
+
|
|
190
|
+
## Supply Chain And Configuration
|
|
191
|
+
|
|
192
|
+
Load `supply-chain.md` and `misconfiguration.md` when dependencies, package scripts, lockfiles, `.npmrc`, CI, `wrangler.jsonc`, CSP, CORS, cookies, or dev-only routes change.
|
|
193
|
+
|
|
194
|
+
Report only high-confidence issues: committed registry credentials, package scripts that exfiltrate secrets, broad CORS with credentials on private APIs, debug/dev bypasses reachable in production, or security headers/CSP changes that make a demonstrated XSS path exploitable.
|
|
195
|
+
|
|
196
|
+
## Useful Searches
|
|
197
|
+
|
|
198
|
+
Run targeted searches, then trace data flow before reporting:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
rg -n "export (async )?function (loader|action)|export const (loader|action)|currentUser\(|redirect\(" app/routes
|
|
202
|
+
rg -n "isRaybaseRequest|raybasePathPrefixes|handleRaybaseRequest|isDisabledRaybaseAdminRequest|withRaybaseLocalDevChrome|createRequestHandler" app workers
|
|
203
|
+
rg -n "unsafeDb|systemTableExecutor|adminOverride|RAYBASE_DEV_MODE|env\.AI\.run|RAYBASE_FILES\s*(\?\.|\.)\s*(get|put|delete|list)|CREATE TABLE|ALTER TABLE|DROP TABLE" app workers wrangler.jsonc package.json
|
|
204
|
+
rg -n "dangerouslySetInnerHTML|innerHTML|outerHTML|insertAdjacentHTML|document\.write|eval\(|new Function\(|window\.location|window\.open|fetch\(" app workers
|
|
205
|
+
rg -n "publicRoutes|auth\.publicRoutes|signupMode|externalProviders|allowedActionOrigins|Origin|Referer|cookie" app workers react-router.config.ts
|
|
206
|
+
rg -n "exec\(|execSync\(|spawn\(|shell:\s*true" app workers
|
|
207
|
+
rg -n "generatedTools|defineAction|defineActions|tools:|agents|retrieval|mcp" app
|
|
208
|
+
rg -n "Object\.assign|merge\(|\.merge\(|__proto__|constructor\]|prototype\]|JSON\.parse|yaml|serialize|deserialize" app workers
|
|
209
|
+
rg -n "console\.|logger|log\(|audit|backup|export|token|secret|password|private_key|api[_-]?key" app workers wrangler.jsonc package.json
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Reportable Examples
|
|
213
|
+
|
|
214
|
+
- A loader under `app/routes/` returns a project list without calling `currentUser()`, so a signed-out visitor can read it.
|
|
215
|
+
- An action updates a row by the `id` in the form data after checking only that someone is signed in, when the spec says only the creator or a manager may change it.
|
|
216
|
+
- `raybasePathPrefixes` loses `/api`, and an app resource route at `api.$.ts` answers in Raybase's place.
|
|
217
|
+
- A loader calls Raybase's data API with a service context and returns every member's rows to whoever is signed in.
|
|
218
|
+
- An action forwards a POST to `/api/actions/...` with `Origin` set from `request.url`, so Raybase's CSRF check passes for a request the browser never made same-origin.
|
|
219
|
+
- A loader performs a write, so a link or prefetch triggers it.
|
|
220
|
+
- `redirect(url.searchParams.get("next"))` sends a signed-in user to an arbitrary origin.
|
|
221
|
+
- A user-editable note is rendered with `dangerouslySetInnerHTML` without sanitization.
|
|
222
|
+
- A file download route uses `env.RAYBASE_FILES.get(keyFromSearchParam)` directly and returns the object.
|
|
223
|
+
- An AI action sends model-generated URLs to `fetch` or model-generated shell text to a command runner.
|
|
224
|
+
|
|
225
|
+
## Non-Findings
|
|
226
|
+
|
|
227
|
+
- Authenticated-only app pages in an invite-only internal app.
|
|
228
|
+
- Core-owned public signup routes in an app whose approved `dev/SPEC.md` and
|
|
229
|
+
config agree on `Signup mode: public self-signup` / `"public"` or `Signup
|
|
230
|
+
mode: provider-only self-signup` / `"provider-only"`.
|
|
231
|
+
- Raybase-owned paths that `workers/app.ts` hands unchanged to `handleRaybaseRequest`.
|
|
232
|
+
- The starter's `/docs` and `/docs/api/search` routes serving documentation without sign-in when `dev/SPEC.md` says `Docs exposure: public`.
|
|
233
|
+
- User text rendered as normal React children.
|
|
234
|
+
- Loaders and actions that check `currentUser()`, validate input, and reach data through Raybase's API or actions so policies apply.
|
|
235
|
+
- Missing security headers, verbose local-only errors, or dependency freshness unless the user requested hardening notes.
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# Server-Side Request Forgery (SSRF) Prevention Reference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
SSRF vulnerabilities allow attackers to induce the server-side application to make HTTP requests to an arbitrary domain of the attacker's choosing. This can be used to:
|
|
6
|
+
|
|
7
|
+
- Access internal services not exposed to the internet
|
|
8
|
+
- Read cloud metadata (AWS, GCP, Azure credentials)
|
|
9
|
+
- Scan internal networks
|
|
10
|
+
- Bypass firewalls and access controls
|
|
11
|
+
- Exploit internal services with known vulnerabilities
|
|
12
|
+
|
|
13
|
+
## Attack Scenarios
|
|
14
|
+
|
|
15
|
+
### Cloud Metadata Access (AWS)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Attacker provides URL:
|
|
19
|
+
http://169.254.169.254/latest/meta-data/iam/security-credentials/role-name
|
|
20
|
+
|
|
21
|
+
# Server fetches and returns AWS credentials:
|
|
22
|
+
{
|
|
23
|
+
"AccessKeyId": "ASIA...",
|
|
24
|
+
"SecretAccessKey": "...",
|
|
25
|
+
"Token": "..."
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Internal Service Access
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Attacker provides URL:
|
|
33
|
+
http://localhost:8080/admin/delete-all
|
|
34
|
+
http://internal-service.local/sensitive-data
|
|
35
|
+
|
|
36
|
+
# Server makes request to internal service that trusts localhost
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Port Scanning
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Attacker probes internal network:
|
|
43
|
+
http://192.168.1.1:22 # SSH
|
|
44
|
+
http://192.168.1.1:3306 # MySQL
|
|
45
|
+
http://192.168.1.1:6379 # Redis
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Prevention Strategies
|
|
51
|
+
|
|
52
|
+
### 1. Input Validation (Allowlist)
|
|
53
|
+
|
|
54
|
+
**Preferred when target hosts are known.**
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
# VULNERABLE: No validation
|
|
58
|
+
def fetch_url(url):
|
|
59
|
+
return requests.get(url).content
|
|
60
|
+
|
|
61
|
+
# SAFE: Allowlist of permitted domains
|
|
62
|
+
ALLOWED_DOMAINS = {'api.example.com', 'cdn.example.com'}
|
|
63
|
+
|
|
64
|
+
def fetch_url(url):
|
|
65
|
+
parsed = urlparse(url)
|
|
66
|
+
|
|
67
|
+
# Validate scheme
|
|
68
|
+
if parsed.scheme not in ('http', 'https'):
|
|
69
|
+
raise ValueError("Invalid URL scheme")
|
|
70
|
+
|
|
71
|
+
# Validate domain against allowlist
|
|
72
|
+
if parsed.hostname not in ALLOWED_DOMAINS:
|
|
73
|
+
raise ValueError("Domain not allowed")
|
|
74
|
+
|
|
75
|
+
return requests.get(url).content
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. Block Internal Networks (Denylist)
|
|
79
|
+
|
|
80
|
+
**Additional defense layer when allowlist isn't practical.**
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import ipaddress
|
|
84
|
+
import socket
|
|
85
|
+
|
|
86
|
+
BLOCKED_RANGES = [
|
|
87
|
+
ipaddress.ip_network('127.0.0.0/8'), # Loopback
|
|
88
|
+
ipaddress.ip_network('10.0.0.0/8'), # Private
|
|
89
|
+
ipaddress.ip_network('172.16.0.0/12'), # Private
|
|
90
|
+
ipaddress.ip_network('192.168.0.0/16'), # Private
|
|
91
|
+
ipaddress.ip_network('169.254.0.0/16'), # Link-local (metadata)
|
|
92
|
+
ipaddress.ip_network('0.0.0.0/8'), # Current network
|
|
93
|
+
ipaddress.ip_network('100.64.0.0/10'), # Shared address space
|
|
94
|
+
ipaddress.ip_network('192.0.0.0/24'), # IETF Protocol
|
|
95
|
+
ipaddress.ip_network('192.0.2.0/24'), # Documentation
|
|
96
|
+
ipaddress.ip_network('198.51.100.0/24'), # Documentation
|
|
97
|
+
ipaddress.ip_network('203.0.113.0/24'), # Documentation
|
|
98
|
+
ipaddress.ip_network('224.0.0.0/4'), # Multicast
|
|
99
|
+
ipaddress.ip_network('240.0.0.0/4'), # Reserved
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
def is_internal_ip(ip_str):
|
|
103
|
+
try:
|
|
104
|
+
ip = ipaddress.ip_address(ip_str)
|
|
105
|
+
return any(ip in network for network in BLOCKED_RANGES)
|
|
106
|
+
except ValueError:
|
|
107
|
+
return True # Invalid IP, block it
|
|
108
|
+
|
|
109
|
+
def validate_url(url):
|
|
110
|
+
parsed = urlparse(url)
|
|
111
|
+
|
|
112
|
+
# Validate scheme
|
|
113
|
+
if parsed.scheme not in ('http', 'https'):
|
|
114
|
+
raise ValueError("Invalid URL scheme")
|
|
115
|
+
|
|
116
|
+
# Resolve hostname to IP
|
|
117
|
+
hostname = parsed.hostname
|
|
118
|
+
if not hostname:
|
|
119
|
+
raise ValueError("Invalid URL")
|
|
120
|
+
|
|
121
|
+
# Check for IP address directly in URL
|
|
122
|
+
try:
|
|
123
|
+
ip = ipaddress.ip_address(hostname)
|
|
124
|
+
if is_internal_ip(str(ip)):
|
|
125
|
+
raise ValueError("Internal IP addresses not allowed")
|
|
126
|
+
except ValueError:
|
|
127
|
+
# It's a hostname, resolve it
|
|
128
|
+
try:
|
|
129
|
+
ip = socket.gethostbyname(hostname)
|
|
130
|
+
if is_internal_ip(ip):
|
|
131
|
+
raise ValueError("Domain resolves to internal IP")
|
|
132
|
+
except socket.gaierror:
|
|
133
|
+
raise ValueError("Could not resolve hostname")
|
|
134
|
+
|
|
135
|
+
return True
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 3. Disable Redirects
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
# VULNERABLE: Follows redirects (can bypass IP checks)
|
|
142
|
+
response = requests.get(url, allow_redirects=True)
|
|
143
|
+
# Attacker: http://attacker.com/redirect -> http://169.254.169.254/
|
|
144
|
+
|
|
145
|
+
# SAFE: Don't follow redirects automatically
|
|
146
|
+
response = requests.get(url, allow_redirects=False)
|
|
147
|
+
|
|
148
|
+
# If redirects needed, validate each location
|
|
149
|
+
def safe_fetch(url, max_redirects=5):
|
|
150
|
+
for _ in range(max_redirects):
|
|
151
|
+
validate_url(url) # Validate before each request
|
|
152
|
+
response = requests.get(url, allow_redirects=False)
|
|
153
|
+
|
|
154
|
+
if response.status_code in (301, 302, 303, 307, 308):
|
|
155
|
+
url = response.headers.get('Location')
|
|
156
|
+
if not url:
|
|
157
|
+
raise ValueError("Redirect without Location")
|
|
158
|
+
continue
|
|
159
|
+
|
|
160
|
+
return response
|
|
161
|
+
|
|
162
|
+
raise ValueError("Too many redirects")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 4. DNS Rebinding Protection
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
import socket
|
|
169
|
+
import time
|
|
170
|
+
|
|
171
|
+
def safe_fetch_with_dns_pinning(url):
|
|
172
|
+
parsed = urlparse(url)
|
|
173
|
+
hostname = parsed.hostname
|
|
174
|
+
|
|
175
|
+
# Resolve DNS and pin the IP
|
|
176
|
+
ip = socket.gethostbyname(hostname)
|
|
177
|
+
|
|
178
|
+
# Validate IP is not internal
|
|
179
|
+
if is_internal_ip(ip):
|
|
180
|
+
raise ValueError("Internal IP not allowed")
|
|
181
|
+
|
|
182
|
+
# Make request directly to IP with Host header
|
|
183
|
+
# This prevents DNS rebinding attacks
|
|
184
|
+
modified_url = url.replace(hostname, ip)
|
|
185
|
+
headers = {'Host': hostname}
|
|
186
|
+
|
|
187
|
+
response = requests.get(
|
|
188
|
+
modified_url,
|
|
189
|
+
headers=headers,
|
|
190
|
+
allow_redirects=False,
|
|
191
|
+
verify=True # Still verify TLS with original hostname
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
return response
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 5. Cloud Metadata Protection
|
|
198
|
+
|
|
199
|
+
#### AWS IMDSv2
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Require IMDSv2 (token-based) - mitigates SSRF
|
|
203
|
+
aws ec2 modify-instance-metadata-options \
|
|
204
|
+
--instance-id i-1234567890abcdef0 \
|
|
205
|
+
--http-tokens required \
|
|
206
|
+
--http-endpoint enabled
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
# With IMDSv2, attacker would need two requests:
|
|
211
|
+
# 1. PUT to get token (SSRF usually only does GET)
|
|
212
|
+
# 2. GET with token in header
|
|
213
|
+
|
|
214
|
+
# Block metadata IP regardless
|
|
215
|
+
if '169.254.169.254' in url or '169.254.170.2' in url:
|
|
216
|
+
raise ValueError("Metadata endpoints not allowed")
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### GCP
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
# Block GCP metadata
|
|
223
|
+
BLOCKED_HOSTS = [
|
|
224
|
+
'metadata.google.internal',
|
|
225
|
+
'metadata.google.com',
|
|
226
|
+
'169.254.169.254'
|
|
227
|
+
]
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
#### Azure
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
# Block Azure metadata
|
|
234
|
+
BLOCKED_HOSTS = [
|
|
235
|
+
'169.254.169.254',
|
|
236
|
+
'management.azure.com'
|
|
237
|
+
]
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Framework-Specific Mitigations
|
|
243
|
+
|
|
244
|
+
### Python (requests)
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
from urllib.parse import urlparse
|
|
248
|
+
import requests
|
|
249
|
+
|
|
250
|
+
class SafeRequests:
|
|
251
|
+
@staticmethod
|
|
252
|
+
def get(url, **kwargs):
|
|
253
|
+
validate_url(url)
|
|
254
|
+
kwargs['allow_redirects'] = False
|
|
255
|
+
kwargs['timeout'] = (5, 30) # Connect and read timeout
|
|
256
|
+
return requests.get(url, **kwargs)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Node.js
|
|
260
|
+
|
|
261
|
+
```javascript
|
|
262
|
+
const dns = require('dns').promises;
|
|
263
|
+
|
|
264
|
+
async function safeFetch(targetUrl) {
|
|
265
|
+
const parsed = new URL(targetUrl);
|
|
266
|
+
|
|
267
|
+
// Validate scheme
|
|
268
|
+
if (!['http:', 'https:'].includes(parsed.protocol)) {
|
|
269
|
+
throw new Error('Invalid scheme');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Resolve and check IP
|
|
273
|
+
const addresses = await dns.lookup(parsed.hostname);
|
|
274
|
+
if (isInternalIP(addresses.address)) {
|
|
275
|
+
throw new Error('Internal IP not allowed');
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return fetch(targetUrl, {
|
|
279
|
+
redirect: 'error',
|
|
280
|
+
signal: AbortSignal.timeout(30000)
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Java
|
|
286
|
+
|
|
287
|
+
```java
|
|
288
|
+
public class SafeURLConnection {
|
|
289
|
+
private static final Set<String> ALLOWED_PROTOCOLS = Set.of("http", "https");
|
|
290
|
+
|
|
291
|
+
public static URLConnection openConnection(String urlString) throws IOException {
|
|
292
|
+
URL url = new URL(urlString);
|
|
293
|
+
|
|
294
|
+
if (!ALLOWED_PROTOCOLS.contains(url.getProtocol())) {
|
|
295
|
+
throw new SecurityException("Protocol not allowed");
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
InetAddress address = InetAddress.getByName(url.getHost());
|
|
299
|
+
if (isInternalIP(address)) {
|
|
300
|
+
throw new SecurityException("Internal IP not allowed");
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
304
|
+
connection.setInstanceFollowRedirects(false);
|
|
305
|
+
connection.setConnectTimeout(5000);
|
|
306
|
+
connection.setReadTimeout(30000);
|
|
307
|
+
|
|
308
|
+
return connection;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Common Bypass Techniques to Block
|
|
316
|
+
|
|
317
|
+
### URL Encoding
|
|
318
|
+
|
|
319
|
+
```python
|
|
320
|
+
# Bypasses:
|
|
321
|
+
http://169.254.169.254/ # Normal
|
|
322
|
+
http://169%2e254%2e169%2e254/ # URL encoded dots
|
|
323
|
+
http://0251.0376.0251.0376/ # Octal
|
|
324
|
+
http://0xa9fea9fe/ # Hex
|
|
325
|
+
http://2852039166/ # Decimal
|
|
326
|
+
|
|
327
|
+
# Defense: Normalize and decode URL before validation
|
|
328
|
+
from urllib.parse import unquote
|
|
329
|
+
|
|
330
|
+
def normalize_url(url):
|
|
331
|
+
return unquote(url)
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### DNS Rebinding
|
|
335
|
+
|
|
336
|
+
```python
|
|
337
|
+
# Attack: Domain initially resolves to public IP, then internal IP
|
|
338
|
+
# First request: attacker.com -> 1.2.3.4 (passes validation)
|
|
339
|
+
# DNS changes: attacker.com -> 192.168.1.1
|
|
340
|
+
# Second request goes to internal IP
|
|
341
|
+
|
|
342
|
+
# Defense: Pin DNS resolution and re-validate
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### IPv6
|
|
346
|
+
|
|
347
|
+
```python
|
|
348
|
+
# Bypasses:
|
|
349
|
+
http://[::1]/ # localhost
|
|
350
|
+
http://[::ffff:127.0.0.1]/ # IPv4-mapped IPv6
|
|
351
|
+
http://[0:0:0:0:0:ffff:169.254.169.254]/
|
|
352
|
+
|
|
353
|
+
# Defense: Check both IPv4 and IPv6 ranges
|
|
354
|
+
BLOCKED_RANGES.extend([
|
|
355
|
+
ipaddress.ip_network('::1/128'), # IPv6 loopback
|
|
356
|
+
ipaddress.ip_network('fc00::/7'), # IPv6 private
|
|
357
|
+
ipaddress.ip_network('fe80::/10'), # IPv6 link-local
|
|
358
|
+
])
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Alternate Representations
|
|
362
|
+
|
|
363
|
+
```python
|
|
364
|
+
# localhost alternatives:
|
|
365
|
+
localhost
|
|
366
|
+
127.0.0.1
|
|
367
|
+
127.0.0.2 # Any 127.x.x.x is loopback
|
|
368
|
+
2130706433 # Decimal for 127.0.0.1
|
|
369
|
+
0x7f000001 # Hex
|
|
370
|
+
0177.0.0.1 # Octal
|
|
371
|
+
127.1 # Short form
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Grep Patterns for Detection
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# URL fetching functions
|
|
380
|
+
grep -rn "requests\.get\|requests\.post\|urllib\.request\|urlopen\|fetch\|axios" --include="*.py" --include="*.js"
|
|
381
|
+
|
|
382
|
+
# URL from user input
|
|
383
|
+
grep -rn "request\.args\|request\.form\|request\.json\|req\.query\|req\.body" --include="*.py" --include="*.js" | grep -i "url"
|
|
384
|
+
|
|
385
|
+
# Potential SSRF sinks
|
|
386
|
+
grep -rn "curl_exec\|file_get_contents\|fopen\|readfile" --include="*.php"
|
|
387
|
+
|
|
388
|
+
# Missing validation
|
|
389
|
+
grep -rn "requests\.get(url\|fetch(url" --include="*.py" --include="*.js"
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## Testing Checklist
|
|
395
|
+
|
|
396
|
+
- [ ] User-controlled URLs validated against allowlist
|
|
397
|
+
- [ ] Internal IP ranges blocked (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16)
|
|
398
|
+
- [ ] Cloud metadata IPs blocked (169.254.169.254)
|
|
399
|
+
- [ ] IPv6 internal addresses blocked
|
|
400
|
+
- [ ] URL redirects not followed blindly
|
|
401
|
+
- [ ] DNS rebinding protected against
|
|
402
|
+
- [ ] URL encoding/alternate representations handled
|
|
403
|
+
- [ ] IMDSv2 required (AWS environments)
|
|
404
|
+
- [ ] Timeouts configured to prevent DoS
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## References
|
|
409
|
+
|
|
410
|
+
- [OWASP SSRF Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)
|
|
411
|
+
- [CWE-918: Server-Side Request Forgery](https://cwe.mitre.org/data/definitions/918.html)
|
|
412
|
+
- [AWS IMDSv2 Documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html)
|
|
413
|
+
- [PortSwigger SSRF Guide](https://portswigger.net/web-security/ssrf)
|