-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harden express-processimage for use in production #4
Comments
👍 from here :) |
Actually, let's keep this open until all parameters are validated. |
What's the current status with respect to hardening this package for use in production environments? I don't see any instances where remote code execution is possible. It looks like all parameters are passed to other dependency functions rather than to command line tools. Is this correct? Is the statement "Parts of the query string will be passed directly to various command line tools." in the README still accurate? |
The current status is that a bunch of graphicsmagick operations and all parameters related to pngcrush, pngquant, jpegtran, optipng, svgfilter, and inkscape aren't validated: express-processimage/lib/getFilterInfosAndTargetContentTypeFromQueryString.js Lines 145 to 361 in cbd932d
... so all of those should be considered unsafe. However, I'm running it in production myself with a conservative whitelist of allowed operations configured via the const allowedOperations = [
'withoutEnlargement',
'progressive',
'ignoreAspectRatio',
'interpolateWith',
'metadata',
'resize',
'extract',
'crop',
'rotate',
'quality',
'format',
'png',
'jpeg',
'gm'
];
const app = require('express')().use(require('express-processimage')({
allowOperation: (name, args) => {
return allowedOperations.indexOf(name) !== -1;
}
})); Remember to specify |
inkscape
andsvgfilter
don't have to be exposed in cases where they aren't neededgm -limit Pixels <numberOfPixels>
.The text was updated successfully, but these errors were encountered: