Skip to content

Commit b4f8101

Browse files
committed
Merge branch 'release/7.43.0'
2 parents 90a805b + f21b654 commit b4f8101

File tree

7 files changed

+289
-20
lines changed

7 files changed

+289
-20
lines changed

CHANGELOG.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
7.43.0:
2+
date: 2024-10-30
3+
new features:
4+
- GH-1478 Added support for lazily fetching vault access status
5+
fixed bugs:
6+
- >-
7+
GH-1480 Fixed a bug where vault domain matching did not work with port in
8+
URL
9+
110
7.42.0:
211
date: 2024-09-04
312
new features:

lib/runner/extensions/event.command.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,12 @@ module.exports = {
243243
packageResolver = _.get(this, 'options.script.packageResolver'),
244244

245245
vaultSecrets = payload.context.vaultSecrets,
246-
allowVaultAccess = _.get(vaultSecrets, '_.allowScriptAccess'),
246+
// Do not assign any initial value here as it will be used
247+
// to determine if the vault access check was done or not
248+
hasVaultAccess,
247249

248250
events;
249251

250-
// Explicitly enable tracking for vault secrets here as this will
251-
// not be sent to sandbox who otherwise takes care of mutation tracking
252-
if (allowVaultAccess) {
253-
vaultSecrets.enableTracking({ autoCompact: true });
254-
}
255-
256252
// @todo: find a better place to code this so that event is not aware of such options
257253
if (abortOnFailure) {
258254
abortOnError = true;
@@ -398,19 +394,34 @@ module.exports = {
398394
}
399395
}.bind(this));
400396

401-
this.host.on(EXECUTION_VAULT_BASE + executionId, function (id, cmd, ...args) {
397+
this.host.on(EXECUTION_VAULT_BASE + executionId, async function (id, cmd, ...args) {
398+
if (hasVaultAccess === undefined) {
399+
try {
400+
// eslint-disable-next-line require-atomic-updates
401+
hasVaultAccess = Boolean(await vaultSecrets?._?.allowScriptAccess(item.id));
402+
}
403+
catch (_) {
404+
// eslint-disable-next-line require-atomic-updates
405+
hasVaultAccess = false;
406+
}
407+
}
408+
402409
// Ensure error is string
403410
// TODO identify why error objects are not being serialized correctly
404411
const dispatch = (e, r) => { this.host.dispatch(EXECUTION_VAULT_BASE + executionId, id, e, r); };
405412

406-
if (!allowVaultAccess) {
413+
if (!hasVaultAccess) {
407414
return dispatch('Vault access denied');
408415
}
409416

410417
if (!['get', 'set', 'unset'].includes(cmd)) {
411418
return dispatch(`Invalid vault command: ${cmd}`);
412419
}
413420

421+
// Explicitly enable tracking for vault secrets here as this will
422+
// not be sent to sandbox who otherwise takes care of mutation tracking
423+
vaultSecrets.enableTracking({ autoCompact: true });
424+
414425
dispatch(null, vaultSecrets[cmd](...args));
415426
}.bind(this));
416427

@@ -556,7 +567,7 @@ module.exports = {
556567
result && result.request && (result.request = new sdk.Request(result.request));
557568

558569
// vault secrets are not sent to sandbox, thus using the scope from run context.
559-
if (allowVaultAccess && vaultSecrets) {
570+
if (hasVaultAccess && vaultSecrets) {
560571
result.vaultSecrets = vaultSecrets;
561572

562573
// Prevent mutations from being carry-forwarded to subsequent events

lib/runner/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ module.exports = {
201201
const url = new Url(domain);
202202

203203
// @note URL path is ignored
204-
return `${url.protocol || 'https'}://${url.getRemote()}/*`;
204+
return `${url.protocol || 'https'}://${url.getRemote()}:*/*`;
205205
}));
206206
});
207207

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postman-runtime",
3-
"version": "7.42.0",
3+
"version": "7.43.0",
44
"description": "Underlying library of executing Postman Collections",
55
"author": "Postman Inc.",
66
"license": "Apache-2.0",

test/integration/sanity/variable-changes.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('variable changes', function () {
99
requester: { followRedirects: false },
1010
vaultSecrets: {
1111
id: 'vault',
12-
_allowScriptAccess: true,
12+
_allowScriptAccess: function () { return true; },
1313
values: [
1414
{ key: 'vault:key5', value: 'vault-value-5', enabled: true },
1515
{ key: 'vault:key6', value: 'vault-value-6', enabled: true }

0 commit comments

Comments
 (0)