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, content: string,
permissions?: { uid: number; gid: number } permissions?: { uid: number; gid: number }
): Promise<void> { ): Promise<void> {
const p = path.join(this.dir, filePath);
await this.mkdirP(path.dirname(filePath)); await this.mkdirP(path.dirname(filePath));
await sudoWriteFile(path.join(this.dir, filePath), content); await sudoWriteFile(p, content);
if (permissions) if (permissions) {
await sudoChown( await sudoChown(p, `${permissions.uid}:${permissions.gid}`);
path.join(this.dir, filePath), await sudoChmod(p, "600");
`${permissions.uid}:${permissions.gid}` }
);
} }
async writeExecutable(filePath: string, content: string): Promise<void> { async writeExecutable(filePath: string, content: string): Promise<void> {
await this.writeFile(filePath, content); await this.writeFile(filePath, content);