Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dockerfile_lint

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dockerfile_lint - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

2

lib/linter.js

@@ -27,3 +27,3 @@ 'use strict';

if (command.error) {
helper. or(result, command.lineno, command.raw, command.error,null);
helper.addError(result, command.lineno, command.raw, command.error,null);
}

@@ -30,0 +30,0 @@ var rules = context.rules;

@@ -127,2 +127,51 @@ // parser.js

// Parse the HEALTHCHECK command.
// https://docs.docker.com/engine/reference/builder/#/healthcheck
function parseHealthcheck(cmd) {
var words = parseWords(cmd.rest),
cmdDirectiveIndex = words.indexOf("CMD"),
noneDirectiveIndex = words.indexOf("NONE");
if (cmdDirectiveIndex === -1 && noneDirectiveIndex === -1) {
cmd.error = 'A HEALTHCHECK instruction must specify either NONE, or a valid CMD and options';
return false;
} else if (cmdDirectiveIndex !== -1) {
// Reject a CMD directive that doesn't preceed an actual command.
if (cmdDirectiveIndex === words.length - 1) {
cmd.error = 'A CMD directive must specify a command for the healthcheck to run';
return false;
}
cmd.args = { command: words.slice(cmdDirectiveIndex + 1).join(" ") };
if (cmdDirectiveIndex > 0) {
// There are options specified, so let's verify they're valid.
var cmdDirectiveOptions = words.slice(0, cmdDirectiveIndex),
validCmdOptions = ["interval", "retries", "timeout"];
for (var i = 0; i < cmdDirectiveOptions.length; i++) {
var match = /--(\w+)=(\d+)/.exec(cmdDirectiveOptions[i]);
if (!match) {
cmd.error = '"' + cmdDirectiveOptions[i] + '" isn\'t a syntactically valid CMD option';
return false;
} else if (validCmdOptions.indexOf(match[1]) === -1) {
cmd.error = '"' + match[1] + '" isn\'t a valid CMD option';
return false;
}
cmd.args[match[1]] = match[2];
}
}
} else if (noneDirectiveIndex !== -1) {
if (words.length > 1) {
cmd.error = 'The NONE directive doesn\'t support additional options';
return false;
}
cmd.args = { isNone: true };
}
return true;
}
// Parse environment like statements. Note that this does *not* handle

@@ -275,2 +324,3 @@ // variable interpolation, which will be handled in the evaluator.

'FROM': parseString,
'HEALTHCHECK': parseHealthcheck,
'LABEL': parseLabel,

@@ -280,2 +330,3 @@ 'MAINTAINER': parseString,

'RUN': parseJsonOrString,
'SHELL': parseJsonOrString,
'STOPSIGNAL': parseString,

@@ -353,3 +404,4 @@ 'USER': parseString,

// Invalid Dockerfile instruction, but allow it and move on.
// log.debug('Invalid Dockerfile command:', command.name);
console.log('Invalid Dockerfile command:', command.name);
command.error = 'Invalid Command';
commandParserFn = parseString;

@@ -356,0 +408,0 @@ }

{
"name": "dockerfile_lint",
"version": "0.2.4",
"version": "0.2.5",
"description": "Utility for linting a docker file against accepted good practices",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -28,3 +28,5 @@ {

"ARG",
"STOPSIGNAL"
"STOPSIGNAL",
"HEALTHCHECK",
"SHELL"
],

@@ -66,2 +68,6 @@ "ignore_regex": "/^#/",

},
"HEALTHCHECK": {
"paramSyntaxRegex": "/.+/",
"rules": []
},
"MAINTAINER": {

@@ -75,2 +81,6 @@ "paramSyntaxRegex": "/.+/",

},
"SHELL": {
"paramSyntaxRegex": "/.+/",
"rules": []
},
"CMD": {

@@ -77,0 +87,0 @@ "paramSyntaxRegex": "/.+/",

@@ -28,3 +28,5 @@ {

"ARG",
"STOPSIGNAL"
"STOPSIGNAL",
"HEALTHCHECK",
"SHELL"
],

@@ -77,2 +79,6 @@ "ignore_regex": "/^#/",

},
"HEALTHCHECK": {
"paramSyntaxRegex": "/.+/",
"rules": []
},
"MAINTAINER": {

@@ -103,2 +109,6 @@ "paramSyntaxRegex": "/.+/",

},
"SHELL": {
"paramSyntaxRegex": "/.+/",
"rules": []
},
"CMD": {

@@ -174,2 +184,2 @@ "paramSyntaxRegex": "/.+/",

"mutually_exclusive_instructions": []
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc