From d85adb94676610ebf95ef912ef859adebeace686 Mon Sep 17 00:00:00 2001 From: Thad Kerosky Date: Fri, 1 Dec 2023 02:48:31 -0500 Subject: [PATCH 1/3] epic v2.3: NEW .env.example; csrf security --- .github/workflows/heat-stack.yml | 8 +- .gitignore | 5 + .vscode/extensions.json | 11 + heat-stack/.env.example | 1 + heat-stack/app/components/confetti.tsx | 21 - heat-stack/app/components/error-boundary.tsx | 4 +- heat-stack/app/components/forms.tsx | 4 +- heat-stack/app/components/progress-bar.tsx | 63 + heat-stack/app/components/search-bar.tsx | 6 +- heat-stack/app/components/spinner.tsx | 1 + heat-stack/app/components/ui/button.tsx | 6 +- heat-stack/app/entry.server.tsx | 14 + heat-stack/app/root.tsx | 13 +- heat-stack/app/root_original.tsx | 12 +- heat-stack/app/root_original_v2.3.tsx | 451 + .../_auth+/auth.$provider.callback.test.ts | 10 +- .../app/routes/_auth+/forgot-password.tsx | 10 +- heat-stack/app/routes/_auth+/login.tsx | 51 +- heat-stack/app/routes/_auth+/onboarding.tsx | 77 +- .../routes/_auth+/onboarding_.$provider.tsx | 24 +- .../app/routes/_auth+/reset-password.tsx | 20 +- heat-stack/app/routes/_auth+/signup.tsx | 29 +- heat-stack/app/routes/_auth+/verify.tsx | 88 +- .../app/routes/_marketing+/logos/docker.png | Bin 90758 -> 0 bytes .../app/routes/_marketing+/logos/docker.svg | 47 + .../app/routes/_marketing+/logos/logos.ts | 4 +- .../app/routes/_marketing+/logos/remix.png | Bin 204228 -> 0 bytes .../app/routes/_marketing+/logos/remix.svg | 25 + heat-stack/app/routes/_seo+/robots[.]txt.ts | 9 + heat-stack/app/routes/_seo+/sitemap[.]xml.ts | 14 + heat-stack/app/routes/admin+/cache.tsx | 7 +- heat-stack/app/routes/me.tsx | 4 +- .../app/routes/resources+/healthcheck.tsx | 27 +- .../routes/settings+/profile.change-email.tsx | 11 +- .../routes/settings+/profile.connections.tsx | 109 +- .../app/routes/settings+/profile.index.tsx | 30 +- heat-stack/index.js | 17 +- heat-stack/package-lock.json | 7651 ++++++++++------- heat-stack/package.json | 146 +- heat-stack/vitest.config.ts | 1 - 40 files changed, 5480 insertions(+), 3551 deletions(-) create mode 100644 .vscode/extensions.json delete mode 100644 heat-stack/app/components/confetti.tsx create mode 100644 heat-stack/app/components/progress-bar.tsx create mode 100644 heat-stack/app/root_original_v2.3.tsx delete mode 100644 heat-stack/app/routes/_marketing+/logos/docker.png create mode 100644 heat-stack/app/routes/_marketing+/logos/docker.svg delete mode 100644 heat-stack/app/routes/_marketing+/logos/remix.png create mode 100644 heat-stack/app/routes/_marketing+/logos/remix.svg create mode 100644 heat-stack/app/routes/_seo+/robots[.]txt.ts create mode 100644 heat-stack/app/routes/_seo+/sitemap[.]xml.ts diff --git a/.github/workflows/heat-stack.yml b/.github/workflows/heat-stack.yml index 140bfd2e..648b2112 100644 --- a/.github/workflows/heat-stack.yml +++ b/.github/workflows/heat-stack.yml @@ -24,7 +24,7 @@ permissions: jobs: lint: name: ⬣ ESLint - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: ⬇️ Checkout repo uses: actions/checkout@v3 @@ -50,7 +50,7 @@ jobs: typecheck: name: ʦ TypeScript - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: ⬇️ Checkout repo uses: actions/checkout@v3 @@ -73,7 +73,7 @@ jobs: vitest: name: ⚡ Vitest pyodide.test.ts - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: ⬇️ Checkout repo uses: actions/checkout@v3 @@ -100,7 +100,7 @@ jobs: # playwright tests work great but slight jank/inconsistency passing, and not used yet, so disabling for now # playwright: # name: 🎭 Playwright - # runs-on: ubuntu-latest + # runs-on: ubuntu-22.04 # timeout-minutes: 60 # steps: # - name: ⬇️ Checkout repo diff --git a/.gitignore b/.gitignore index 5e16b5c7..ee899313 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,8 @@ node_modules # Easy way to create temporary files/folders that won't accidentally be added to git *.local.* + +#local temporary folders +heat-app +venv +heat-tmp \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..7619ac2b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "bradlc.vscode-tailwindcss", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "prisma.prisma", + "qwtel.sqlite-viewer", + "yoavbls.pretty-ts-errors", + "github.vscode-github-actions" + ] +} diff --git a/heat-stack/.env.example b/heat-stack/.env.example index d117323c..46659864 100644 --- a/heat-stack/.env.example +++ b/heat-stack/.env.example @@ -3,6 +3,7 @@ DATABASE_PATH="./prisma/data.db" DATABASE_URL="file:./data.db?connection_limit=1" CACHE_DATABASE_PATH="./other/cache.db" SESSION_SECRET="super-duper-s3cret" +HONEYPOT_SECRET="super-duper-s3cret" INTERNAL_COMMAND_TOKEN="some-made-up-token" RESEND_API_KEY="re_blAh_blaHBlaHblahBLAhBlAh" SENTRY_DSN="your-dsn" diff --git a/heat-stack/app/components/confetti.tsx b/heat-stack/app/components/confetti.tsx deleted file mode 100644 index 69fbecef..00000000 --- a/heat-stack/app/components/confetti.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Index as ConfettiShower } from 'confetti-react' -import { ClientOnly } from 'remix-utils' - -export function Confetti({ id }: { id?: string | null }) { - if (!id) return null - - return ( - - {() => ( - - )} - - ) -} diff --git a/heat-stack/app/components/error-boundary.tsx b/heat-stack/app/components/error-boundary.tsx index 12175f31..80c1406b 100644 --- a/heat-stack/app/components/error-boundary.tsx +++ b/heat-stack/app/components/error-boundary.tsx @@ -1,9 +1,10 @@ import { + type ErrorResponse, isRouteErrorResponse, useParams, useRouteError, } from '@remix-run/react' -import { type ErrorResponse } from '@remix-run/router' +import { captureRemixErrorBoundaryError } from '@sentry/remix' import { getErrorMessage } from '#app/utils/misc.tsx' type StatusHandler = (info: { @@ -25,6 +26,7 @@ export function GeneralErrorBoundary({ unexpectedErrorHandler?: (error: unknown) => JSX.Element | null }) { const error = useRouteError() + captureRemixErrorBoundaryError(error) const params = useParams() if (typeof document !== 'undefined') { diff --git a/heat-stack/app/components/forms.tsx b/heat-stack/app/components/forms.tsx index 0d362fcb..ad2868ad 100644 --- a/heat-stack/app/components/forms.tsx +++ b/heat-stack/app/components/forms.tsx @@ -19,7 +19,7 @@ export function ErrorList({ return (