fix(kon): security audit fixes — CSP, XSS, unwraps, key rename

Security fixes from code audit:
- CSP re-enabled in tauri.conf.json with strict directives
  (was null — critical vulnerability)
- XSS fix in viewer highlightText(): HTML entities escaped before
  inserting <mark> tags via {@html}
- Removed 3 unwrap() calls in rule_based.rs British English conversion
  — replaced with safe let-else guards
- Removed unwrap() on main window lookup in lib.rs setup — now uses
  if-let for graceful handling
- Wrapped JSON.parse in DictationPage transcription-result listener
  with try/catch

Rebrand cleanup:
- Renamed all localStorage keys from ramble_* to kon_* across
  7 files (stores, viewer, float, history)

12 tests passing, clippy clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jake
2026-03-16 22:51:47 +00:00
parent 904d5fdb95
commit c463293935
9 changed files with 52 additions and 35 deletions

View File

@@ -12,7 +12,7 @@ export const page = $state({
// ---- Settings (persisted to localStorage) ----
const SETTINGS_KEY = "ramble_settings";
const SETTINGS_KEY = "kon_settings";
const defaults = {
engine: "whisper",
@@ -53,7 +53,7 @@ export function saveSettings() {
// ---- Profiles (persisted to localStorage) ----
const PROFILES_KEY = "ramble_profiles";
const PROFILES_KEY = "kon_profiles";
function loadProfiles() {
try {
@@ -73,7 +73,7 @@ export function saveProfiles() {
// ---- History (persisted to localStorage) ----
const HISTORY_KEY = "ramble_history";
const HISTORY_KEY = "kon_history";
function loadHistory() {
try {
@@ -104,7 +104,7 @@ export function deleteFromHistory(index) {
// ---- Tasks (persisted to localStorage) ----
const TASKS_KEY = "ramble_tasks";
const TASKS_KEY = "kon_tasks";
function loadTasks() {
try {
@@ -169,7 +169,7 @@ export function uncompleteTask(id) {
// ---- BroadcastChannel for multi-window task sync ----
const taskChannel = typeof BroadcastChannel !== "undefined"
? new BroadcastChannel("ramble_tasks")
? new BroadcastChannel("kon_tasks")
: null;
if (taskChannel) {
@@ -189,7 +189,7 @@ function broadcastTasks() {
// ---- Task Lists (persisted to localStorage) ----
const TASK_LISTS_KEY = "ramble_task_lists";
const TASK_LISTS_KEY = "kon_task_lists";
function loadTaskLists() {
try {
@@ -309,7 +309,7 @@ export function sortTaskLists(mode) {
// BroadcastChannel for task lists
const taskListChannel = typeof BroadcastChannel !== "undefined"
? new BroadcastChannel("ramble_task_lists")
? new BroadcastChannel("kon_task_lists")
: null;
if (taskListChannel) {
@@ -329,7 +329,7 @@ function broadcastTaskLists() {
// ---- Templates (persisted to localStorage) ----
const TEMPLATES_KEY = "ramble_templates";
const TEMPLATES_KEY = "kon_templates";
function loadTemplates() {
try {