mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 14:06:59 +02:00
fix(create-docusaurus): potential security issue with command injection (#7507)
This commit is contained in:
parent
cd7cf781cd
commit
dbd161d67c
7 changed files with 59 additions and 22 deletions
19
packages/docusaurus-utils/src/__tests__/shellUtils.test.ts
Normal file
19
packages/docusaurus-utils/src/__tests__/shellUtils.test.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {escapeShellArg} from '../shellUtils';
|
||||
|
||||
describe('shellUtils', () => {
|
||||
it('escapeShellArg', () => {
|
||||
expect(escapeShellArg('hello')).toBe("'hello'");
|
||||
expect(escapeShellArg('*')).toBe("'*'");
|
||||
expect(escapeShellArg('hello world')).toBe("'hello world'");
|
||||
expect(escapeShellArg("'hello'")).toBe("\\''hello'\\'");
|
||||
expect(escapeShellArg('$(pwd)')).toBe("'$(pwd)'");
|
||||
expect(escapeShellArg('hello$(pwd)')).toBe("'hello$(pwd)'");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue