Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@tauri-apps/api": "^2.11.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dompurify": "^3.4.11",
"lucide-react": "^1.20.0",
"react": "^19.2.4",
"react-dom": "^19.2.7",
Expand All @@ -28,6 +29,7 @@
"@tauri-apps/cli": "^2.11.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@types/dompurify": "^3.0.5",
"@types/node": "^25.9.3",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
Expand Down
13 changes: 7 additions & 6 deletions apps/desktop/src/features/workspace/Workspace.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DOMPurify from "dompurify";
import { useState, useMemo, memo } from "react";
import { parseProjectBootstrapSummary, type ProjectBootstrapSummary, type RehearsalSong, type RehearsalRole } from "@bandscope/shared-types";
import { RoleSwitcher } from "./RoleSwitcher";
Expand Down Expand Up @@ -354,9 +355,9 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp
<div className="mt-3 space-y-2">
{activeRoleAssignments.map((assignment) => (
<div key={assignment.id} className="rounded-lg border border-cyan-300/15 bg-cyan-300/[0.06] p-2">
<p className="text-xs font-black uppercase tracking-[0.16em] text-cyan-100">{assignment.assignee}</p>
<p className="mt-1 text-sm text-slate-100">{assignment.summary}</p>
<p className="mt-1 text-[0.7rem] font-semibold uppercase tracking-[0.16em] text-slate-400">{formatStatusLabel(assignment.status)}</p>
<p className="text-xs font-black uppercase tracking-[0.16em] text-cyan-100">{DOMPurify.sanitize(assignment.assignee)}</p>
<p className="mt-1 text-sm text-slate-100">{DOMPurify.sanitize(assignment.summary)}</p>
<p className="mt-1 text-[0.7rem] font-semibold uppercase tracking-[0.16em] text-slate-400">{DOMPurify.sanitize(formatStatusLabel(assignment.status))}</p>
</div>
))}
</div>
Expand All @@ -369,9 +370,9 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp
<div className="mt-3 space-y-2">
{activeRoleComments.map((comment) => (
<div key={comment.id} className="rounded-lg border border-amber-300/15 bg-amber-300/[0.07] p-2">
<p className="text-xs font-black uppercase tracking-[0.16em] text-amber-100">{comment.author}</p>
<p className="mt-1 text-sm text-slate-100">{comment.body}</p>
<p className="mt-1 text-[0.7rem] font-semibold uppercase tracking-[0.16em] text-slate-400">{formatStatusLabel(comment.status)}</p>
<p className="text-xs font-black uppercase tracking-[0.16em] text-amber-100">{DOMPurify.sanitize(comment.author)}</p>
<p className="mt-1 text-sm text-slate-100">{DOMPurify.sanitize(comment.body)}</p>
<p className="mt-1 text-[0.7rem] font-semibold uppercase tracking-[0.16em] text-slate-400">{DOMPurify.sanitize(formatStatusLabel(comment.status))}</p>
</div>
))}
</div>
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ import { expect } from "vitest";
import * as matchers from "@testing-library/jest-dom/matchers";

expect.extend(matchers);

// Mock DOMPurify to fix test failures where DOMPurify is undefined globally in tests
import DOMPurify from 'dompurify';
vi.stubGlobal('DOMPurify', DOMPurify);
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion services/analysis-engine/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ requires-python = ">=3.12"
dependencies = [
"librosa>=0.11.0",
"numba<0.66.0",
"numpy>=1.26.0",
"numpy>=1.26.4",
"soundfile>=0.13.1",
"urllib3>=2.7.0",
"yt-dlp>=2026.6.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ def separate(self, audio_path: str | Path) -> AudioSeparationResult:

def _resolve_audio_file(self, audio_path: str | Path) -> Path:
"""Normalize and validate the selected source path."""
candidate = Path(audio_path).expanduser()
path_str = str(audio_path)
if ".." in path_str:
raise ValueError("Path traversal sequences are not allowed")
candidate = Path(audio_path)
try:
path = candidate.resolve(strict=True)
Comment on lines 133 to 140
except FileNotFoundError as error:
Expand Down Expand Up @@ -215,7 +218,7 @@ def _load_model_profile(self) -> dict[str, float]:
expected_sha256 = _BANDSPLIT_PROFILE_SHA256

if self.config.model_profile_path:
profile_candidate = Path(self.config.model_profile_path).expanduser()
profile_candidate = Path(self.config.model_profile_path)
try:
profile_path = profile_candidate.resolve(strict=True)
except FileNotFoundError as error:
Comment on lines 220 to 224
Expand Down
7 changes: 7 additions & 0 deletions services/analysis-engine/tests/test_separation.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,10 @@ def test_audio_stem_separator_rejects_non_finite_band_profile(tmp_path) -> None:
model_profile_sha256=checksum,
)
)


def test_audio_stem_separator_rejects_path_traversal(tmp_path) -> None:
"""Ensure path traversal attempts are rejected outright."""
separator = AudioStemSeparator(AudioSeparationConfig(target_sample_rate=8_000))
with pytest.raises(ValueError, match="Path traversal sequences are not allowed"):
separator.separate(tmp_path / ".." / "missing.wav")
2 changes: 1 addition & 1 deletion services/analysis-engine/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading