Skip to content

fix: remove dev admin seed and restrict media upload types - #4

Merged
kaladinlight merged 4 commits into
mainfrom
fix/remove-dev-admin-bootstrap
Nov 25, 2026
Merged

kaladinlight merged 4 commits into
mainfrom
fix/remove-dev-admin-bootstrap

Conversation

@kaladinlight

Copy link
Copy Markdown
Member

Description

  1. Remove the local dev admin seed. Bootstrap no longer creates an admin account in development mode. The README now explains how to create the first admin, either from the /admin registration page or with yarn strapi admin:create-user.
  2. Make yarn start always run in production mode. strapi start doesn't set NODE_ENV, and Strapi falls back to development when it's unset. The start script now sets NODE_ENV=production itself instead of relying on the deploy environment.
  3. Restrict media library uploads. The upload plugin's security config now accepts only PNG, JPEG, GIF, WebP, AVIF, MP4, WebM, QuickTime and PDF. SVG, HTML, XHTML, JavaScript, WebAssembly, XML and application/octet-stream are denied explicitly. Exact types are listed instead of image/* and video/* wildcards, because the wildcards also match SVG sent with parameters and types inferred only from the extension, such as .ts → video/mp2t.
  4. Ignore the generated .strapi/ folder in ESLint. yarn build creates .strapi/client, which is gitignored but was still being linted. yarn lint failed after any build.

Files already in the media library are not affected.

Risk

Low.

  • Editors: can no longer upload SVG or other file types outside the list above. If they need another format, add it to allowedTypes in config/plugins.ts.
  • Local setup: a fresh local database no longer has an admin account. Create one using the README steps.
  • Deploys: none expected, since the deploy start command is already yarn start.

Testing

Engineering

  • yarn lint and yarn build pass.
  • Upload validation was checked against @strapi/upload's validateFile using this config:
    • Accepted: PNG, JPEG and PDF.
    • Rejected:
      • an .svg with a script
      • .html, .js and .xml files
      • a file with no extension declared as application/octet-stream
      • an extensionless file declared as image/svg+xml; charset=utf-8
      • a .ts file containing HTML (video/mp2t)
  • On a fresh SQLite database, yarn develop creates no admin user, and yarn strapi admin:create-user creates one.

Operations

In the CMS admin, open Media Library → Add new assets:

  1. Upload a PNG or JPG image. Expected: the upload succeeds.
  2. Upload a PDF. Expected: the upload succeeds.
  3. Upload an .svg file. Expected: the upload is rejected with a "file type not allowed" error, and nothing is added to the library.

🤖 Generated with Claude Code

kaladinlight and others added 4 commits November 25, 2026 14:58
Drop the development-only admin seed from bootstrap. Document creating the first admin through the registration page or the strapi admin:create-user CLI instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
strapi start does not set NODE_ENV and Strapi falls back to development, so production mode depended on the deploy environment. Set it explicitly in the start script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The media library accepted any file type. Allow only common image, video and PDF types and deny SVG, HTML, JavaScript, WebAssembly, XML and octet-stream. Explicit types are used instead of image/* and video/* wildcards, which also match SVG with parameters and extension-only types such as video/mp2t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yarn build generates .strapi/client, which is gitignored but was linted, failing yarn lint after a build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaladinlight
kaladinlight merged commit ae76124 into main Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant