reject env variables containing newlines when debugging (#2518)
This commit is contained in:
Родитель
a986b8edc7
Коммит
da57409f0e
|
@ -14,6 +14,7 @@ Bug Fixes:
|
|||
- Fix schema validation for presets version 4. [#2490](https://github.com/microsoft/vscode-cmake-tools/issues/2490)
|
||||
- Remove problematic environment variables from the debugger environment. [#2442](https://github.com/microsoft/vscode-cmake-tools/issues/2442)
|
||||
- Fix preferredGenerator "Watcom WMake" not working. [#2500](https://github.com/microsoft/vscode-cmake-tools/issues/2500)
|
||||
- Exclude environment variables from debugging if the values have newlines. [#2515](https://github.com/microsoft/vscode-cmake-tools/issues/2515)
|
||||
|
||||
## 1.10.5
|
||||
Bug Fixes:
|
||||
|
|
|
@ -376,7 +376,7 @@ export function makeDebuggerEnvironmentVars(env?: Environment): DebuggerEnvironm
|
|||
if (!env) {
|
||||
return [];
|
||||
}
|
||||
const filter: RegExp = /\$\{.+?\}/; // Disallow env variables that have variable expansion values
|
||||
const filter: RegExp = /\$\{.+?\}|\n/; // Disallow env variables that have variable expansion values or newlines
|
||||
const converted_env: DebuggerEnvironmentVariable[] = [];
|
||||
for (const [key, value] of Object.entries(env)) {
|
||||
if (value !== undefined && !value.match(filter)) {
|
||||
|
|
|
@ -8,9 +8,10 @@ suite('debugger tests', () => {
|
|||
env['other'] = '${hey';
|
||||
env['BASH_FUNC_which%%'] = '() { ( alias;\n eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot \"$@\"\n}';
|
||||
env['BASH_FUNC_module()'] = '() { eval $($LMOD_CMD bash "$@") && eval $(${LMOD_SETTARG_CMD:-:} -s sh';
|
||||
env['BASH_FUNC_ml%%'] = '() { module ml \"$@\"\n}';
|
||||
|
||||
const debugEnv = fromDebuggerEnvironmentVars(makeDebuggerEnvironmentVars(env));
|
||||
expect(debugEnv).to.contain.keys('foo', 'other');
|
||||
expect(debugEnv).to.not.contain.keys('BASH_FUNC_which%%', 'BASH_FUNC_module()');
|
||||
expect(debugEnv).to.not.contain.keys('BASH_FUNC_which%%', 'BASH_FUNC_module()', 'BASH_FUNC_ml%%');
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче