Skip to content

Commit

Permalink
1.add enableVaultInScripts settings to allow using vault in script
Browse files Browse the repository at this point in the history
2.fix editor bug
  • Loading branch information
cwangsmv committed Jan 7, 2025
1 parent bfb3d55 commit 40dffb4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/insomnia/src/common/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,5 @@ export interface Settings {
// vault related settings
saveVaultKeyToOSSecretManager: boolean;
vaultSecretCacheDuration: number;
enableVaultInScripts: boolean;
}
1 change: 1 addition & 0 deletions packages/insomnia/src/models/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function init(): BaseSettings {
validateSSL: true,
vaultSecretCacheDuration: 30,
saveVaultKeyToOSSecretManager: true,
enableVaultInScripts: false,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ export const EnvironmentKVEditor = ({ data, onChange, vaultKey = '', isPrivate =
}
},
});
} else if (newType === EnvironmentKvPairDataType.SECRET) {
// encrypt value if set to secret type
handleItemChange(id, 'value', encryptSecretValue(originValue, symmetricKey));
handleItemChange(id, 'type', newType);
} else {
handleItemChange(id, 'type', newType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ export const VaultKeyPanel = () => {
setting="saveVaultKeyToOSSecretManager"
/>
</div>
<div className="form-row pad-top-sm">
<BooleanSetting
label="Enable vault in scripts"
help="Allow pre-request and after-response script to access vault secrets."
setting='enableVaultInScripts'
/>
</div>
</>
}
{/* User has not input vault key after re-login */}
Expand Down

0 comments on commit 40dffb4

Please sign in to comment.