Why promptfoo BOLA and BFLA testing matters for agent authorization
When an agent has tool access, it acts on behalf of a user, so an authorization failure appears as data or functions the user should never reach. A support assistant that can look up orders, or an internal agent that can call administrative tools, may answer correctly to the prompt while quietly returning another customer's record or invoking an action above the user's role. Standard API tests rarely catch this because the failure lives in the agent's tool choices and arguments, not in a single endpoint. The promptfoo BOLA and BFLA plugins target exactly this gap: broken object level authorization (BOLA, OWASP API1) and broken function level authorization (BFLA, OWASP API5). BOLA asks whether the agent fetches records belonging to other users when it is given an identifier it should not own. BFLA asks whether the agent calls functions reserved for a higher role, such as an admin or refund action, when a lower-privileged user asks for it. Both plugins are remote-only and need promptfoo hosted generation to create their test cases, so the team must confirm before work starts that sending these prompts to hosted generation is acceptable under its data handling rules. The promptfoo OWASP API Security documentation sets out how these categories map to the plugins.
A team should run this test before rollout whenever an agent can read or change data tied to individual users, tenants or accounts, and whenever tools carry different privilege levels. Examples include a banking assistant that reads balances, a healthcare scheduler that touches patient records, or an internal agent that can open tickets and also approve changes. The test also belongs before any change to tool schemas, role mappings or identity provider groups, because those changes often move the boundary without anyone noticing. Before running it, the reader needs test identities with distinct roles and documented ownership of sample records, so that each result can be read as a pass or fail against a known expected outcome. Results should be mapped to the agentic risk of identity and privilege abuse, ASI03 in the OWASP Top 10 for Agentic Applications for 2026, so that findings reach the same owners as other agent risks and are tracked to a fix. A clean run is evidence only for the roles, tools and data sets that were actually tested, so the scope of the test should be written down with the results.
Configuration options and when each fits
This table compares the main configuration choices for a BOLA or BFLA test: target purpose, plugin, number and roles of test identities, and hosted or local generation. Read each row against your agent's access model, and treat the generation row as a data decision that needs sign-off before the first run.
| Decision | Option | Trade-off | When it fits |
|---|---|---|---|
| Target purpose | Single-user assistant that reads one customer's records | Few cross-record paths to probe, so BOLA tests are narrow but quick to write | Early pilots where you need a first signal on object ownership checks |
| Target purpose | Multi-tenant agent with tools that query accounts, orders or cases | Many object IDs and tool paths to cover, so test cases and runtime grow | Agents that serve several customers or business units from shared tools |
| Plugin choice | BOLA plugin | Tests whether the agent reaches objects owned by another identity by changing identifiers | Agents that accept record IDs from the user or from documents |
| Plugin choice | BFLA plugin | Tests whether the agent invokes functions above the caller's role, such as admin or export tools | Agents that expose tools with different privilege levels behind one interface |
| Plugin choice | Both plugins in one run | Broader coverage but more results to triage against two OWASP API categories | Mature test suites where ownership and role checks are both in scope |
| Test identities | Two identities of the same role | Confirms record isolation between peers, but misses role escalation | Checking that one user cannot read another user's records |
| Test identities | Standard user plus elevated role identity | Lets you test function-level restrictions, and requires a stable admin test account | Checking whether a standard role can trigger restricted tools |
| Test identities | Dedicated test tenant with seeded records | Clean, repeatable results, but needs setup and cleanup for each run | CI runs and audit evidence where results must be reproducible |
| Generation | Hosted generation by promptfoo | Requires promptfoo hosted generation, which sends test content and target context to promptfoo | Only when your data owner has approved that data leaving your environment |
| Generation | Local or other generation approved by your team | Keeps test data inside your controls, but the plugin itself is remote-only, so confirm availability before planning around it | Regulated environments where sending application data to a third party is not permitted |
Set up test identities and run the BOLA and BFLA scans
This sequence takes a tool-using agent from a clean promptfoo install to a reviewed set of BOLA and BFLA findings, with test identities that make cross-user and cross-role access attempts measurable. Each step ends with a check so that a failed setup is caught before results are trusted.
Install promptfoo on a supported Node.js runtime
The engineer running the scan installs promptfoo from npm on a workstation or CI runner with Node.js 22.22.0 or newer, which is the requirement stated for the 0.124.1 npm release. Pin the promptfoo version in the project so later runs use the same plugin behavior. Confirm the install by running the promptfoo version command and checking that it reports the pinned version, then record the Node.js version alongside the scan report.
Define the target agent and its tools
Write down every tool the agent can call, the backend API each tool reaches, and the identifiers those calls accept, such as record IDs, account numbers or function names. Note which tools the agent should only expose to certain roles. Configure promptfoo to reach the agent through a provider, using an HTTP or Python endpoint for your own application. Check the setup by sending one ordinary request through the provider and confirming that the response and any tool calls appear in the output.
Create two low-privilege test identities and one higher-privilege role
Create at least two standard user accounts in a test environment, each owning separate records that the other must not reach, and one account with a higher role such as an administrator or support agent. Keep the credentials and session tokens for each identity in your secret store, not in the promptfoo config. Check that each identity can log in, that it sees only its own records through the agent, and that the higher-privilege role can call the administrative function, so the baseline is known before any attack runs.
Map identities and records into the test configuration
Add the two user identities and the higher role to the promptfoo configuration as separate test contexts, with each user's own record identifiers and the identifiers that belong to the other user as test variables. Use environment variables for tokens. Write one expected-behavior test for each identity that the agent should refuse to serve cross-user data. Confirm the configuration loads with a dry run and that each test lists the identity and the record it targets.
Enable the BOLA and BFLA plugins
Add the BOLA plugin, which targets broken object level authorization (the OWASP API1 risk), and the BFLA plugin, which targets broken function level authorization (the OWASP API5 risk), to the red team section of the configuration. Both are remote-only plugins that rely on promptfoo hosted generation, so confirm with promptfoo and your data handling owner what leaves your environment before enabling them. Check the generated test count in the dry run and confirm both plugins appear in the plan.
Run the scan and capture the traces
Run the red team scan against the agent with the two user identities and the higher role configured. Save the output report and the traces for every tool call, since the traces show which record identifiers and functions the agent actually requested. Check that the run completed for all identities and that the report lists results per plugin rather than a single aggregate score.
Verify and read the results against OWASP API Security
Review each failure by comparing the tool call in the trace with the identity that made the request. A BOLA finding means a lower-privilege identity retrieved another user's record. A BFLA finding means a lower-privilege identity invoked a function reserved for a higher role. Map each finding to the OWASP API1 or API5 entry, then rerun the failing cases after a fix to confirm the agent refuses them. Record which results are confirmed, which are false positives, and which need a manual test.
How a test identity travels through the agent and back to the grader
The test starts with a generated attack for a specific test user, sent to the agent under test as that user's session. The agent calls its tools or APIs, and the backend performs object-level and function-level checks against that user's role. The response and tool-call trace then return to the grader, which decides whether the agent fetched a record or ran a function the test user should not reach. The hosted red team generator sits inside a boundary: the attack plan and test context that leave for hosted generation are the data to review before a scan runs.
Test identity flow from hosted attack generation through the agent and backend to grading.
Reading BOLA and BFLA results against OWASP API Security
A failed BOLA or BFLA case only becomes a finding once you can name the OWASP API risk it demonstrates. Map BOLA results to OWASP API1, broken object level authorization, and BFLA results to OWASP API5, broken function level authorization. A BOLA failure means the agent returned or changed a record that belongs to another identity, such as a customer record, ticket or document, when the test identity only had access to its own. A BFLA failure means the agent invoked a function, such as an admin-only export, role change or refund tool, that sits above the role of the identity it was acting for. Check the test's intended object or function against what the agent actually touched. The OWASP API Security Top 10 page in the promptfoo docs lists how the plugins are grouped, and it is the right reference when you write the mapping into your report.
Not every failed grade is an authorization failure. A refusal, a generic apology or a message that says the agent cannot access the record is a pass, even if the grader flagged it. A hallucinated answer is different: the agent may state that it looked up another user's order and invent the details. Treat that as a finding only if the trace shows a tool call that could have reached the data, and as a grading problem if no call was made. Compare the response text with the tool calls and the returned payloads. If the content matches a record the test identity cannot read in your system of record, the failure is real. Confirm the exact grading rubric promptfoo applies in your version, because that determines which of these outcomes is recorded as a failure.
Keep enough evidence to reproduce and defend each finding. Store the trace for each case, the identity and role used for the session, the exact tool calls with arguments, the tool responses and the final answer. Record the user IDs and object IDs involved, and whether they belong to the test identity. Save the configuration version and the promptfoo version used, so a retest can be compared against the same setup. Ask the team that owns the authorization layer to confirm the expected permission for each identity before the run, because a result is only meaningful against a documented expectation. Where the agent calls a backend API, check the API's own logs for the same request, since the agent's trace shows what it attempted and the backend log shows what was actually allowed.
Security and operational considerations for authorization tests
Authorization tests create users, requests and scan output that can touch real data and third-party services. The cards below cover the decisions that keep the test identities isolated, the data flow visible, and the results protected. Review them before the first scan, not after.
Isolate test identities and data
Create dedicated test accounts with their own tenants, records and roles, and make sure no test account can reach production records through shared groups or default permissions. Seed the records they will try to reach, so a failed fetch means the control worked and not that the data was missing. Plan to delete or reset this data after each run. Ask the application owner to confirm in writing which systems the identities can touch, because an agent with a broad tool set can reach more than the chatbot UI shows.
Map the hosted generation data flow
The BOLA and BFLA plugins need promptfoo hosted generation, so prompts and responses from your test run leave your environment for that service. Before the first run, ask which fields in your records, tool outputs and identities would appear in generated payloads, and whether any of them are regulated. Confirm the handling terms with your security and privacy teams, and document the answer as part of the test record.
Data handling docsKeep tests away from production records
Run authorization scans against a staging or test deployment that mirrors the production authorization model, not against live customer data. An agent that can call write or delete tools can change records during a test, so restrict those tools in the test environment or use sandbox accounts for them. Ask the team to confirm that backups and audit logs for that environment are separate from production before you start.
Store test credentials securely
Test identities carry real tokens, session cookies or API keys, and these belong in a secrets manager, not in the promptfoo configuration file that gets committed to a repository. Use short-lived tokens where the identity provider supports them, and rotate the test credentials after each engagement. Confirm that the MCP or tool layer does not forward tokens to other services, since the MCP authorization specification forbids token passthrough.
Schedule scans and respect rate limits
Authorization probes send many requests with changing identifiers, which can trigger lockouts, throttling or alerts in the target application and its identity provider. Agree a scan window with the operations team, tell the security operations center when it starts, and set a request concurrency that the staging environment can absorb. The promptfoo Community edition includes red teaming with 10k probes per month, so plan the probe count per scan against that allowance.
Protect the scan output
Results files, traces and reports can contain the records an agent returned during a bypass, so treat them as sensitive data. Store them in an access-controlled location, limit who can read them, set a retention period, and remove them when the findings are closed. The self-hosted promptfoo server stores data in a local SQLite database without built-in authentication or RBAC, so do not expose it to a wider network without your own access controls.
Self-hosting docsQuestions teams ask before testing agent authorization
What drives the effort of a BOLA and BFLA test for an agent?
The main drivers are how many tools the agent can call, how many user roles and object types sit behind those tools, and how many distinct identities you need to set up. Each tool that reads or changes a record is a candidate for an object-level check (BOLA), and each function that a lower role should not reach is a candidate for a function-level check (BFLA). The number of identities and their permissions decide how many cross-user and cross-role pairs can be tested. Effort also grows with how cleanly the backend API exposes its authorization model. If authorization is enforced only in prompts or in the agent's own logic, expect more time spent proving what the agent can actually reach. Ask the vendor or your own team to list tools, roles and object types before agreeing on scope.
Can our own team run a promptfoo BOLA and BFLA test internally?
Often yes, if you have engineers who can write promptfoo configurations, control the agent's test endpoint and manage test accounts. The promptfoo CLI is open source under the MIT license, and the Community edition includes red teaming with 10k probes per month. Keep in mind that the BOLA and BFLA plugins are remote-only and need promptfoo hosted generation, so you should confirm how that data path fits your data handling rules before you run them. Internal teams usually need time to model roles, design the identity matrix and interpret findings against the API's real authorization rules. A partner can take on that design work and deliver a findings report with fixes and a retest, but the scope and cost should be fixed in writing before work starts.
What does the work need from our team: identities, API access and schemas?
Plan to provide four inputs. First, test identities: at least two users in the same role and one user in a different role, each with the records and permissions you expect them to have. Second, API access: a non-production endpoint for the agent and the backend services it calls, with credentials that can be rotated. Third, schemas: OpenAPI or equivalent descriptions of the tools and the object identifiers they accept. Fourth, a written authorization model that states who may read or change which records and which functions. Without that model, a failed test cannot be separated from a design gap. Confirm with your identity and API teams whether tokens are issued per user, and whether the agent passes user tokens through to backends, since the MCP specification forbids token passthrough.
How long does setup take for an agent with many tools and roles?
Setup time depends mainly on the number of tools, roles and object types, and on how much of the authorization model already exists in writing. A small agent with a few read-only tools and two roles can be configured quickly once identities exist. An agent with dozens of tools, several tenants and mixed read and write functions needs more time to map each tool to its expected access, create identities for each combination and review the generated cases. No duration figure is supplied for this work. Ask any provider, including DeployOpen, for a timeline in the written scope, and ask which parts depend on your team's responses, such as account creation and schema access.
Does a passing BOLA and BFLA run mean the agent is secure?
No. A passing run means the generated probes did not show the failures they were designed to detect, using the identities, endpoints and scan size you chose. It does not prove that every object or function is protected. Coverage depends on the roles you defined, the tools the agent exposes and the number of probes run. Results should be read against the OWASP API Security Top 10, where the function-level risk is API5, and against your own authorization model. Treat a pass as one piece of evidence next to code review, backend authorization tests and monitoring. Authorization in the backend APIs still needs its own review, because an agent can only be as restricted as the services it calls.
What cost should we expect for this testing?
Cost has three parts: the software, the internal time to define identities and roles, and any external work. The promptfoo CLI and Community edition are free under the MIT license, but the BOLA and BFLA plugins require hosted generation, so check the usage and data terms that apply to your scan. Internal cost is mostly engineering and security time for the authorization model and identity setup. External cost comes from a fixed-scope engagement, which DeployOpen agrees in writing before work starts. DeployOpen does not publish a price list, so ask for a quote that lists the tools, roles, identities, retest rounds and deliverables it covers. Also ask whether ongoing retesting is a one-time or recurring cost.
Which standards should the results map to?
Map BOLA and BFLA findings to the OWASP API Security Top 10 for object-level and function-level authorization, and map agent-specific findings to the OWASP Top 10 for Agentic Applications, especially ASI03 Identity and Privilege Abuse and ASI02 Tool Misuse. The OWASP Top 10 for LLM Applications 2026 lists LLM03 Excessive Agency, which is the wider risk behind many of these failures. Use these as shared vocabulary for reporting, not as proof of compliance. Confirm with your compliance team which framework your auditors will expect, since testing supports readiness but does not produce an audit opinion.
How DeployOpen scopes and delivers agent authorization testing
DeployOpen plans and runs agent authorization testing with promptfoo as a fixed-scope engagement, starting from the agent's real identities, tools and data stores. We build the test identities and BOLA and BFLA checks in your environment, then document the findings and hand them over so your team can rerun them.
How we scope
- We list the agent, its tools, the APIs and data stores it can reach, and the user roles that should limit them.
- We agree which BOLA and BFLA checks apply to each tool and which records or functions count as out of bounds.
- We confirm where promptfoo runs, whether hosted generation is allowed, and which data may leave your environment.
How we build
- We create separate test identities for each role and seed them with records the other identities must not see.
- We configure the BOLA and BFLA plugins against the agent target and write the assertions that define a failure.
- We review sample transcripts and tool calls by hand to confirm that the grader's verdicts match what the agent actually did.
How we hand over
- We deliver a written report mapping each finding to the relevant OWASP API Security risk and the affected tool or endpoint.
- We provide the promptfoo configuration, test identity setup and run instructions so your engineers can reproduce each result.
- We walk your security and platform teams through the fixes and schedule a retest once changes are in place.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing testing after agent or permission changes is available as a retainer.
- Confirm with us how an authorization regression will be rerun in your pipeline, and who owns the test identities after handover.

