app proxy: protect code accessing containerId
This commit is contained in:
@@ -1502,6 +1502,8 @@ async function setUpstreamUri(app, upstreamUri, auditSource) {
|
||||
assert.strictEqual(typeof upstreamUri, 'string');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
if (app.manifest.id !== constants.PROXY_APP_APPSTORE_ID) throw new BoxError(BoxError.BAD_FIELD, 'upstreamUri can only be set for proxy app');
|
||||
|
||||
const appId = app.id;
|
||||
const error = validateUpstreamUri(upstreamUri);
|
||||
if (error) throw error;
|
||||
@@ -2109,6 +2111,8 @@ async function getLogs(app, options) {
|
||||
assert.strictEqual(typeof options.format, 'string');
|
||||
assert.strictEqual(typeof options.follow, 'boolean');
|
||||
|
||||
if (app.manifest.id !== constants.PROXY_APP_APPSTORE_ID) throw new BoxError(BoxError.BAD_FIELD, 'upstreamUri can only be set for proxy app');
|
||||
|
||||
const appId = app.id;
|
||||
|
||||
const logPaths = await getLogPaths(app);
|
||||
@@ -2510,6 +2514,8 @@ async function createExec(app, options) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert(options && typeof options === 'object');
|
||||
|
||||
if (app.manifest.id !== constants.PROXY_APP_APPSTORE_ID) throw new BoxError(BoxError.BAD_FIELD, 'upstreamUri can only be set for proxy app');
|
||||
|
||||
const cmd = options.cmd || [ '/bin/bash' ];
|
||||
assert(Array.isArray(cmd) && cmd.length > 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user