Skip to content

Commit 4662035

Browse files
committed
fix(commands): add allow-insecure check for fs operations
1 parent 8aa49dd commit 4662035

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/commands/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { W3C_ELEMENT_KEY, errors } from '@appium/base-driver';
22
import { Element, Rect } from '@appium/types';
33
import { tmpdir } from 'node:os';
44
import { extname, join } from 'node:path';
5-
import { POWER_SHELL_FEATURE } from '../constants';
5+
import { MODIFY_FS_FEATURE, POWER_SHELL_FEATURE } from '../constants';
66
import { NovaWindowsDriver } from '../driver';
77
import { ClickType, Enum, Key } from '../enums';
88
import {
@@ -737,6 +737,7 @@ export async function stopRecordingScreen(this: NovaWindowsDriver, args?: Upload
737737
}
738738

739739
export async function deleteFile(this: NovaWindowsDriver, args: { path: string }): Promise<void> {
740+
this.assertFeatureEnabled(MODIFY_FS_FEATURE);
740741
if (!args || typeof args !== 'object' || !args.path) {
741742
throw new errors.InvalidArgumentError("'path' must be provided.");
742743
}
@@ -747,6 +748,7 @@ export async function deleteFile(this: NovaWindowsDriver, args: { path: string }
747748
}
748749

749750
export async function deleteFolder(this: NovaWindowsDriver, args: { path: string, recursive?: boolean }): Promise<void> {
751+
this.assertFeatureEnabled(MODIFY_FS_FEATURE);
750752
if (!args || typeof args !== 'object' || !args.path) {
751753
throw new errors.InvalidArgumentError("'path' must be provided.");
752754
}

lib/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export const POWER_SHELL_FEATURE = 'power_shell';
1+
export const POWER_SHELL_FEATURE = 'power_shell';
2+
export const MODIFY_FS_FEATURE = 'modify_fs';

0 commit comments

Comments
 (0)