Testing accounts
Supply account profiles and authentication policy, and distinguish agent registration from managed identity generation.
Testing accounts identify users of the target application. They are separate from your Straylabs API credential. Configure them when creating a project through projects.create, for either blackbox or greybox testing.
Supply named profiles
const project = await client.projects.create(organization.id, {
project_name: "role-boundary-assessment",
targets: ["https://app.customer.example"],
scope: "Authenticated workflows and boundaries between user roles.",
type: "grey-box",
testing_accounts: {
accounts: [
{
profile_name: "customer-user",
username: "user@customer.example",
password: userPassword,
role: "user",
origin: "user",
magic_link: null,
},
{
profile_name: "customer-admin",
username: "admin@customer.example",
password: adminPassword,
role: "admin",
origin: "user",
},
],
login_page: "https://app.customer.example/login",
refresh_page: null,
auth_policy: { allow_account_creation: false },
},
});userPassword and adminPassword are server-held test credentials. Use unique profile names for multiple accounts.
| Field | Wire behavior |
|---|---|
profile_name | Optional string or null; provide a unique label for each account |
username | Required nonempty string |
password | Required nonempty string, including when supplying a magic link |
role | Nonempty role description; server default "user" |
origin | "user" or "managed"; default "user"; marking an origin does not generate credentials |
magic_link | Optional string or null; use a fresh sign-in link when applicable |
login_page and refresh_page are optional shared configuration strings or null. The SDK exports TestingAccount, TestingAccountsConfig, TestingAccountOut, TestingAccountsConfigOut, and AuthPolicy types.
Permit account creation during testing
The authentication policy can authorize account creation by the agent:
const testingAccounts = {
accounts: [],
login_page: "https://app.customer.example/login",
refresh_page: null,
auth_policy: {
allow_account_creation: true,
max_accounts: 3,
email_wait_timeout_s: 120,
allow_resend: true,
paste_timeout_s: 600,
},
};
const project = await client.projects.create(organization.id, {
project_name: "signup-assessment",
targets: ["https://app.customer.example"],
scope: "Public signup and authenticated application flows.",
type: "black-box",
testing_accounts: testingAccounts,
});| Policy | Server default | Accepted value |
|---|---|---|
allow_account_creation | false | Boolean permission |
max_accounts | 3 | Integer from 0 to 20 |
email_wait_timeout_s | 120 | Integer from 10 to 900 seconds |
allow_resend | true | Boolean |
paste_timeout_s | 600 | Integer from 60 to 3600 seconds |
The SDK forwards this policy in project creation. A successful project response does not establish that the agent has generated or registered any account. The SDK does not perform target registration itself.
Managed identity generation is a separate operation
The supplied API export declares POST /organizations/{org_id}/projects/{project_id}/testing-accounts/managed. It accepts a profile name and optional role, creates or updates a platform-generated inbox/password identity, and returns the project.
That route declares session/JWT authentication, while this SDK configures API-key authentication. The SDK has no managed-account generation method and does not call that route when allow_account_creation is enabled. Generating credentials and registering an account at the target are separate actions.
Use the Platform's generated-account controls when that workflow is needed. Adding profiles to an existing project through the API-key SDK is also outside the current surface.
Strict blackbox preset
projects.createBlackbox always sends empty accounts and disables account creation. Passing testing_accounts to that helper is rejected. Use projects.create with type: "black-box" when explicitly supplying profiles or allowing agent registration.
Last updated