Skip to content

Getting Started

Peter Mueller edited this page Mar 26, 2026 · 1 revision

Getting Started with Hadrian

This guide walks you through installing Hadrian, configuring your first scan, and understanding the results. By the end, you'll have tested an API for OWASP Top 10 authorization vulnerabilities.

Prerequisites

Installation

Option 1: Install from Source (Recommended)

go install github.com/praetorian-inc/hadrian/cmd/hadrian@latest

Option 2: Download Pre-Built Binary

Download the latest binary for your platform from the Releases page.

Option 3: Build from Source

git clone https://github.com/praetorian-inc/hadrian.git
cd hadrian
make build

Verify Installation

hadrian --version

Configuration Files

Hadrian needs three files to run a security scan. You can auto-generate these with Claude Code or write them by hand.

1. API Specification (api.yaml)

Your OpenAPI/Swagger spec describing the API endpoints. Hadrian supports:

  • OpenAPI 3.0/3.1 (YAML or JSON)
  • Swagger 2.0 (YAML or JSON)
  • Postman Collection v2.1

2. Authentication Config (auth.yaml)

Defines how to authenticate as each role:

method: bearer

roles:
  admin:
    token: "eyJhbGciOiJIUzI1NiIs..."
  user:
    token: "eyJhbGciOiJIUzI1NiIs..."
  guest:
    token: ""

Supported auth methods: bearer, basic, api_key, cookie. See Configuration for all options.

3. Roles Config (roles.yaml)

Defines your application's roles and their permissions:

objects:
  - users
  - posts

roles:
  - name: admin
    level: 100
    permissions:
      - "read:users:all"
      - "write:users:all"
      - "delete:users:all"

  - name: user
    level: 10
    permissions:
      - "read:users:own"
      - "read:posts:all"
      - "write:posts:own"

endpoints:
  - path: "/api/users/{id}"
    object: users
    owner_field: id

See Configuration for the complete permission format.

Your First Scan

Step 1: Preview What Will Be Tested

Always start with a dry run:

hadrian test rest --api api.yaml --roles roles.yaml --auth auth.yaml --category all --dry-run

This shows which endpoints, templates, and role combinations will be tested — without sending any requests.

Step 2: Run the Scan

hadrian test rest --api api.yaml --roles roles.yaml --auth auth.yaml --category all --verbose

Step 3: Review Findings

Hadrian outputs findings with severity, endpoint, attacker/victim roles, and evidence:

[FINDING] API1:2023 - BOLA - Cross-User Resource Access
  Severity: HIGH
  Endpoint: GET /api/users/{id}
  Attacker: user -> Victim: admin
  Evidence: Status 200, body contains user data

Step 4: Export Report

# JSON for CI/CD integration
hadrian test rest --api api.yaml --roles roles.yaml --auth auth.yaml --category all \
  --output json --output-file report.json

# Markdown for human review
hadrian test rest --api api.yaml --roles roles.yaml --auth auth.yaml --category all \
  --output markdown --output-file report.md

What's Next?

Clone this wiki locally