restringir permisos cuando se hace alpine.writeFile

This commit is contained in:
Cat /dev/Nulo 2023-02-16 21:26:34 -03:00
parent a90539fcd7
commit b382e31374

View file

@ -37,13 +37,13 @@ export class Alpine {
content: string,
permissions?: { uid: number; gid: number }
): Promise<void> {
const p = path.join(this.dir, filePath);
await this.mkdirP(path.dirname(filePath));
await sudoWriteFile(path.join(this.dir, filePath), content);
if (permissions)
await sudoChown(
path.join(this.dir, filePath),
`${permissions.uid}:${permissions.gid}`
);
await sudoWriteFile(p, content);
if (permissions) {
await sudoChown(p, `${permissions.uid}:${permissions.gid}`);
await sudoChmod(p, "600");
}
}
async writeExecutable(filePath: string, content: string): Promise<void> {
await this.writeFile(filePath, content);