Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AISecurityLab Hackagent BoNParams

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Configuration
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete pydantic configuration model for the Best-of-N attack specifying search steps, candidates per step, augmentation strength (sigma), and per-augmentation toggles, provided by the HackAgent adaptive attacks package.

Description

BoNParams extends AttackParams with fields: steps (sequential search steps), candidates (independently seeded perturbations per step), sigma (augmentation strength 0-1), and three boolean toggles (word_scrambling, random_capitalization, ascii_perturbation). No attacker role is needed — BoN perturbs the goal directly. The panel decides success, so there is no threshold field.

Usage

  • Campaign config: Set in the attacks entry of a campaign YAML.

Code Reference

Source Location

Signature

class BoNParams(AttackParams):
    steps: int = Field(default=4, ge=1)
    candidates: int = Field(default=5, ge=1)
    sigma: float = Field(default=0.4, gt=0.0, le=1.0)
    word_scrambling: bool = Field(default=True)
    random_capitalization: bool = Field(default=True)
    ascii_perturbation: bool = Field(default=True)

Import

from hackagent.attacks.techniques.adaptive.bon.config import BoNParams

I/O Contract

Inputs

Name Type Required Description
steps int No Search steps (default 4)
candidates int No Candidates per step (default 5)
sigma float No Augmentation strength 0-1 (default 0.4)

Outputs

Name Type Description
return BoNParams Validated config for BoNAttack

Usage Examples

Define in Campaign YAML

# attacks:
#   - name: bon
#     steps: 6
#     candidates: 10
#     sigma: 0.5
#     ascii_perturbation: false

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment