fix: default STATIC scan categories; fix target init scaffold schema - #298
Merged
cdot65 merged 3 commits intoAug 5, 2026
Merged
Conversation
scan: default to all categories when --categories omitted
airs redteam scan --target <uuid> --name foo (STATIC, no --categories)
sent job_metadata: {} to the API, which returned 422 with no useful error.
Fix: when jobType is STATIC and no categories are provided, fetch the full
category list and use all of them. This matches the intuitive expectation
that a bare scan command tests everything available.
targets init: fix scaffold to match current API schema
The scaffold generated by airs redteam targets init <provider> used a
legacy connection_params format (url, no response_key) that the API
now rejects. Multiple required top-level fields were also missing.
Changes:
- REST/HUGGING_FACE/STREAMING/WEBSOCKET: scaffold now uses
RestConnectionParamsBase fields (api_endpoint, request_headers,
response_key) with correct top-level connection_type, api_endpoint_type,
response_mode, auth_type, auth_config
- OPENAI/BEDROCK/DATABRICKS: scaffold uses target_connection_config inside
connection_params (NativeConnectionParamsBase)
- Add CUSTOM_TARGET_ADAPTER provider: scaffolds an AGENT target with
NETWORK_BROKER endpoint type, adapter_uuid, and adapter_variable_overrides
array (the correct array-not-dict shape the API expects)
- Add WEBSOCKET to valid providers list
- Remove stale target_metadata field from scaffold (not a create field)
Tests: update existing scaffold test; add four new cases covering REST
api_endpoint, HUGGING_FACE url promotion, CUSTOM_TARGET_ADAPTER structure,
and updated error message. All 870 tests pass.
Merged
2 tasks
# Conflicts: # docs-site/docs/developers/api/classes/SdkRedTeamService.md
Owner
|
Maintainer follow-up is complete on
Validation:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bugs found while building red-team scan automation against private EKS endpoints using the
CUSTOM_TARGET_ADAPTER+NETWORK_BROKERpattern. Both verified against the live API.Bug 1:
airs redteam scanfails with 422 when--categoriesis omittedRoot cause:
createScan()buildsjob_metadata: {}for STATIC scans when no categories are provided. The API rejects an empty object with a generic 422 — no useful error message, hard to debug.Fix: When
jobType === 'STATIC'and no categories are specified, fetch all available categories viagetCategories()and use them as the default.MULTI_TURNis excluded from defaults because it requiresmulti_turn_supported: trueon the target — most targets don't have it, and the API returns 400 if requested for an unsupported target.A bare
airs redteam scan --target <uuid> --name foonow works as expected.Bug 2:
airs redteam targets init <provider>generates stale schemaRoot cause: The scaffold embedded the raw
getTargetTemplates()response (url, noresponse_key) directly asconnection_params. The current API expectsRestConnectionParamsBasefields and requires several top-level fields that were missing. Generated JSON fails onPOST /v1/targetwithout manual correction.Fix:
RestConnectionParamsBasefields (api_endpointpromoted from templateurl,request_headers,response_key) with all required top-level fields (connection_type,api_endpoint_type,response_mode,auth_type,auth_config)NativeConnectionParamsBasewithtarget_connection_configCUSTOM_TARGET_ADAPTERprovider: scaffolds anAGENTtarget withNETWORK_BROKERendpoint type,adapter_uuidplaceholder, andadapter_variable_overridesas an empty array — the correct shape (a dict causes 422)WEBSOCKETto valid providers listtarget_metadatafield (not accepted on create)Test plan
redteam-init.spec.tsto assert new schema shapes; added 4 new casesairs redteam scan --target <uuid> --name test --no-wait(STATIC, no --categories) → scan QUEUED, not 422airs redteam targets init REST→api_endpoint,response_key, correctauth_configshapeairs redteam targets init CUSTOM_TARGET_ADAPTER→AGENTtype,NETWORK_BROKER,adapter_variable_overrides: []🤖 Generated with Claude Code