A Study on the Quality of LLM-Generated Authorization Tests for Microservices
Authors/Creators
Description
Overview
This replication package accompanies the paper "AI-Powered Authorization Testing for Microservices" submitted to AITest 2025. It provides all artifacts required to fully reproduce the experimental evaluation: source code, pre-indexed microservice data, experimental results, and step-by-step execution instructions.
The research addresses the authorization blindspot in microservice testing — the inability of traditional automated tools to detect policy inconsistencies between upstream and downstream services. The framework uses policy-enriched intermediate representations to guide LLM test generation, achieving 100% semantic validity and 92–100% authorization verification, significantly outperforming EvoMaster and EvoSuite baselines.
Package Contents
| Archive | Description | Size |
|---|---|---|
Cimet Extract Lib Extended.zip |
Java-based static analysis tool extracting REST endpoints, authorization policies, and control flow graphs from microservice source code. | ~500 KB |
AITest Scripts.zip |
Python/TypeScript pipeline scripts for Auth Vector Generation, Scenario Generation, and LLM-based Test Generation and Execution. | ~50 MB |
microservice-index.zip |
Pre-computed pipeline output for both benchmark systems across baseline and mutation versions. | ~100 MB |
train-ticket-aitest.zip |
Train-Ticket benchmark (40+ microservices) with injected authorization inconsistency mutations — primary evaluation subject. | ~355 MB |
YAS-aitest.zip |
YAS (Yet Another Shop) e-commerce microservice benchmark — secondary evaluation subject. | ~31 MB |
Experiment Planning.xlsx / .ods |
Experimental design spreadsheet: test scenarios, raw results, metrics, and analysis. | ~295 KB / ~126 KB |
Directory Structure
cimet-extract-lib-extended/
The CIMET static analysis tool. Run via Maven to index a target microservice repository.
cimet-extract-lib-extended/
├── config.json # Target system configuration (repo URL, branch, role hierarchy)
├── pom.xml # Maven build file
├── src/main/java/.../
│ ├── common/ # Shared utilities and models
│ ├── delta/ # Change impact analysis
│ └── intermediate/
│ ├── create/ # IR extraction logic
│ └── index/ # Endpoint and component indexing (IndexerRunner entry point)
└── output/
├── endpoints.json # All REST endpoints with authorization metadata
└── components.json # All components with control flow graphs and remote call resolution
aitest-scripts/
The main pipeline. Three shell scripts drive the full workflow sequentially.
aitest-scripts/
├── 01_run_auth_vector_generator.sh # Step 1: Generate role-based permission matrices
├── 02_run_scenario_generator.sh # Step 2: Generate LLM-ready test scenarios
├── 03_run_auth_test_generator.sh # Step 3: Generate and execute tests via LLM
├── requirements.txt # Python dependencies
├── .env.example # Environment template (API keys, base URL, credentials)
├── input/
│ ├── components.json # Copied from CIMET output
│ └── endpoints.json # Copied from CIMET output
├── output/
│ ├── auth_vectors/
│ │ └── all_vectors.json # Role-permission matrices per endpoint
│ └── llm-scenarios/
│ └── scenarios_llm_ready.json # Structured scenarios ready for LLM prompting
├── auth-role-vector-generator/ # Module: call chain analysis and matrix generation
├── test-scenario-generator/
│ ├── scenario_generator.py # Generates scenarios from auth vectors
│ └── prompt_generator.py # Builds LLM prompt context per scenario
└── auth-test-generator/
├── src/index.ts # CLI entry point
├── src/generator/ # LLM test generation logic
├── src/executor/ # Test execution against live services
├── src/llm/ # LLM provider integration (OpenAI / Anthropic)
└── output/
├── generated-tests/ # LLM-generated HTTP request specifications
├── execution-results/ # Actual execution results (status, body, pass/fail)
├── cost-reports/ # Token usage and cost per scenario
├── curl-commands/ # Equivalent curl scripts for manual debugging
└── llm-debug/ # Full LLM prompt and response per scenario
microservice-index/
Pre-computed pipeline output. Use this to inspect results without re-running the full pipeline.
microservice-index/
├── train-ticket-aitest/
│ ├── master/ # Baseline (correct policies)
│ │ ├── components.json # CIMET component metadata
│ │ ├── endpoints.json # CIMET endpoint index
│ │ ├── all_vectors.json # Role permission matrices
│ │ ├── scenarios_llm_ready.json # LLM-ready test scenarios
│ │ └── output/
│ │ ├── generated-tests/ # scn_<service>_<id>.json per scenario
│ │ ├── execution-results/ # scn_<service>_<id>.json per scenario
│ │ ├── cost-reports/ # Token usage and cost per scenario
│ │ ├── curl-commands/ # scn_<service>_<id>.sh per scenario
│ │ ├── llm-debug/ # Full prompt/response debug per scenario
│ │ └── metrics-summary.json # Aggregated pass rate, detection rate, costs
│ ├── first-inconsistency-injection/ # Mutation #1 (same structure as master)
│ └── second-inconsistency-injection/ # Mutation #2 (same structure as master)
└── yas/
├── main/ # Baseline (same structure as train-ticket master)
├── first-injection/ # Mutation #1
└── second-injection/ # Mutation #2
Methodology
The framework is a four-phase pipeline from microservice source code to executable authorization tests:
- Static Analysis (CIMET): Extracts REST endpoints, authorization metadata, and control flow graphs from Java Spring Boot microservices.
- Auth Vector Generation: Computes role-based permission matrices across service call chains, surfacing cross-service authorization inconsistencies.
- Scenario Generation: Applies four prompt template strategies to produce LLM-ready test scenarios with role expectations, sensitivity classification, and data awareness requirements.
- LLM Test Generation and Execution: Submits enriched scenarios to GPT-4 or Claude Sonnet to generate executable HTTP tests, then runs them against a live microservice deployment.
Subject Systems
| System | Version | Description |
|---|---|---|
| Train-Ticket | master | Baseline with correct authorization policies. |
| Train-Ticket | first-inconsistency-injection | Mutation #1: OverPermissive inconsistency injected into a service chain. |
| Train-Ticket | second-inconsistency-injection | Mutation #2: UnderPermissive inconsistency injected into a separate service chain. |
| YAS | main | Baseline with correct authorization policies. |
| YAS | first-injection | Mutation #1: Authorization inconsistency injected. |
| YAS | second-injection | Mutation #2: Second authorization inconsistency variant. |
Prerequisites
- CIMET Indexer: Java 24+, Maven 3.6+
- Pipeline Scripts: Python 3.9+, Node.js 18+
- LLM Access: OpenAI API key (GPT-4) or Anthropic API key (Claude Sonnet)
- Live Service: Running instance of the target microservice system (e.g., Train-Ticket on localhost:8888)
Researchers who wish to inspect results without re-running the full pipeline can use the pre-computed data in microservice-index.zip.
For detailed step-by-step instructions on running each phase of the pipeline — including build commands, configuration parameters, available CLI options, and troubleshooting — refer to the included
README.mdfile.
Key Findings
| Metric | LLM Framework | EvoMaster / EvoSuite |
|---|---|---|
| Semantic Validity | 100% | <5% |
| Authorization Verification Rate | 92–100% | Not achieved |
| Status Code Range Matching (401/403) | 86–92% | N/A |
| Cost per Complete Run | <$0.06 USD | N/A |
| OverPermissive / UnderPermissive Detection | Confirmed across both mutations | Not detected |
A notable finding is the 401 vs. 403 distinction: LLMs correctly determine the authorization outcome (allow/deny) but exact status code matching is 32–42% due to implementation-specific server behaviour. Range-based matching for the authorization decision reaches 86–92%.
License
Provided for research and reproducibility purposes. Benchmark systems (Train-Ticket, YAS) retain their original open-source licenses. See individual component licenses for specific terms.
Files
AITest Scripts.zip
Files
(538.2 MB)
| Name | Size | |
|---|---|---|
|
md5:5cc65ff3d58aee46eb05298f91fdb4a0
|
50.4 MB | Preview Download |
|
md5:b9220295261949c7a058e446dea1e650
|
126.0 kB | Download |
|
md5:4e120fabc8522197cbfb24a9db793e30
|
295.1 kB | Download |
|
md5:96c480f8fb774630d394745784e8f5a0
|
100.1 MB | Preview Download |
|
md5:84d7662865eb96fa16c4b0c0e45ab269
|
24.1 kB | Preview Download |
|
md5:bc4cd0f4f318bd794106892b4f258f99
|
355.6 MB | Preview Download |
|
md5:58ead56a23509e11255fd659897f61ee
|
31.7 MB | Preview Download |
Additional details
Software
- Programming language
- Java , Python , JavaScript , TypeScript