Panel Discussion: API Security in DevSecOps. Register Now

Panel Discussion: API Security in DevSecOps. Register Now

Panel Discussion: API Security in DevSecOps. Register Now

Introducing Akto CLI : You can now run Akto tests in CLI

You can now run Akto tests directly from the Command-Line Interface (CLI). Akto tests in CLI brings the functionality of Akto into your development workflow.

Ankita Gupta

5 mins

Introducing Akto in CLI
Introducing Akto in CLI
Introducing Akto in CLI

We love building features which are demanded by our users. Akto tests in CLI is one such feature.

There's an old saying, "Give the user what they want." We love building features which are demanded by our users. Today, we're proud to unveil a feature that has been on many wish lists: Running Akto tests directly from the Command-Line Interface (CLI).

Problem

While our dashboard is a powerful tool for managing and monitoring Akto tests, we've consistently received feedback about integrating Akto closer to the day-to-day workflows of developers. Developers want to run Akto tests as seamlessly as writing and executing code, especially when working locally or with custom domains.

Solution

Akto CLI is our first answer to this call for flexibility. Akto tests in CLI brings the functionality of Akto into your development workflow. To that end, we will be developing a lot more integrations in development workflows.

Benefits of the Akto CLI Integration

  • Flexibility & Local Development: Run Akto tests right from your terminal, be it locally or on a custom domain. No need to jump between screens or platforms.

  • Customizable Testing Environment: Want to override the application host URL to a localhost or different staging URL? No problem. You have total control over the testing environment.

Getting Started with Akto CLI

Setting up and running Akto tests via CLI is a breeze. Here's a quick guide:

  1. Environment Preparation:

    • AKTO_API_KEY: Navigate to My accounts > Settings > Integrations > Akto API. Generate and copy your token.

      API key in Settings


    • AKTO_DASHBOARD_URL: This is the URL where you access your dashboard. Here is an example, use your URL while you test.

      Dashboard URL


    • TEST_IDS: List down the test IDs, separated by spaces, that you wish to execute. (Example: JWT_NONE_ALGO REMOVE_TOKENS). Navigate to test editor > Test name> ID ( in YAML template). Grab the ID from YAML templates.

      Akto test ID


    • API_COLLECTION_ID: Mention the specific API collection ID for the tests. (Example: 270263191)

      Akto API Collection ID


    • [Optional] TEST_APIS: If you wish to test specific APIs, list them here. By default, all APIs in the collection will be tested.

    • [Optional] OVERRIDE_APP_URL Specify if you want to change the application host. You can just give the URL of the target application.


  2. Run Your Test: Example CLI

bashCopy code 
docker run -v ./:/out \\
-e AKTO_DASHBOARD_URL=https://flash.staging.akto.io \\
-e TEST_IDS=JWT_NONE_ALGO \\
-e API_COLLECTION_ID=1689063104 \\
-e AKTO_API_KEY

  1. Results: A short summary (API, Vulnerability, Severity) is printed on command line itself.

test Results summary in your CLI

Monthly product updates in your inbox. No spam.

Monthly product updates in your inbox. No spam.

Monthly product updates in your inbox. No spam.

Key points to remember:

  • You can use the CLI if you want to run Akto tests locally on any API Collection.

  • The results from the CLI are NOT saved in Akto dashboard.

  • It is best used when developers want to run tests locally before committing to their branch. Note that the application host is chosen as in the API Collection by default.

  • You choose to override the application host url to localhost or a different staging URL.

  • Tests which use context will be skipped eg. AddUserId.yml, OldApiVersion.yml etc.

We believe that with this CLI integration, Akto becomes an even more vital tool in the arsenal of every developer and security professional. Our goal has always been to make security testing as smooth and efficient as possible, and with this update, we're one step closer to that ideal.

Finally, to start, follow the documentation - Run tests in Akto CLI.

Learn more about Akto test library and how to run tests in Akto .

Want to ask something?

Our community offers a network of support and resources. You can ask any question there and will get a reply in 24 hours.

Want to ask something?

Our community offers a network of support and resources. You can ask any question there and will get a reply in 24 hours.

Want to ask something?

Our community offers a network of support and resources. You can ask any question there and will get a reply in 24 hours.

Follow us for more updates

Experience enterprise-grade API Security solution