Repository: DosX-dev/rep3
Branch: main
Commit: 13f5239a8186
Files: 20
Total size: 915.8 KB
Directory structure:
gitextract_3vpkqevd/
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY_AUDIT.md
└── src/
├── .server.ps1
├── css/
│ └── app.css
├── index.html
└── js/
├── constants.js
├── crypto.js
├── db.js
├── desktop.js
├── detectors/
│ └── incognito.js
├── docmode.js
├── fileops.js
├── home.js
├── initlog.js
├── main.js
├── proactive/
│ └── daemon.js
├── state.js
└── vfs.js
================================================
FILE CONTENTS
================================================
================================================
FILE: CONTRIBUTING.md
================================================
> Thank you for considering a contribution to **SafeNova**. This document explains how to do it properly so your effort isn't wasted and the review process goes smoothly.
## 📚 Table of Contents
- [🧭 Before you start](#before-you-start)
- [🐛 Reporting bugs](#reporting-bugs)
- [💡 Suggesting features](#suggesting-features)
- [🔀 Submitting a pull request](#submitting-a-pull-request)
- [Setting up the environment](#setup)
- [Branch naming](#branch-naming)
- [Commit messages](#commit-messages)
- [Pull request checklist](#pr-checklist)
- [🎨 Code style](#code-style)
- [General rules](#style-general)
- [JavaScript specifics](#style-js)
- [HTML & CSS](#style-html-css)
- [🔐 Security contribution rules](#security-rules)
- [🚫 What we do NOT accept](#not-accepted)
---
## 🧭 Before you start
SafeNova is a security-first project. Before touching anything, spend time understanding how it actually works:
- Read the full [README](./README.md) — especially the [SafeNova Proactive](./README.md#safenova-proactive), [Encryption](./README.md#encryption), and [How containers work](./README.md#how-containers-work) sections
- Understand the [project structure](./README.md#project-structure) — each file has a specific, narrow responsibility
- Look at the existing code style before writing a single line
> **The codebase is small and intentional.** There are no dead files, no legacy layers, no placeholder code. If something looks unusual, there is almost always a documented reason for it — read the surrounding comments before assuming it is wrong.
---
## 🐛 Reporting bugs
Use [GitHub Issues](https://github.com/DosX-dev/SafeNova/issues) to report bugs. Before opening a new issue:
- Check if the issue already exists
- Reproduce the bug on the latest version
- Make sure it happens in a supported browser (Chrome 90+, Firefox 90+, Safari 15+, Edge 90+)
A good bug report includes:
| Field | What to provide |
| --------------- | ----------------------------------------------------------------------------- |
| **Description** | What happened vs. what you expected |
| **Steps** | Exact numbered steps to reproduce |
| **Environment** | Browser name + version, OS, online vs. local |
| **Logs** | DevTools console output if relevant — paste as text, not a screenshot |
| **Severity** | Does it cause data loss? Does it affect security? Does it only affect the UI? |
> **If the bug is security-related** (data exposure, bypass of any protection layer, key material leakage), do **not** file a public issue. See [Security contribution rules](#security-rules) below.
---
## 💡 Suggesting features
Open a [GitHub Issue](https://github.com/DosX-dev/SafeNova/issues) with the `enhancement` label. Describe:
- **What problem it solves** — not just what it does, but why it matters
- **Who benefits** — casual user, power user, security-conscious user?
- **Alternatives you considered** — shows you thought it through
- **Any security implications** — SafeNova handles encrypted data; new features can introduce new attack surface
Features that don't have a clear security story or that add complexity without proportional value will likely be declined. That's not a rejection of effort — it's a design constraint.
---
## 🔀 Submitting a pull request
### Setting up the environment
There is no build step. The project runs as static files:
```powershell
# Clone the repo
git clone https://github.com/DosX-dev/SafeNova.git
cd SafeNova
# Start the local server
.\.server.ps1
```
The server starts on port `7777` (or the next free port) and opens the app in your browser. Edit files directly in `src/` — no bundler, no transpiler, no `npm install`.
### Branch naming
| Prefix | Use for | Example |
| ----------- | -------------------------------------------- | -------------------------------- |
| `fix/` | Bug fixes | `fix/export-blob-url` |
| `feature/` | New functionality | `feature/keyboard-shortcut-copy` |
| `refactor/` | Code cleanup with no behavior change | `refactor/vfs-node-validation` |
| `docs/` | Documentation only | `docs/contributing-guide` |
| `security/` | Security improvements (discuss in DMs first) | `security/csp-worker-src` |
### Commit messages
Keep them short and imperative:
```
Fix export producing HTML instead of blob data
Add keyboard shortcut for container lock
Refactor VFS orphan detection to O(n) pass
```
No issue numbers in the subject line — put those in the PR description instead. No `WIP:` commits in the final branch.
### Pull request checklist
Before marking the PR as ready for review:
- [ ] Tested in at least one supported browser
- [ ] No `console.log` or debug artifacts left in the code
- [ ] No new external dependencies introduced
- [ ] Existing behavior is not broken for cases you didn't touch
- [ ] If you changed `daemon.js` — read [Security contribution rules](#security-rules) first
- [ ] PR description explains **what** changed and **why**, not just **how**
---
## 🎨 Code style
### General rules
- **Match the style of the file you're editing.** Indentation, spacing, quote style, comment language — all of it. Don't mix styles within a file
- **No unnecessary abstractions.** Don't create a helper for something used once. Don't design for hypothetical future requirements
- **Comments explain _why_, not _what_.** If the code is obvious, don't comment it. If it isn't obvious, explain the reasoning — not the mechanics
- **No dead code.** Don't comment out unused blocks and leave them — delete them
### JavaScript specifics
The codebase is vanilla ES2020+ JavaScript — no frameworks, no TypeScript. A few conventions to follow:
- Use `const` for everything that doesn't need reassignment, `let` otherwise. No `var`
- Prefer early returns over deep nesting
- Async functions use `async/await` — no raw `.then()` chains unless combining with `Promise.allSettled` or similar
- String concatenation uses template literals `` `${x}` `` for readability; the concatenation operator `'' + x` is reserved for places where `String()` calls must be avoided for security reasons (see `daemon.js` for context)
- `for` loops with index variables for performance-critical paths; `for...of` for readability in non-critical paths
- Group related declarations on one line when they are semantically linked:
```js
// Good — same logical unit
let offset = 0,
count = 0,
valid = true;
```
### HTML & CSS
- HTML attributes stay on one line unless there are more than ~4 and readability suffers
- CSS follows the existing class naming — BEM is not enforced, but names should be descriptive and scoped to their component
- No inline styles in HTML except where dynamic values make them unavoidable (e.g. `style="left: ${x}px"`)
- No `!important` except where intentional override is the documented purpose (e.g. lockdown veil)
---
## 🔐 Security contribution rules
SafeNova handles **encrypted data and derived cryptographic keys in a live browser environment**. This makes security changes fundamentally different from normal feature work.
**If your change touches any of the following, open a discussion issue or contact the maintainer before writing code:**
- `daemon.js` — the Proactive anti-tamper runtime guard
- `crypto.js` — AES-256-GCM + Argon2id layer
- `state.js` — session key storage and three-source key wrapping
- `db.js` — IndexedDB abstraction (container and file record layout)
- The Content Security Policy in `index.html`
- Any change that relaxes an existing restriction (e.g. whitelisting a new URL scheme, removing a hook)
> **Why the extra step?** Security changes that look correct can introduce subtle regressions. The Proactive guard in particular has carefully documented reasons for every design decision — a change that seems like a simplification may silently remove a specific defense. Discussing first prevents a PR that cannot be merged from wasting your time.
**Responsible disclosure for vulnerabilities:** If you find a security vulnerability (bypass of the Proactive guard, key material leakage, CSP bypass, etc.), please **do not file a public issue**. Contact the maintainer directly through GitHub. You will get credit in the changelog.
---
## 🚫 What we do NOT accept
To save everyone's time — PRs in the following categories will be closed without merge:
| Category | Reason |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------- |
| External runtime dependencies | SafeNova has zero external dependencies by design. Adding `npm` packages is a non-starter |
| Framework migrations | React, Vue, Svelte, etc. — no. The codebase is intentionally framework-free |
| TypeScript conversion | Not planned. |
| Weakened security controls | Any change that removes or relaxes an existing Proactive check, CSP directive, or encryption constraint |
| UI cosmetic overhauls | Minor tweaks are fine; wholesale redesigns need prior discussion |
| Localization / i18n infrastructure | Out of scope for the current version |
---
If you're unsure whether your idea fits — just open an issue and ask. It's faster than writing code that doesn't land.
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023-2026 DosX
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
> ### Try it online: [https://safenova.dosx.su/](https://safenova.dosx.su/)
## ❔ What it is
SafeNova is a single-page web app that lets you create encrypted **containers** — isolated vaults where you can organize files in a folder structure, much like a regular desktop file manager. Everything is encrypted client-side before being written to storage. Nothing ever leaves your device.

Key properties:
- **Zero-knowledge** — the app never sees your password or plaintext data
- **Offline-first** — works entirely without network access
- **No installation** — start the local server and you're running (or use online)
---
## 📚 Table of Contents
- [❔ What it is](#what-it-is)
- [🚀 Getting started](#getting-started)
- [Option A — Use online version](#getting-started-online)
- [Option B — Local server](#getting-started-local)
- [📋 Requirements](#requirements)
- [⚙️ Features](#features)
- [⚔️ SafeNova vs. the Competition](#comparison)
- [📁 Project structure](#project-structure)
- [🔒 How containers work](#how-containers-work)
- [📄 The `.safenova` Container Format](#container-format)
- [Archive sections](#container-format-archive-sections)
- [Design properties](#container-format-design-properties)
- [🔐 Encryption](#encryption)
- [Session token security](#session-token-security)
- [Current tab session](#current-tab-session)
- [Stay signed in](#stay-signed-in)
- [Three-source key wrapping](#three-source-key-wrapping)
- [Session payload format](#session-payload-format)
- [Remaining trade-off](#remaining-trade-off)
- [🔏 Content Security Policy](#content-security-policy)
- [Meta tag](#csp-meta-tag)
- [Server-level headers](#csp-server-headers)
- [🛡️ Cross-Tab Session Protection](#cross-tab-session-protection)
- [🛑 Duress Password](#duress-password)
- [How it works](#duress-how-it-works)
- [Why this design](#duress-why-this-design)
- [Technical details](#duress-technical-details)
- [🔬 SafeNova Proactive Anti-Tamper](#safenova-proactive-antitamper)
- [Startup sequence](#proactive-startup-sequence)
- [Why native restoration matters](#proactive-native-restoration-advantage)
- [Real-time watchdog](#proactive-watchdog)
- [Watchdog resilience](#proactive-watchdog-resilience)
- [Intentionally excluded from checks](#proactive-excluded-checks)
- [Network request interception](#proactive-network-interception)
- [DOM exfiltration defense](#proactive-dom-exfiltration)
- [Threat response](#proactive-threat-response)
- [Design philosophy](#proactive-design-philosophy)
- [Hook opacity](#proactive-hook-opacity)
- [🔍 Container Integrity Scanner](#container-integrity-scanner)
- [Phase 1 — VFS structural checks](#scanner-phase-1)
- [Phase 2 — Database-level checks](#scanner-phase-2)
- [⚡ Performance](#performance)
- [Adaptive concurrency](#adaptive-concurrency)
- [Bulk upload](#bulk-upload)
- [ZIP export](#zip-export)
- [Password change](#password-change)
- [Container export](#container-export)
- [Drag-and-drop performance](#drag-drop-performance)
- [📱 Mobile Touch Support](#mobile-touch-support)
- [Long-press to drag](#mobile-long-press)
- [Multi-file drag](#mobile-multi-file-drag)
- [Context menu](#mobile-context-menu)
- [Paste at finger position](#mobile-paste-at-finger-position)
- [Overscroll](#mobile-overscroll)
- [�️ Security Audit Changelog](#security-audit)
- [�🛠️ Contribute](#contribute)
- [💬 Community](#community)
- [🤝 Thanks to all contributors](#thanks)
---
## 🚀 Getting started
### Option A — Use online version
SafeNova is hosted on: [https://safenova.dosx.su/](https://safenova.dosx.su/)
### Option B — Local server
A zero-dependency PowerShell server is included:
```powershell
.\\.server.ps1
```
Or right-click the file → **Run with PowerShell**. It starts an HTTP server on port `7777` (or the next free port) and opens the app in your default browser.
No external installs needed — it uses the Windows built-in `HttpListener`.
---
## 📋 Requirements
- A modern browser: **Chrome 90+**, **Firefox 90+**, **Safari 15+**, or **Edge 90+**
- Web Crypto API must be available — this requires either **HTTPS** or **`localhost`**
- No plugins, no extensions, no backend
---
## ⚙️ Features
- **Multiple containers** — each with its own password and independent storage limit (8 GB per container)
- **Virtual filesystem** — nested folders, drag-to-reorder icons, customizable folder colors
- **File operations** — upload (drag & drop or browse; folder upload with 4× parallel encryption), download, copy, cut, paste, rename, delete
- **Built-in viewers** — text editor, image viewer, audio/video player, PDF viewer
- **Hardware key support** — optionally use a WebAuthn passkey to strengthen the container salt
- **Session memory** — optionally remember your session per tab (ephemeral, recommended) or persistently until manually signed out, using AES-GCM-encrypted session tokens; persistent sessions survive browser restarts
- **Cross-tab session protection** — a container can only be actively open in one browser tab at a time; a lightweight lock protocol detects conflicts and offers instant session takeover
- **Container import / export** — portable `.safenova` container files; import reads the archive via streaming `File.slice()` without loading the full file into memory, making multi-gigabyte imports possible; export streams data chunk-by-chunk requiring no single contiguous allocation regardless of container size
- **Export password guard** — configurable setting (on by default) to require password confirmation before exporting; when disabled, the container key is taken directly from the active session if one is open; if no session is present, a pre-generated encrypted export cache stored in IDB is used — the cache payload is deflate-compressed before encryption, reducing its IDB footprint significantly for containers with many files; the compressed bytes are then wrapped with a per-container HKDF-SHA-256 derived key (AES-256-GCM), making the cache browser-independent; if the cache is absent or stale (file count or sizes changed), the context menu shows a red dot and falls back to a password prompt — after a successful password-prompted export the cache is rebuilt automatically so subsequent exports require no password; the cache is invalidated on password change or settings re-enable
- **Quick export button** — dedicated **Export** button in the desktop toolbar provides one-click passwordless export when the export password guard is disabled
- **Sort & arrange** — sort icons by name, date, size, or type; drag to custom positions
- **Secure container deletion** — before permanent erasure, every encrypted blob is cryptographically pre-shredded: inline files have random bytes XOR-flipped (position and delta are unknown and unlogged); large chunked files have their AES-GCM IV zeroed, making decryption unconditionally impossible and the operation maximally fast; heavy internal blobs (deferred workspace data, export cache, audit log) are explicitly nullified before the record is deleted so that the browser immediately releases persistent storage and the freed space is reflected without waiting for lazy garbage collection
- **Duress password** — optional panic password that, when entered anywhere (unlock, change password, export), looks exactly like an incorrect password but silently destroys all encrypted data in the background; see [Duress Password](#duress-password) below
- **SafeNova Proactive** — runtime protection module that loads first in `
| Feature | SafeNova | VeraCrypt | BitLocker | Cryptomator |
|---|---|---|---|---|
| Best suited for | Personal files on shared or managed machines — zero-install, browser-only, no disk traces | Large encrypted volumes on own hardware; plausible deniability | IT-managed Windows with full-disk encryption and central key recovery | Encrypting files before syncing to cloud (Dropbox, Google Drive, OneDrive…) |
| Cross-platform | ✅ Any browser — Windows, macOS, Linux, Android, iOS | 🟡 Desktop only — Windows, macOS, Linux | ❌ Windows only | ✅ Windows, macOS, Linux, Android, iOS |
| No installation | ✅ Zero install, runs in the browser | ❌ Requires system installation | ❌ Windows Pro/Enterprise only | ❌ Requires a desktop or mobile app |
| Admin / root rights | ✅ None required | ❌ Required for mounting | ❌ Required | 🟡 None on Windows/iOS; macOS needs macFUSE; Linux needs FUSE |
| Encryption algorithm | ✅ AES-256-GCM — authenticated encryption; every ciphertext has an integrity tag | ✅ AES / Twofish / Serpent (configurable) | 🟡 AES-128/256 XTS — no authentication tag | ✅ AES-256-GCM per file |
| Key derivation | ✅ Argon2id — memory-hard; GPU brute-force is expensive | 🟡 PBKDF2-SHA-512 / Whirlpool — not memory-hard; GPU-crackable | 🟡 TPM-bound; password KDF is comparatively weak | ✅ scrypt — memory-hard; comparable to Argon2id |
| Per-item authentication | ✅ GCM tag per chunk — tampering always detected | ❌ Block-level only; no per-file MAC | ❌ XTS provides no authentication | ✅ GCM tag per file |
| Portable container | ✅ Single .safenova file — copy anywhere, open anywhere |
🟡 Single container file, but fixed pre-allocated size | ❌ Tied to the Windows NTFS partition | 🟡 Folder of encrypted files — portable, but not a single archive |
| File stealer protection | ✅ Encrypted in IDB; never plaintext on disk | ❌ Mounted volume exposes all files to every process | ❌ Once unlocked, all files accessible to all processes | 🟡 Encrypted on disk; plaintext only in the virtual drive while open |
| Session / key management | ✅ Three-source HKDF wrap key; tab + browser sessions; cross-tab invalidation | ❌ Key in RAM while mounted; no session concept | ❌ TPM-derived at boot; no session control | ❌ Key in memory while open; no session tokens or expiry |
| Duress / emergency wipe | ✅ Duress password silently destroys the container | ❌ Not supported | ❌ Not supported | ❌ Not supported |
| Runtime anti-tamper | ✅ SafeNova Proactive — native API restoration, 20+ hooks, quadruple watchdog | 🟡 N/A — native binary; no browser JS attack surface | 🟡 N/A — same | 🟡 N/A — same |
| Content Security Policy | ✅ Strict CSP (meta tag + server headers); blocks inline scripts and external loads | 🟡 N/A — browser mechanism; not applicable to native apps | 🟡 N/A — same | 🟡 N/A — same |
| Integrity scanner | ✅ 28 automated checks (VFS + DB); auto-repair; decryption verification | ❌ No built-in scanning | ❌ No per-file integrity | 🟡 Detects corrupt files; no automated repair |
| Export / backup | ✅ One-click export as .safenova or ZIP |
🟡 Container file is portable but fixed size; no incremental backup | ❌ Cannot export; tied to the Windows volume | ✅ Files sync individually — cloud acts as continuous backup |
| Data deletion | ✅ Blob shredding + full IDB purge on delete | 🟡 Delete the file; OS journaling may retain fragments | ❌ Decryption leaves files; separate secure-erase needed | 🟡 Delete the vault; journaling applies; cloud may retain versions |
| Code auditability | ✅ Open source; plain JS; no build pipeline | ✅ Open source; multiple independent audits | ❌ Closed source; no audit possible | ✅ Open source; independent audits conducted |
| Performance at scale | 🟡 Good for typical files; slower than native for bulk operations | ✅ Native + AES-NI; minimal overhead | ✅ Kernel driver + AES-NI; transparent to the OS | ✅ Native; per-file overhead is minimal; handles large libraries |
| Targeted attack protection | 🟡 Blocks JS injection; limited against full-OS compromise | 🟡 Anti-forensic; cannot stop OS-level keyloggers | ❌ TPM bus sniffing (Evil Maid) is a known vector | 🟡 No special runtime protection; same OS-level limits |
| Storage size | ❌ Max 8 GB per container; IDB quota applies; not for large or industrial-scale data | ✅ Disk-only limit; terabyte-scale supported | ✅ Full drive at any capacity | ✅ No built-in limit; disk / cloud quota only |
| Hidden volumes | ❌ Not supported | ✅ Hidden volumes + hidden OS partition | ❌ Not supported | ❌ Not supported |
| OS / filesystem integration | ❌ Browser sandbox only; no virtual drive mount | ✅ Mounts as a real drive letter; full shell integration | ✅ Transparent OS encryption; Group Policy; BitLocker To Go | ✅ Mounts as a virtual drive (WebDAV / FUSE) |
| Multi-user access | ❌ Single user per container | ❌ Single user at a time | 🟡 Multiple recovery keys; enterprise AD deployment | ❌ Single shared password; per-user control requires Cryptomator Hub (separate server) |
No containers yet. Create your first one.
Store and manage your sensitive files in encrypted containers that never leave your browser — no servers, no accounts, no cloud. Your password is never saved anywhere; close the tab and access is gone instantly. The duress password silently destroys everything if you’re ever forced to open it. Runtime anti-tamper protection SafeNova Proactive shields your data in the background at all times.