Skip to content
Kavachकवच

kavach audit

● Advanced3 minBefore this: Secrets: reveal, Unsafe

kavach audit lists the places a reviewer must look first: unsafe code, revealed secrets, and what each function can touch.

type Order {
    id: Int
    secret card: String
}

fn charge(secret card: String, amount: Int) -> String {
    "charged {amount}, card of {card.len()} digits"
}

fn main() {
    const order = Order(id: 7, card: "4242424242421881")
    print(charge(order.card, 499))
    const card = reveal(order.card)
    print("ends in {card.slice(12, 16)}")
}
src/main.kav: Kavach code
terminal
kavach audit
unsafe code:
  nothing
revealed secrets:
  src/main.kav:13  reveal(…)
audited calls:
  nothing
capability use:
  src/main.kav:10  fn main: Console
SectionLists
unsafe codeevery unsafe block: raw memory and C calls, which Kavach can't check
revealed secretsevery reveal(…), where a secret value is let out on purpose
audited callsevery call of an audited fn, which makes a checked value such as a sql"…" Query from text known only when the program runs
capability useeach function and the capabilities it uses: files, network, terminal, AI…

Everything else the compiler has already checked. So a reviewer, or a security team, starts with this short list instead of reading the whole program: see reveal, Unsafe and audited fn.