escape and quote the robotsTxt when templating

for now, we restrict the string length to 4096 since that is what
nginx allows
This commit is contained in:
Girish Ramakrishnan
2017-07-23 18:55:31 -07:00
parent 4fec2fe124
commit eb99f8b844
4 changed files with 10 additions and 7 deletions

View File

@@ -246,7 +246,10 @@ function validateDebugMode(debugMode) {
function validateRobotsTxt(robotsTxt) {
if (robotsTxt === null) return null;
// TODO: validate the robots file?
// this is the nginx limit on inline strings. if we really hit this, we have to generate a file
if (robotsTxt.length > 4096) return new AppsError(AppsError.BAD_FIELD, 'robotsTxt must be less than 4096');
// TODO: validate the robots file? we escape the string when templating the nginx config right now
return null;
}