본문으로 건너뛰기
Skillpedia
테스트8.0k · #12738

vector-forge

하는 일

암호 알고리즘의 구현을 찾고, 뮤테이션 테스트로 테스트되지 않은 코드 경로를 알아낸 다음, 그 공백을 겨냥한 새 테스트 벡터를 씁니다. 암호 코드를 테스트하는 팀을 위한 것입니다.

사용하는 경우

  • ✓암호 알고리즘이나 프로토콜의 테스트 벡터를 만들고 싶을 때.
  • ✓기존 암호 테스트가 코드를 얼마나 커버하는지 알고 싶을 때.
  • ✓테스트 벡터를 추가하기 전과 후의 뮤테이션 킬 비율을 비교하고 싶은 경우.

스킬 링크

https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/vector-forge/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/vector-forge/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 암호 라이브러리의 테스트 벡터에서 공백을 찾고, 아무도 테스트하지 않는 코드 경로를 위한 새 벡터를 써 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 뮤테이션 테스트로 현재 테스트가 놓치는 코드 변경을 찾고, 그 지점을 겨냥한 새 테스트 벡터를 쓰며, 전후 결과를 비교합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Vector Forge

Uses mutation testing to systematically identify gaps in test vector coverage, then generates new test vectors that close those gaps. Measures effectiveness by comparing mutation kill rates before and after.

When to Use

  • Generating test vectors for cryptographic algorithms or protocols
  • Evaluating how well existing test vectors cover an implementation
  • Finding implementation code paths that no test vector exercises
  • Creating Wycheproof-style cross-implementation test vectors
  • Measuring the concrete coverage value of a test vector suite

When NOT to Use

  • No implementations exist yet (need code to mutate)
  • Single trivial implementation with no edge cases
  • Testing application logic rather than algorithm implementations
  • The algorithm has no public test vectors to compare against

Prerequisites

  • trailmark installed — if uv run trailmark fails, run:
    uv tool install trailmark
    

Python snippets: uv run --with trailmark python - (a tool env is not importable)

- At least one implementation of the target algorithm in a
language with mutation testing support
- A test harness that consumes test vectors and exercises
the implementation
- A mutation testing framework for the target language

---

## Rationalizations to Reject

| Rationalization | Why It's Wrong | Required Action |
|-----------------|----------------|-----------------|
| "We have enough test vectors" | Mutation testing proves otherwise | Run the baseline first |
| "The implementation's own tests are sufficient" | Own tests often share blind spots with the impl | Cross-impl vectors catch different bugs |
| "FFI crates can be mutation tested at the binding layer" | Mutations to wrappers don't affect the underlying impl | Mutate the actual implementation language |
| "Timeouts mean the mutation was caught" | Timeouts are ambiguous — could be killed or alive | Resolve timeouts before drawing conclusions |
| "All mutants are equivalent" | Most aren't — verify by reading the mutation | Classify each escaped mutant individually |
| "Checking valid vectors is enough" | Permissive mutations survive without negative assertions | Assert rejection for every invalid vector |
| "Manual analysis is fine" | Manual analysis misses what tooling catches | Install and run the tools |

---

## Workflow Overview

Phase 1: Discovery → Find implementations to test ↓ Phase 2: Harness → Write/adapt test vector harness for each impl ↓ Phase 3: Baseline → Run mutation testing with existing vectors ↓ Phase 4: Escape Analysis → Classify escaped mutants by code path ↓ Phase 5: Vector Gen → Create test vectors targeting escapes ↓ Phase 6: Validation → Re-run mutation testing, compare before/after ↓ Output: Coverage Report + New Test Vectors


---

## Phase 1: Discovery

Find implementations of the target algorithm. Look for:

1. **Pure implementations** in high-level languages (Go, Rust, Python)
   — these are the best mutation testing targets
2. **FFI wrapper crates** — identify these early so you don't waste
   time mutating wrapper glue code
3. **Reference implementations** — useful for cross-verification but
   may not be the best mutation targets

For each implementation, note:
- Language and mutation testing framework
- Whether it's pure code or FFI wrappers
- Existing test suite size and coverage
- Which API surface the test vectors will exercise

### Implementation Type Classification

| Type | Mutation Value | Example |
|------|---------------|---------|
| Pure implementation | High | zkcrypto/bls12_381 (Rust), gnark-crypto (Go) |
| FFI bindings to C/asm | Low at binding layer | blst Rust crate |
| C/C++ implementation | High (use Mull) | blst C library |
| Generated code | Medium (mutations may be equivalent) | gnark-crypto generated field arithmetic |

**Key insight:** If an implementation delegates to another language
via FFI, you must mutate the *underlying* implementation, not the
bindings. For C/C++ underneath Rust/Go/Python, use Mull or similar.

---

## Phase 2: Harness

For each implementation, create a test harness that:

1. Reads test vectors from JSON files (Wycheproof format recommended)
2. Exercises the implementation's API for each vector
3. Asserts **both acceptance and rejection**:
   - Valid vectors: deserialization succeeds, output matches expected
   - Invalid vectors: deserialization fails or verification rejects
4. Adds **rou
자주 묻는 질문

기존 테스트 벡터가 필요한가요?

알고리즘에 비교할 공개 테스트 벡터가 있을 때 가장 잘 작동하며, 그것을 쓰는 테스트 하네스가 필요하다고 설명합니다.

시작하기 전에 무엇이 필요한가요?

뮤테이션 테스트를 지원하는 언어의 구현 하나, 테스트 하네스, 뮤테이션 테스트 프레임워크가 필요합니다.

언제 건너뛰어야 하나요?

뮤테이션할 구현이 없을 때나, 코드가 알고리즘이 아니라 애플리케이션 로직일 때입니다.

상세 정보

작성자의 원본 설명

Mutation-driven test vector generation. Finds implementations of a cryptographic algorithm or protocol, runs mutation testing to identify escaped mutants, then generates new test vectors that deliberately exercise the uncovered code paths. Compares before/after mutation kill rates to prove vector effectiveness. Use when generating cryptographic test vectors, measuring Wycheproof coverage gaps, finding escaped mutants via mutation testing, creating cross-implementation test suites, or improving test vector coverage for crypto primitives.

repo: trailofbits/skills

인기도

GitHub 스타
8.0k
순위
#12738
라이선스
CC-BY-SA-4.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬