Features
Everything in the app today.
Reading src/api.ts
src/api.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
import { invoke } from "@tauri-apps/api/core";
export type License = { plan: "free" | "pro"; expires: number };
// Asks the backend whether this copy is licensed.
export async function license(): Promise<License> {
const raw = localStorage.getItem("license");
if (raw) return JSON.parse(raw);
return invoke<License>("license_status");
}
export async function canExport(): Promise<boolean> {
const l = await license();
return l.plan === "pro";
}
export async function exportReport(id: string) {
if (!(await canExport())) throw new Error("Pro only");
return invoke("export_report", { id });
}- Readsrc/api.ts
Reading src-tauri/src/license.rs
src-tauri/src/license.rs
1 2 3 4 5 6 7 8 9 10 11 12
use serde::Serialize;
#[derive(Serialize)]
pub struct License {
pub plan: String,
pub expires: i64,
}
pub fn status() -> License {
let plan = std::env::var("PLAN").unwrap_or_else(|_| "free".into());
License { plan, expires: 0 }
}- Readsrc-tauri/src/license.rs
Reading src-tauri/src/integrity.rs
src-tauri/src/integrity.rs
1 2 3 4
/// Checks that the running binary is the one we shipped.
pub fn check() -> Result<(), String> {
Ok(())
}- Readsrc-tauri/src/integrity.rs
Reading src-tauri/src/main.rs
src-tauri/src/main.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
mod integrity;
mod license;
#[tauri::command]
fn license_status() -> license::License {
license::status()
}
#[tauri::command]
fn export_report(id: String) -> Result<String, String> {
Ok(format!("report {id}"))
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![license_status, export_report])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}- Readsrc-tauri/src/main.rs
12 functions mapped, 0 named by the agents
Missing checks
It compares every route with its neighbours and flags the one that skips a check the others run.
takeCredit() before the model call
- POST /api/draftcalled
- POST /api/rewritecalled
- POST /api/translatecalled
- POST /api/exportmissing
3 of 4 peer routes call it. Export does not.
A plan for your product
A few questions, then a plan that says what to build, buy or skip, and what it costs each month.
Protection plan
Solo indie, $9/month AI writing API, under 100 payers, zero budget
- Session auth on every API routepartial
- Atomic credit deductionpartial
- Parameterized SQLpresent
- Per-account data scopingpresent
Fixes you can review
Each fix is its own commit on a reseal/ branch, with a test that tries the attack.
7af0539 Harden: Charge credits on the export route before it calls the model
router.post('/export', async (req, res) => {
+ await takeCredit(req.user, 8);
const doc = await complete(...);- ✔ export with 0 credits is refused with 402 and no model call
- ✔ export with enough credits still works
On main, the first test fails. On the branch, both pass.
Private by default
Agents work on a masked copy of your code in a throwaway VM on your computer.
Sandbox
- Machine
- A fresh VM for every run
- Your code
- A masked copy; keys never reach the AI
- Network
- None, unless you allow it
- Time limit
- 1 to 3 hours, you choose
Signed reports
Sign a report for one exact commit. Anyone can check it at /verify.
Report for credits-ai
- Commit
- 7af0539
- Signature
- valid
- Signed by
- the account that ran the scan
The signature proves the report is unchanged, not that the code is safe.