---
title: "Hakana: Taking Hack Seriously"
description: "Slack has open-sourced Hakana, a Rust-based type checker and static analyzer for Hack, built on Psalm's design and reusing the Hack parser bundled with HHVM."
url: "https://swe.quest/articles/hakana-taking-hack-seriously-564898cdb11987b5"
canonical: "https://slack.engineering/hakana-taking-hack-seriously/"
source: "Slack Engineering"
published: "2023-02-08"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 5
tags: ["static-analysis","php","appsec","rust","open-source"]
---

# Hakana: Taking Hack Seriously

A post on [Slack Engineering](https://swe.quest/sources/slack.md), published 2023-02-08, 5 min read, Announcement. Original: [https://slack.engineering/hakana-taking-hack-seriously/](https://slack.engineering/hakana-taking-hack-seriously/)

## Summary

Slack has open-sourced Hakana, a Rust-based type checker and static analyzer for Hack, built on Psalm's design and reusing the Hack parser bundled with HHVM. Slack runs it in CI to catch unused code, impossible or redundant type checks, misuse of internal APIs, and security flaws. Security checks use interprocedural taint analysis similar to Facebook's internal Zoncolan, plus a literal-string type that blocks SQL injection at function boundaries. Plugin hooks support custom type inference and fast codebase-wide migrations, and on Slack's roughly 5 million lines it runs about 5x faster than Psalm and on par with the official Hack typechecker.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Static analysis](https://swe.quest/tags/static-analysis.md) (Engineering practices)
- [PHP](https://swe.quest/tags/php.md) (Languages)
- [Application security](https://swe.quest/tags/appsec.md) (Security)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Open source](https://swe.quest/tags/open-source.md) (Engineering practices)

## Prerequisites

- PHP or Hack basics ([easy posts on PHP](https://swe.quest/tags/php.md?difficulty=easy))
- static type checking

## Keywords

Hakana, Hack, Psalm, HHVM, Zoncolan, XHP, WebAssembly

## Related posts

- [Hacklang at Slack: A Better PHP](https://swe.quest/articles/hacklang-at-slack-a-better-php-0c5b2d46ded07bab.md): Slack Engineering · 2020-04-14 · Medium · 7 min read · PHP, Type systems, Static analysis, Refactoring & migrations, Concurrency
  Slack moved its PHP 5 backend to HHVM in 2016 for speed and stayed for Hack, whose static type checker reports type errors as code is typed rather than at runtime.
- [How Two Interns Are Helping Secure Millions of Lines of Code](https://swe.quest/articles/how-two-interns-are-helping-secure-millions-of-lines-of-code-daa936f3b67e08a6.md): Slack Engineering · 2021-11-04 · Medium · 6 min read · Static analysis, Application security, PHP, Functional programming, Open source
  Slack added Hack support to Semgrep so its 5+ million lines of Hack could be scanned for security vulnerabilities, since no static analysis tools exist for the language.
- [Auditing in the age of (good enough) AI](https://swe.quest/articles/auditing-in-the-age-of-good-enough-ai-790bce56b92999e7.md): Trail of Bits · 2026-09-18 · Hard · 10 min read · Static analysis, Formal methods, Cryptography, AI agents, Vulnerability research
  Before auditing the Miden zero-knowledge VM, Trail of Bits spent six months using Claude and Codex agents to build tooling for its custom stack-based assembly language (MASM): an LSP server, a decompiler with a reusable IR, an abstract-interpretation static analysis engine, and a Lean model of the VM executor.
- [Protecting user data through source code analysis at scale](https://swe.quest/articles/protecting-user-data-through-source-code-analysis-at-scale-357585a0d96f83c8.md): Meta Engineering · 2025-02-18 · Medium · 4 min read · Static analysis, Threat detection, Application security, Python
  Meta's Anti-Scraping team encodes known scraping attack vectors as taint-analysis rules in its in-house static analyzers, Zoncolan for Hack and Pysa for Python, so potential vectors are flagged before code ships.
- [More Than 2x Faster Hashing in ClickHouse Using Rust](https://swe.quest/articles/more-than-2x-faster-hashing-in-clickhouse-using-rust-404bde5cc500d24b.md): ClickHouse · 2022-10-25 · Medium · 5 min read · Rust, C & C++, Build systems, Performance engineering, Cryptography
  ClickHouse added optional Rust library support to its C++/CMake build using Corrosion-rs, with BLAKE3 as the first library, exposed to C++ through a Rust shim function using C-compatible FFI types and a header file.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
