All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.docker.rules.docker.S6573.html Maven / Gradle / Ivy

Filename and pathname should be prefixed to avoid missing filenames starting with a dash when globbing files as program option.

Why is this an issue?

Within the command, arguments and filenames as options are passed as strings. Programs may misinterpret files as arguments if the file name starts with a single or double dash. When filenames are specified using glob, files whose names begin with a dash are not included in the scope. For example, if a file is named "-f" and passed as an argument to a command such as "rm", it may be interpreted as a command line option instead of a file, causing unexpected behaviour. This issue affects all instructions processing shell commands.

How to fix it

To avoid this issue, using "./" before the file name will cause it to be interpreted as a file and not an option. Additionally, adding "--" at the end of command line arguments indicates the end of options and any subsequent arguments will be treated as file names. However, this fix should only be used if the command supports it as expected.

Code examples

Noncompliant code example

RUN rm *

Compliant solution

RUN rm ./*
RUN rm -- *

Resources





© 2015 - 2025 Weber Informatics LLC | Privacy Policy