mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-20 20:16:26 +02:00
chown directories to root, ensuring they are not writable by runners
This commit is contained in:
parent
38ab15081e
commit
8b90c12c5c
3 changed files with 780 additions and 4 deletions
|
@ -9,6 +9,8 @@ const fss = require('fs');
|
|||
const cp = require('child_process');
|
||||
const crypto = require('crypto');
|
||||
const runtime = require('./runtime');
|
||||
const chownr = require('chownr');
|
||||
const util = require('util');
|
||||
|
||||
class Package {
|
||||
|
||||
|
@ -120,6 +122,9 @@ class Package {
|
|||
|
||||
await fs.write_file(path.join(this.install_path, '.env'), filtered_env);
|
||||
|
||||
logger.debug('Changing Ownership of package directory');
|
||||
await util.promisify(chownr)(this.install_path,0,0);
|
||||
|
||||
logger.debug('Writing installed state to disk');
|
||||
await fs.write_file(path.join(this.install_path, globals.pkg_installed_file), Date.now().toString());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue