Skip to content

About

Unofficial command-line client for Cybersecurity Compliance Platform ControlMap (read-only)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

An unofficial command-line client for ControlMap

At a glance

ControlMap is SaaS that helps companies to organize their compliance documents and processes. It's widely used to manage ISO-27001 certification.

During the introduction of ISO-27001 at dimedis GmbH we discovered that ControlMap and LLMs don't play well together. Because ControlMap is entirely browser-based without any documented API we couldn't instruct an LLM to carry out tasks. However, many tasks could be done perfectly by AI such as

  • discuss approaches
  • gap analysis
  • document reviews
  • consistency checking
  • summarizing documents
  • spell checking

The main problem is that LLMs cannot read what's inside ControlMap.

While there are some export functions they are too limited to allow efficient work with LLMs. On the other hand the underlying API beneath the user interface is easy to reverse engineer. It follows RESTful patterns so exporting data in a way LLMs can read them with ease is doable. That's why we created this command-line client for automated data export.

Features

With ctrlmap-cli you can mirror data and documents from ControlMap to a folder on your disk using machine and human-readable data formats (Markdown and JSON). You can export

  • Governance documents
  • Policies
  • Procedures
  • Risk Register
  • Vendor Register (including document downloads, quick assessments, risks & action items)
  • Audit trail (aka Activities) of all above-mentioned documents

Usage

ctrlmap-cli is written in Python and distributed as a single-file zip-app. Python 3.9 or newer is required.

  • Download a release to anywhere you like e.g. /usr/local/bin.
  • Open ControlMap in your browser with Dev-Tools open. Open the network tab of the dev tools and click on "Policies". Grab your API base URL and your bearer token. See screenshot.
  • Go to an empty folder and make it the folder where ControlMap documents are mirrored to. Your API URL of ControlMap is required. E.g. https://api.eu.ctrlmap.com
     ctrlmap-cli init https://<CONTROLMAP-API-URL>/
    You will be asked interactively for the bearer token. Your input will not be displayed on the console. This step will create the file .ctrlmap-cli.ini and the basic folder structure.
    .
    ├── .ctrlmap-cli.ini
    ├── govs/
    ├── pols/
    ├── pros/
    ├── risks/
    └── vendors/
    
  • Check the connection with ctrlmap-cli session. It prints the connection status, the organization name, and the tenant ID.
  • Bearer tokens expire. Run ctrlmap-cli session renew to enter a new token. It is tested before it replaces the token in .ctrlmap-cli.ini; API URL and tenant stay unchanged.
  • Now you can export all data or individual categories:
    • ctrlmap-cli export-all — export everything
    • ctrlmap-cli governance export — all governance documents
    • ctrlmap-cli policies export — all policies
    • ctrlmap-cli procedures export — all procedures
    • ctrlmap-cli risks export — all risks
    • ctrlmap-cli vendors export — all vendors
  • Or export a single item by its code:
    • ctrlmap-cli governance export GOV-1 — one governance document
    • ctrlmap-cli policies export POL-5 — one policy
    • ctrlmap-cli procedures export PRO-3 — one procedure
    • ctrlmap-cli risks export RSK-66 — one risk
    • ctrlmap-cli vendors export VND-17 — one vendor Single-item export updates the category index file automatically.
  • Optional flags:
    • --force — overwrite existing files without confirmation
    • --keep-raw-json — also write raw JSON files alongside Markdown

Place export options after the command, for example ctrlmap-cli policies export POL-5 --force. Numeric codes also work: ctrlmap-cli policies export 5. Run ctrlmap-cli version (or ctrlmap-cli --version) to print the installed version. Run ctrlmap-cli --help or ctrlmap-cli policies export --help for command-specific help. Run ctrlmap-cli --show-completion to print a completion script for your detected shell, or ctrlmap-cli --install-completion to install completion for your detected shell. In environments where Typer cannot detect the shell, generate a script explicitly, for example _CTRLMAP_CLI_COMPLETE=source_bash ctrlmap-cli > ctrlmap-cli-completion.bash, then source that file from your shell configuration.

Migration from action flags

The Typer interface replaces the previous flags; legacy flags are no longer accepted. Replace --init URL with init URL, --copy-all with export-all, and --copy-pols / --copy-pol CODE with policies export / policies export CODE. Use the corresponding domain commands above for other exports. Update external scripts accordingly. Configuration files and export directories are unchanged.

Policy inspection and updates

Fetch policy JSON without creating export files. JSON is the default; --json is optional. Use --decode-html to decode section descriptions while preserving the rest of the response:

ctrlmap-cli policies get POL-5 --json
ctrlmap-cli policies get POL-5 --decode-html

Update an existing section using plain UTF-8 HTML. Use section IDs from the current policy response, not the policy code's numeric suffix:

ctrlmap-cli policies update POL-5 --section-id 267 --from-file update.html
ctrlmap-cli policies update POL-5 --section-id 267 < update.html

The client handles ControlMap's double URL encoding. Input is preserved exactly, including line endings; empty input is rejected. Updates require a current, unpublished, non-approved policy with a recognized status. Missing or conflicting state data blocks the update. Exported Markdown is not an update format.

For a current published policy, explicitly create a new major or minor draft first:

ctrlmap-cli policies versions create POL-5 --minor
ctrlmap-cli policies versions create POL-5 --major --notes "Clarify requirements"

Exactly one of --major or --minor is required; notes are optional. Version creation prints the verified revision, policy ID, and fresh section IDs. It does not modify section text. Use these fresh IDs for subsequent updates.

Policy sections

Section commands work only on a current, unpublished, non-approved draft. Use section IDs from policies get:

ctrlmap-cli policies sections create POL-5 --title "Scope" --from-file scope.html
ctrlmap-cli policies sections rename POL-5 --section-id 267 --title "Purpose"
ctrlmap-cli policies sections swap POL-5 --first-id 267 --second-id 268
ctrlmap-cli policies sections delete POL-5 --section-id 267

New sections are always appended at the end; --from-file is optional. Use swap to move them. Deletion may be irreversible: it asks for confirmation and shows the section title. Pass --yes to skip the prompt; scripts without a terminal must pass --yes.

Policy properties

Update the name, code, or next review date of a current draft. Combine options as needed:

ctrlmap-cli policies set POL-5 --name "Access control policy"
ctrlmap-cli policies set POL-5 --code POL-12 --review-date 2027-01-26

The new code must not be in use. The review date uses YYYY-MM-DD and must not be in the past. Changes are submitted one at a time (name, review date, code). If one fails, the error lists the changes already submitted. sections create and set report each completed step on stderr, so an interrupted command still shows the new section ID or the changes already sent.

Verification

Mutations are verified by fetching the policy again. If verification fails, the command exits with an error even though the write may already have succeeded. Fetch the current policy before deciding whether to retry; the CLI never automatically retries or rolls back mutations.

About

Unofficial command-line client for Cybersecurity Compliance Platform ControlMap (read-only)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages