Adds output path validation for enhanced security

Enhances security by validating output paths and executable paths.

This prevents path traversal attacks and command injection vulnerabilities
by ensuring that users can only specify valid relative paths within the vault
and safe executable paths. It also displays notices when the path is deemed unsafe.
This commit is contained in:
AlexKucera committed 2025-09-03 22:56:30 +02:00
1 parent d4c4a1be73
commit 42aa8e176c
3 files changed
+167 -5

No files matched your search

+3 -4
View File
@@ -7,6 +7,7 @@ import { Setting, App } from 'obsidian';
import { ModalSection, ModalState, ValidationResult } from '../modalTypes';
import { ExportFormat } from '../../../core/settings';
import { FolderSuggest } from '../../components/FolderSuggest';
import { SecurityUtils } from '../../../core/SecurityUtils';
export class GeneralSection implements ModalSection {
private container: HTMLElement | null = null;
@@ -101,10 +102,8 @@ export class GeneralSection implements ModalSection {
// Validate output folder
if (this.outputFolderInput) {
const value = this.outputFolderInput.value.trim();
if (!value) {
errors.push('Output folder is required');
} else if (value.startsWith('/') || value.startsWith('\\')) {
warnings.push('Output folder should be relative to vault root');
if (!SecurityUtils.validateOutputPath(value)) {
errors.push(SecurityUtils.getPathValidationError(value));
}
}