agentleFS
hahwulhahwul/jwt-hack/AGENTS.md

jwt-hack

AGENTS.md1.1k starsChanged 2 days agoMITView on GitHub

JWT-HACK is a high-performance Rust-based JSON Web Token security testing toolkit. It provides JWT encoding, decoding, verification, cracking, and attack payload generation capabilities. Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.

  • Pipes a download into a shell
  • Installs packages

Trending

Quiet since June.about the whole repository

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 1 mentionApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 2 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the hahwul/jwt-hack repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about hahwul/jwt-hack

The biggest 5 of 17 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 17

Talked about on GitHub (17 times).

On GitHub · 17

12 more on GitHub
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

21 rules. About 0 are common, 9 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does …

    line 5
  2. Very specific:

    Run full test suite: just test -- takes 17 seconds.

    line 29
  3. Very specific:

    Run performance benchmarks (criterion): just bench or cargo bench

    line 37
  4. Very specific:

    Run a fuzz target (requires nightly + cargo install cargo-fuzz):

    line 40
  5. Very specific:

    Always run these before committing changes or the CI (.github/workflows/ci.yml) will fail:

    line 92
  6. Very specific:

    Create new module in src/cmd/

    line 134
  7. Very specific:

    Add command struct with clap derives

    line 135
  8. Very specific:

    Add to src/cmd/mod.rs and main command enum

    line 137
  9. Distinctive:

    Add comprehensive unit tests

    line 138
  10. Distinctive:

    Always add tests for new algorithms or validation logic

    line 144
  11. Distinctive:

    Test with various JWT formats and edge cases

    line 145
  12. Very specific:

    Dependency resolution errors: Delete Cargo.lock and rebuild

    line 157
  13. Distinctive:

    Compilation errors: Ensure using latest stable Rust version

    line 158
  14. Very specific:

    Clippy warnings: Run cargo clippy --fix --allow-dirty then manually review changes

    line 161
  15. Very specific:

    Format failures: Run cargo fmt to auto-fix formatting

    line 162
  16. Very specific:

    Unit test failures: Check if tests depend on specific sample data in samples/

    line 163
  17. Distinctive:

    JWT parsing errors: Verify JWT format (header.payload.signature structure)

    line 166
  18. Distinctive:

    Missing wordlist files: Use relative paths from project root or absolute paths

    line 167
  19. Distinctive:

    Performance issues: Use release build for large-scale operations

    line 168
  20. Distinctive:

    All CI checks must pass before merging.

    line 184
  21. Very specific:

    Test files: src//*test*.rs or #[cfg(test)] modules

    line 214

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

JWT-HACK Development Instructions

JWT-HACK is a high-performance Rust-based JSON Web Token security testing toolkit. It provides JWT encoding, decoding, verification, cracking, and attack payload generation capabilities.

Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.

Working Effectively

Prerequisites and Setup

  • Install Rust and Cargo (latest stable version recommended):
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source ~/.cargo/env
  • Install Just task runner:
    cargo install just

Build Commands

  • CRITICAL: Set timeouts to 120+ seconds for all build commands. NEVER CANCEL builds.
  • Development build: just dev or cargo build -- takes 75 seconds on first build with dependencies, 18 seconds on subsequent builds. NEVER CANCEL. Set timeout to 120+ seconds.
  • Release build: just build or cargo build --release -- takes 47 seconds. NEVER CANCEL. Set timeout to 90+ seconds.
  • Quick check (no build): cargo check -- takes 15 seconds. Good for fast compilation verification.
  • Clean build: cargo clean followed by build commands.
  • Quick recompile after changes: cargo build -- takes 3-5 seconds for incremental builds.

Testing

  • Run full test suite: just test -- takes 17 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
  • This runs: cargo test, cargo clippy, cargo fmt --check, and cargo doc
  • Unit tests only: cargo test -- takes 3-5 seconds.
  • Lint only: cargo clippy -- --deny warnings
  • Format check: cargo fmt --check
  • Format code: just fix or cargo fmt

Benchmarks and Fuzzing

  • Run performance benchmarks (criterion): just bench or cargo bench
    • Covers encode, decode, verify, and cracking (dictionary + brute force).
    • CI tracks results against a baseline via .github/workflows/benchmarks.yml.
  • Run a fuzz target (requires nightly + cargo install cargo-fuzz):
    • just fuzz jwt_decode (or jwe_decode, header_parsing)
    • cargo +nightly fuzz run <target> -- -max_total_time=60
    • Fuzz targets live in fuzz/fuzz_targets/; scheduled/manual CI is in .github/workflows/fuzz.yml.

Development Tasks

  • List available Just commands: just --list
  • Format and fix linting: just fix
  • Build documentation: cargo doc --workspace --all-features --no-deps --document-private-items

Validation Scenarios

CRITICAL: Always run these validation steps after making changes:

  1. Build and Test Validation:
    just dev && just test
  2. Core Functionality Testing:
    # Test decoding (should display header/payload breakdown with algorithm and timestamps)
    ./target/debug/jwt-hack decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.5mhBHqs5_DTLdINd9p5m7ZJ6XD0Xc55kIaCRY5r6HRA
    
    # Test encoding (should create valid JWT with spinner animation)
    ./target/debug/jwt-hack encode '{"sub":"1234", "name":"test"}' --secret=mysecret
    
    # Test verification (should show validation result)
    ./target/debug/jwt-hack verify eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.5mhBHqs5_DTLdINd9p5m7ZJ6XD0Xc55kIaCRY5r6HRA --secret=test
    
    # Test dictionary cracking (should process 16 words with progress bar)
    ./target/debug/jwt-hack crack -w samples/wordlist.txt eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0In0.CHANGED
    
    # Test brute force cracking (should generate combinations with progress)
    ./target/debug/jwt-hack crack -m brute eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0In0.CHANGED --max=2
    
    # Test payload generation (should create none algorithm attack payloads)
    ./target/debug/jwt-hack payload eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0In0.CHANGED --target none
    
    # Test all payload types (should generate multiple attack vectors)
    ./target/debug/jwt-hack payload eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0In0.CHANGED --jwk-attack example.com
  3. Help System Validation:
    # Verify help displays correctly with banner
    ./target/debug/jwt-hack --help
    ./target/debug/jwt-hack decode --help
    ./target/debug/jwt-hack encode --help

Pre-commit Validation

Always run these before committing changes or the CI (.github/workflows/ci.yml) will fail:

cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test

Project Structure

Key Directories and Files

├── src/
│   ├── main.rs              # Application entry point
│   ├── cmd/                 # Command implementations
│   │   ├── decode.rs        # JWT decoding functionality
│   │   ├── encode.rs        # JWT encoding functionality
│   │   ├── verify.rs        # JWT verification functionality
│   │   ├── crack.rs         # JWT cracking (dict/brute force)
│   │   ├── payload.rs       # Attack payload generation
│   │   └── version.rs       # Version display
│   ├── jwt/                 # Core JWT operations
│   ├── crack/               # Cracking algorithms and utilities
│   ├── payload/             # Payload generation logic
│   ├── printing/            # Output formatting and logging
│   └── utils/               # Shared utilities
├── samples/                 # Test data
│   ├── jwt.txt             # Sample JWT token
│   └── wordlist.txt        # Sample wordlist for cracking
├── Cargo.toml              # Rust project configuration
├── justfile                # Task automation scripts
├── Dockerfile              # Container build definition
└── .github/workflows/      # CI/CD pipelines

Configuration Files

  • Cargo.toml: Dependencies, build configuration, binary definition
  • justfile: Task automation (build, test, dev, fix commands)
  • .github/workflows/ci.yml: CI pipeline (builds on Ubuntu/macOS/Windows)

Common Development Patterns

Adding New Commands

  1. Create new module in src/cmd/
  2. Add command struct with clap derives
  3. Implement execute function
  4. Add to src/cmd/mod.rs and main command enum
  5. Add comprehensive unit tests
  6. Update help documentation

Modifying JWT Operations

  • Core JWT logic is in src/jwt/
  • Uses jsonwebtoken crate for cryptographic operations
  • Always add tests for new algorithms or validation logic
  • Test with various JWT formats and edge cases

Performance Considerations

  • Uses rayon for parallel processing in cracking operations
  • Uses indicatif for progress bars on long-running operations
  • Built with release optimizations: LTO, single codegen unit, stripped binaries

Troubleshooting

Build Issues

  • "cargo command not found": Install Rust toolchain with rustup
  • "just command not found": Install with cargo install just
  • Dependency resolution errors: Delete Cargo.lock and rebuild
  • Compilation errors: Ensure using latest stable Rust version

Test Failures

  • Clippy warnings: Run cargo clippy --fix --allow-dirty then manually review changes
  • Format failures: Run cargo fmt to auto-fix formatting
  • Unit test failures: Check if tests depend on specific sample data in samples/

Runtime Issues

  • JWT parsing errors: Verify JWT format (header.payload.signature structure)
  • Missing wordlist files: Use relative paths from project root or absolute paths
  • Performance issues: Use release build for large-scale operations

Docker Build (Note: May fail in restricted environments)

# Docker build may fail due to network restrictions in sandboxed environments
docker build -t jwt-hack .
# If build fails, use local cargo builds instead

CI/CD Information

The project uses GitHub Actions with the following jobs:

  • Build & Test: Runs on Ubuntu, macOS, Windows with stable Rust
  • Lint: Runs cargo fmt --check and cargo clippy with strict warnings
  • Coverage: Generates code coverage reports using cargo-llvm-cov

All CI checks must pass before merging. The pipeline takes approximately 5-10 minutes to complete.

Quick Reference

Most Common Commands

# Development workflow
just dev                    # Build for development (75s first build, 18s subsequent, timeout 120s)
just test                   # Run all tests (17s, timeout 60s)
just fix                    # Format and fix linting

# Manual commands
cargo check                 # Fast compilation check (15s, timeout 30s)
cargo build                 # Development build
cargo build --release      # Production build (47s, timeout 90s)
cargo test                  # Unit tests only
cargo clippy               # Linting
cargo fmt                  # Code formatting

# Application testing
./target/debug/jwt-hack --help                    # Show help with banner
./target/debug/jwt-hack decode TOKEN              # Decode JWT (shows header/payload)
./target/debug/jwt-hack encode JSON --secret=KEY  # Encode JWT (creates new token)
./target/debug/jwt-hack verify TOKEN --secret=KEY # Verify JWT signature
./target/debug/jwt-hack crack -w FILE TOKEN       # Crack JWT with wordlist
./target/debug/jwt-hack crack -m brute TOKEN --max=N  # Brute force crack
./target/debug/jwt-hack payload TOKEN --target=TYPE   # Generate attack payloads

File Patterns to Know

  • Test files: src/**/*test*.rs or #[cfg(test)] modules
  • Sample data: samples/*.txt
  • Build artifacts: target/ (excluded from git)
  • Binary location: target/debug/jwt-hack or target/release/jwt-hack

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.