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
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@
**Vulnerability:** The Rust backend (`apps/desktop/src-tauri/src/main.rs`) did not enforce a maximum URL length limit when processing YouTube URLs via `import_youtube_url`. While the frontend enforced `MAX_YOUTUBE_URL_LENGTH = 2000` via the input element, this could be bypassed by an attacker sending requests directly to the Tauri backend API, potentially causing a Denial of Service (DoS) due to unbounded URL parsing and regex matching.
**Learning:** Input validation must occur at the entry point of untrusted data on the backend, even if it is also validated on the frontend. Relying solely on frontend validation for constraints like string length can expose the backend to resource exhaustion vulnerabilities.
**Prevention:** Always enforce constraints like maximum length, format validation, and sanitization at the earliest possible point on the backend, typically at the API boundary, regardless of frontend safeguards.
## 2026-08-24 - CSV Formula Injection Null Byte Bypass
**Vulnerability:** Attackers could bypass the previous CSV formula injection mitigation (`=`, `+`, `-`, `@`) by prepending a null byte (`\x00`) to the payload. Some spreadsheet processors (like Excel) ignore the null byte and execute the subsequent formula.
**Learning:** Checking for standard injection triggers and whitespace is sometimes insufficient for comprehensive CSV formula injection defense because spreadsheet applications often ignore non-printable control characters during evaluation.
**Prevention:** Extend the CSV prefix-detection regex to also capture null bytes (`\x00`) alongside spaces, tabs, and newlines. Remember to bypass the `no-control-regex` linting rule using a directive comment (e.g., `// eslint-disable-next-line no-control-regex`).
2 changes: 2 additions & 0 deletions apps/desktop/src/lib/export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ describe("export sanitization", () => {
expect(escapeCsvField("\t+SUM(A1)")).toBe("'\t+SUM(A1)");
expect(escapeCsvField("\n-100")).toBe("\"'\n-100\"");
expect(escapeCsvField("\r@cmd")).toBe("\"'\r@cmd\"");
expect(escapeCsvField("\x00=1+2")).toBe("'\x00=1+2");
expect(escapeCsvField(" \x00@cmd")).toBe("' \x00@cmd");
});

it("handles combined scenarios: formula injection with structural characters", () => {
Expand Down
3 changes: 2 additions & 1 deletion apps/desktop/src/lib/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export function sanitizeFilename(title: string): string {
export function escapeCsvField(value: string): string {
let escapedValue = value;
// Prevent CSV formula injection by prefixing problematic leading characters with a single quote
if (/^[\s\uFEFF\xA0]*[=+\-@\t\r\n]/.test(value)) {
// eslint-disable-next-line no-control-regex
if (/^[\s\uFEFF\xA0]*[=+\-@\t\r\n\x00]/.test(value)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟑 Incomplete export Security Notes

Export changes require Security Notes covering boundaries, validation, safe failure, logging/privacy, and tests. The existing note omits several required review points.

Prompt for agents
The change touches CSV export behavior in apps/desktop/src/lib/export.ts. AGENTS.md and docs/security/app-security.md require Security Notes for export changes that cover untrusted inputs, trust boundaries, validation or allowlists, safe failure, logging/privacy impact, and test points. Add that evidence in the PR implementation summary or update the relevant implementation documentation before merge.
Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ“ Info: Only leading null bytes are neutralized

The regex /^[\s\uFEFF\xA0]*[=+\-@\t\r\n\x00]/ flags a null byte only at the field start. A payload like x\x00=cmd, where the null byte separates benign text from the trigger, is not prefixed. Consistent with the prior leading-trigger model, but interior null bytes remain unhandled.

Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

escapedValue = `'${value}`;
}
// Enclose in double quotes if there's a comma, newline, or double quote
Expand Down
26 changes: 0 additions & 26 deletions package-lock.json

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

Loading