Repository navigation
fix: remove dev admin seed and restrict media upload types - #4
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
/adminregistration page or withyarn strapi admin:create-user.yarn startalways run in production mode.strapi startdoesn't setNODE_ENV, and Strapi falls back todevelopmentwhen it's unset. The start script now setsNODE_ENV=productionitself instead of relying on the deploy environment.securityconfig now accepts only PNG, JPEG, GIF, WebP, AVIF, MP4, WebM, QuickTime and PDF. SVG, HTML, XHTML, JavaScript, WebAssembly, XML andapplication/octet-streamare denied explicitly. Exact types are listed instead ofimage/*andvideo/*wildcards, because the wildcards also match SVG sent with parameters and types inferred only from the extension, such as.ts→video/mp2t..strapi/folder in ESLint.yarn buildcreates.strapi/client, which is gitignored but was still being linted.yarn lintfailed after any build.Files already in the media library are not affected.
Risk
Low.
allowedTypesinconfig/plugins.ts.yarn start.Testing
Engineering
yarn lintandyarn buildpass.@strapi/upload'svalidateFileusing this config:.svgwith a script.html,.jsand.xmlfilesapplication/octet-streamimage/svg+xml; charset=utf-8.tsfile containing HTML (video/mp2t)yarn developcreates no admin user, andyarn strapi admin:create-usercreates one.Operations
In the CMS admin, open Media Library → Add new assets:
.svgfile. Expected: the upload is rejected with a "file type not allowed" error, and nothing is added to the library.🤖 Generated with Claude Code