mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 11:10:11 +08:00
feat: execute files check via docker cli
WARNING: possible command injection vunerability.
This commit is contained in:
1 parent
38f3dbcd65
commit
50b1fe5124
4 files changed
+17
-53
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { exec } from 'child_process'
|
||||
|
||||
import { buildFileCheckCmd } from '@linux-odyssey/utils'
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function checkFiles(id, files) {
|
||||
return new Promise((resolve) => {
|
||||
const cmd = buildFileCheckCmd(files)
|
||||
// WARNING: This is not secure!
|
||||
exec(`docker exec ${id} ${cmd}`, (error, stdout, stderr) => {
|
||||
console.log('stdout', stdout)
|
||||
console.log('stderr', stderr)
|
||||
resolve(!error)
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user