Kane CLI tests how your app enforces its own access rules in the browser and in your app. It is not a vulnerability scanner or a penetration testing tool, so pair these checks with your existing security tooling.
Role-based access
-
Save one set of credentials per role in
.testmuai/variables/roles.jsoninside your project, and mark the passwords as secret. Files in that folder load automatically for every run started from the project: -
Write one
_test.mdper role, so each role signs in with a fresh session:member-access_test.md -
Keep
mode: testingso Kane CLI pushes through the denied page and checks it, instead of stopping at it. -
Run both roles together with
kane-cli testrun run --tags access --headless. - Review the results. A member who reaches the admin page fails the run at the restricted page step.
Block signed-out users from members-only actions
A members-only action has two sides, and both need a test: signed-out visitors are blocked, and signed-in members get through. In this recording, Kane CLI tries to enter a product launch draw while signed out, checks the sign-in error, signs in, and then enters successfully.- Start the objective signed out, and attempt the protected action first, for example
click 'Enter draw' and verify an error reads 'Sign in to your account to enter.'. - Sign in within the same run, for example
click 'Sign in', type {{email}} and {{password}}, click 'Sign in', and verify a 'Member' badge is shown. - Repeat the protected action and assert the success state, for example
verify the page shows "You're in the draw" with an entry id starting with 'DRAW-'. - Run it. A signed-out entry that is accepted, or a member entry that is refused, fails the run.
Reject invalid credentials
An API that accepts a wrong password is a security bug that never shows up in a happy-path suite. This use case sends deliberately wrong credentials and asserts the API fails closed.- Run
kane-cli run "Open https://your-app.com, then send a POST request to /api/login with header Content-Type: application/json and this raw JSON body: {\"email\":\"notauser@example.com\",\"password\":\"x\"}, confirm the request is rejected with response status 401 and the error field is 'invalid credentials'". - Add the same check for an expired or tampered token on a protected endpoint, for example
send a GET request to /api/orders with an Authorization header of 'Bearer expired-token' and confirm the response status is 401. - Save the session as a regression guard, so you are told the day an invalid login starts returning a success response.
Check session cookie flags
A session cookie withoutHttpOnly can be read by injected scripts, and one without Secure can travel over plain HTTP. Kane CLI reads the cookies the browser holds during the run, including their flags.
-
Sign in as part of the objective, for example
go to https://your-app.com/login and sign in with {{email}} and {{password}}. -
Add cookie assertions after the sign-in step:
-
Run the command with
--agentand read which cookie failed and which flag it was missing from the summary.
Check where tokens are stored
Tokens kept in localStorage are readable by any script on the page, so many teams require them in httpOnly cookies instead. This use case signs in and checks that storage matches your policy.- Sign in in the objective, then add a storage assertion, for example
assert no localStorage key contains 'token'. - If your app does keep a token in localStorage by design, assert the opposite and its shape instead, for example
assert auth_token exists in localStorage and is not empty. - Add a cookie assertion from the previous section, so one run checks both storage locations.
Confirm sign-out ends the session
A sign-out button that only hides the menu leaves the session usable. This use case signs out and then tries to reach a protected page with the same browser.- Run
kane-cli run "Go to https://your-app.com/login, sign in with {{email}} and {{password}}, open /account and verify the account page loads, click 'Sign out', then open /account again and verify the sign-in page is shown" --variables-file creds.json --agent. - Add a storage check after sign-out, for example
assert the session cookie no longer exists, so a cookie that survives sign-out also fails the run. - Press the browser Back button as an extra step, for example
go back and verify the account details are not shown, to catch pages served from cache after sign-out.
Keep credentials out of tests and logs
A test suite is shared widely, so it should never contain a real password. Kane CLI substitutes{{name}} variables at run time and masks secret values in output and logs.
- Mark every password, token, and card number as
"secret": truein the variables file. - Reference them as
{{name}}in objectives and_test.mdsteps, never as literal values. - In CI, generate the variables file from your secrets store before the step and pass it with
--variables-file. - Check the evidence pack and the Test Manager test case after the first run to confirm the values appear masked.
Next steps
- DevTools & Performance Testing: network, console, storage, and timing checks
- API Testing: auth-token chaining and negative paths at the endpoint level
- Authentication: how Kane CLI itself signs in, locally and in CI
- Batch Runs: run every role’s test in one command