Skip to main content

Fix Inventory Core

Fix Inventory Core (fixcore) is the graph persistence and search backend of Fix Inventory. It maintains the graph of resources and provides APIs to update and access them.

Within Fix Inventory Core, there are workflows consisting of steps that result in actions like collect, cleanup or generate_metrics. These actions are received by components like Fix Inventory Worker and Fix Inventory Metrics.

Fix Inventory Core Docker image
somecr.io/someengineering/fixinventorycore:edge

API‚Äč

The Fix Inventory Core API is exposed at https://<fixinventory-address>:8900/api-doc. You can also access it at https://inventory.fix.security/docs/reference/api.

Fix Inventory Core has two API endpoints to connect to for CLI purposes:

  1. /cli/evaluate
  2. /cli/execute

The /cli/evaluate functinality is used internally on every /cli/execute before the command executes.

Below is a simulation of sending a Fix Inventory Shell search to the API.

We will evaluate the search before executing it for demonstration. We also introduce a search with a typo to show the response if not successful.

Evaluate‚Äč

Correct
> echo 'search is("resource") limit 1' | http :8900/cli/evaluate
‚ÄčHTTP/1.1 200 OK
‚ÄčContent-Length: 47
‚ÄčContent-Type: application/json; charset=utf-8
‚ÄčDate: Wed, 06 Oct 2021 15:13:08 GMT
‚ÄčServer: Python/3.9 aiohttp/3.7.4.post0

‚Äč[
‚Äč {
‚Äč "execute_query": "is(\"resource\") limit 1"
‚Äč }
‚Äč]
Typo
> echo 'graph=resoto search is("resource") limit1' | http :8900/cli/evaluate
‚ÄčHTTP/1.1 400 Bad Request
‚ÄčContent-Length: 151
‚ÄčContent-Type: text/plain; charset=utf-8
‚ÄčDate: Wed, 06 Oct 2021 15:13:33 GMT
‚ÄčServer: Python/3.9 aiohttp/3.7.4.post0

‚ÄčError: ParseError
‚ÄčMessage: expected one of '!=', '!~', '<', '<=', '=', '==', '=~', '>', '>=', '[A-Za-z][A-Za-z0-9_]*', '`', 'in', 'not in', '~' at 0:21

Execute‚Äč

Correct
> echo 'graph=resoto search is("resource") limit 1' | http :8900/cli/execute
‚ÄčHTTP/1.1 200 OK
‚ÄčContent-Type: application/json
‚ÄčDate: Wed, 06 Oct 2021 15:08:10 GMT
‚ÄčServer: Python/3.9 aiohttp/3.7.4.post0
‚ÄčTransfer-Encoding: chunked

‚Äč[
‚Äč {
‚Äč "id": "06ee67f7c54124c019b80a7f53fa59b231b374fe61f94b91e0c26729440d095c",
‚Äč "kinds": [
‚Äč "base_cloud",
‚Äč "cloud",
‚Äč "resource"
‚Äč ],
‚Äč "metadata": {
‚Äč "python_type": "fixinventory.baseresources.Cloud"
‚Äč },
‚Äč "reported": {
‚Äč "ctime": "2021-09-25T23:49:38Z",
‚Äč "id": "gcp",
‚Äč "kind": "cloud",
‚Äč "name": "gcp",
‚Äč "tags": {}
‚Äč },
‚Äč "revision": "_d_7eKMa---",
‚Äč "type": "node"
‚Äč }
‚Äč]
Typo
> echo 'graph=resoto search is("resource") limit1' | http :8900/cli/execute
‚ÄčHTTP/1.1 400 Bad Request
‚ÄčContent-Length: 151
‚ÄčContent-Type: text/plain; charset=utf-8
‚ÄčDate: Wed, 06 Oct 2021 15:26:54 GMT
‚ÄčServer: Python/3.9 aiohttp/3.7.4.post0

‚ÄčError: ParseError
‚ÄčMessage: expected one of '!=', '!~', '<', '<=', '=', '==', '=~', '>', '>=', '[A-Za-z][A-Za-z0-9_]*', '`', 'in', 'not in', '~' at 0:21

More API Endpoints

Fix Inventory Core is the central hub for everything Fix Inventory does. You can explore additional API endpoints at https://<fixinventory-address>:8900/api-doc or https://inventory.fix.security/docs/reference/api.