mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-19 11:27:08 +00:00
feat(validate-cmd-file): add validation for read/execute rights
This commit is contained in:
parent
fd4ca43dc2
commit
8efb89b3b3
2 changed files with 20 additions and 9 deletions
|
|
@ -103,14 +103,25 @@ class Renovate {
|
|||
}
|
||||
|
||||
const configurationFile = this.input.configurationFile();
|
||||
if (
|
||||
configurationFile !== null &&
|
||||
(!fs.existsSync(configurationFile.value) ||
|
||||
!fs.statSync(configurationFile.value).isFile())
|
||||
) {
|
||||
throw new Error(
|
||||
`configuration file '${configurationFile.value}' MUST be an existing file`,
|
||||
);
|
||||
if (configurationFile !== null) {
|
||||
if (
|
||||
!fs.existsSync(configurationFile.value) ||
|
||||
!fs.statSync(configurationFile.value).isFile()
|
||||
) {
|
||||
throw new Error(
|
||||
`configuration file '${configurationFile.value}' MUST be an existing file`,
|
||||
);
|
||||
}
|
||||
try {
|
||||
fs.accessSync(
|
||||
configurationFile.value,
|
||||
fs.constants.S_IXUSR | fs.constants.S_IRUSR,
|
||||
);
|
||||
} catch {
|
||||
throw new Error(
|
||||
`configuration file '${configurationFile.value}' MUST have read and execute rights`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue