fix: 统一前端Harbor镜像发布与拉取部署
This commit is contained in:
@@ -4,12 +4,14 @@ import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import os from 'node:os'
|
||||
import { execFileSync } from 'node:child_process'
|
||||
import { frontendRoot, validTag, shellQuote, deploymentTarget, validateEntries, inspectPackage, bashExecutable } from './release.mjs'
|
||||
import { frontendRoot, frontendImage, validTag, shellQuote, deploymentTarget, validateEntries, inspectPackage, bashExecutable } from './release.mjs'
|
||||
import { installScript } from './deploy-test.mjs'
|
||||
|
||||
test('release and SSH inputs reject paths, options and shell injection', () => {
|
||||
for (const value of ['', '../release', '-latest', 'a;touch x', 'a\nother']) assert.throws(() => validTag(value))
|
||||
assert.equal(validTag('a846bd90-rc.1'), 'a846bd90-rc.1')
|
||||
assert.equal(frontendImage('a846bd90-rc.1'), 'harbor.fuhua91.com/game/sw2:a846bd90-rc.1')
|
||||
assert.throws(() => frontendImage('../other'))
|
||||
for (const args of [{ host: '-oProxyCommand=id' }, { user: 'root;id' }, { directory: '/' }, { directory: '/www/../etc' }, { port: '65536' }]) assert.throws(() => deploymentTarget(args))
|
||||
assert.equal(shellQuote("a'b$(id)"), "'a'\\''b$(id)'")
|
||||
assert.equal(deploymentTarget().base, '/www/wwwroot/sw2.fuhua91.com')
|
||||
|
||||
Reference in New Issue
Block a user