This commit is contained in:
Maarten Groeneweg 2026-02-02 15:28:23 +11:00 committed by GitHub
commit 08e5ab1613
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -125,7 +125,11 @@ export class Renovate {
if (/\s/.test(this.input.token.value)) {
throw new Error('Token MUST NOT contain whitespace');
}
await this.validateConfigFileArgument();
await this.validateDockerCmdFileArgument();
}
private async validateConfigFileArgument(): Promise<void> {
const configurationFile = this.input.configurationFile();
if (
configurationFile !== null &&
@ -136,4 +140,26 @@ export class Renovate {
);
}
}
private async validateDockerCmdFileArgument(): Promise<void> {
const dockerCmdFile = this.input.getDockerCmdFile();
if (dockerCmdFile === null) return;
try {
const s = await fs.stat(dockerCmdFile);
if (!s.isFile)
throw new Error(`dockerCmdFile '${dockerCmdFile}' MUST be a file`);
if (
(s.mode & fs.constants.R_OK) === 0 ||
(s.mode & fs.constants.X_OK) === 0
)
throw new Error(
`dockerCmdFile '${dockerCmdFile}' MUST have read and execute rights`,
);
} catch (err) {
if (err instanceof Error && 'code' in err && err.code === 'ENOENT')
throw new Error(`dockerCmdFile '${dockerCmdFile}' does not exist`);
throw new Error(err as string);
}
}
}