Axonius-api-client

Latest version: v5.0.21

Safety actively analyzes 723158 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 16

4.50.0

<!-- MarkdownTOC -->

- [Bugfix: Errors when using Python 3.11](bugfix-errors-when-using-python-311)
- [Bugfix: axonshell adapters cnx add missing argument for connection label](bugfix-axonshell-adapters-cnx-add-missing-argument-for-connection-label)

<!-- /MarkdownTOC -->

Bugfix: Errors when using Python 3.11

- Most issues due to dataclasses no longer accepting mutable defaults,
set all dataclasses used as constants as frozen=True
- revalidated against:

Versions:

* Python 3.7.8 64 bit
* Python 3.10.8 64 bit
* Python 3.11.0 64 bit

Operating Systems:

* macOS 12.6.1 (Monterey)
* Ubuntu Linux 18.04.05 64 bit (using "ubuntu-18.04.5-desktop-amd64.iso")
* Ubuntu Linux 22.04.01 64 bit (using "ubuntu-22.04.1-desktop-amd64.iso")
* Microsoft Windows 10 x64
* Microsoft Windows 11 x64
* Microsoft Windows Server 2016 x64
* Microsoft Windows Server 2019 x64
* Microsoft Windows Server 2022 x64

Bugfix: axonshell adapters cnx add missing argument for connection label

- Added option --connection-label
- Also added support for -c "connection_label=foo"

What's Changed
* 4.50.0 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/212


**Full Changelog**: https://github.com/Axonius/axonius_api_client/compare/4.40.8...4.50.0

4.40.8

<!-- MarkdownTOC -->

- [Bugfix: updating a connection setting of type file would throw file not found error](bugfix-updating-a-connection-setting-of-type-file-would-throw-file-not-found-error)
- [Error](error)
- [Python Reproduction](python-reproduction)
- [Axonshell Reproduction](axonshell-reproduction)
- [Changes](changes)

<!-- /MarkdownTOC -->

Bugfix: updating a connection setting of type file would throw file not found error

Error

text
raise ConfigInvalidValue(f"{sinfo}\nFile is not an existing file!")
axonius_api_client.exceptions.ConfigInvalidValue: Value "..." of type 'str' supplied for updating settings for connection Adapter Name: 'json', Instance name: 'Master', Instance ID: '55c35820b0284ac5ba28e7ab8f96683c', Connection ID: '55c35820b0284ac5ba28e7ab8f96683c', Connection UUID: '55c35820b0284ac5ba28e7ab8f96683c', Is active: True, Status: success setting 'file_path'
File is not an existing file!


Python Reproduction

python
cnx = client.adapters.cnx.get_by_adapter("json")[0]
updated = client.adapters.cnx.update_by_id(
cnx_id=cnx["id"], adapter_name="json", file_path="~/workdir/json_adapter.json"
)


Axonshell Reproduction

bash
axonshell adapters cnx update-by-id -n json -i 635ab06b875e3b8ba0b1b9a6 -c file_path=~/workdir/json_adapter.json -npo


Changes

- changed axonius_api_client.tools.json_load to not load contents from file if load_file=False
- changed axonius_api_client.adapters.cnx.Cnx.cb_file_upload to pass load_file=False when calling json_load

What's Changed
* 4.40.8 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/211


**Full Changelog**: https://github.com/Axonius/axonius_api_client/compare/4.40.7...4.40.8

4.40.7

<!-- MarkdownTOC -->

- [Bugfix: axonshell system meta about does not return Customer ID](bugfix-axonshell-system-meta-about-does-not-return-customer-id)

<!-- /MarkdownTOC -->

Bugfix: axonshell system meta about does not return Customer ID

- "Customer ID" no longer returned in endpoint "api/settings/meta/about"
- Added new endpoint "api/settings/metadata"
- Modified axonius_api_client.api.system.meta.Meta.about to combine the returns of
endpoint "api/settings/meta/about" and endpoint "api/settings/metadata"

What's Changed
* Bugfix/about missing customer by nate-axonius in https://github.com/Axonius/axonius_api_client/pull/209
* 4.40.7 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/210


**Full Changelog**: https://github.com/Axonius/axonius_api_client/compare/4.40.6...4.40.7

4.40.6

<!-- MarkdownTOC -->

- [Feature: Run Enforcement against manual selection of Asset IDs](feature-run-enforcement-against-manual-selection-of-asset-ids)
- [Axonshell changes](axonshell-changes)
- [API Client library changes](api-client-library-changes)
- [Feature: support semi-colon instead of comma as CSV delimiter for env vars](feature-support-semi-colon-instead-of-comma-as-csv-delimiter-for-env-vars)
- [Bugfix: Role permissions throw KeyError for some RBAC category actions](bugfix-role-permissions-throw-keyerror-for-some-rbac-category-actions)
- [Bugfix: Reduce log output](bugfix-reduce-log-output)

<!-- /MarkdownTOC -->

Feature: Run Enforcement against manual selection of Asset IDs

Axonshell changes

New commands added to groups ``axonshell devices``, ``axonshell users``,
and ``axonshell vulnerabilities``:

- run-enforcement-from-jsonl: Grab Asset IDs from a JSONL file and run
an Enforcement Set against them.

bash
Notes:
1) --path must be a JSONL file with one dictionary per line

Example:
1) Get assets in JSONL format:
axonshell devices get --export-format json --json-flat --export-file data.jsonl --export-overwrite --wiz simple 'os.type equals windows'
2) Run an enforcement set against the asset IDs in the JSON file:
2a) prompting to verify the count:
axonshell devices run-enforcement-from-jsonl --path data.jsonl --eset test
2b) With no prompting (will error out if the count mismatches):
axonshell devices run-enforcement-from-jsonl --path data.jsonl --eset test --no-prompt
2c) With no verification because we know the asset IDs are valid for this instance:
axonshell devices run-enforcement-from-jsonl --path data.jsonl --eset test --verified


- run-enforcement-from-json: Grab Asset IDs from a JSON file and run an
Enforcement Set against them.

bash
Notes:
1) --path must be a JSON file containing a list of dictionaries

Example:
1) Get assets in JSON format:
axonshell devices get --export-format json --export-file data.json --export-overwrite --wiz simple 'os.type equals windows'
2) Run an enforcement set against the asset IDs in the JSON file:
2a) prompting to verify the count:
axonshell devices run-enforcement-from-json --path data.json --eset test
2b) With no prompting (will error out if the count mismatches):
axonshell devices run-enforcement-from-json --path data.json --eset test --no-prompt
2c) With no verification because we know the asset IDs are valid for this instance:
axonshell devices run-enforcement-from-json --path data.json --eset test --verified


- run-enforcement-from-csv: Grab Asset IDs from a CSV file and run an
Enforcement Set against them.

bash
Notes:
1) --path must be a CSV file with headers
2) --path can also be a CSV file exported from the GUI.

Example:
1) Get assets in CSV format:
axonshell devices get --export-format csv --export-file data.csv --export-overwrite --wiz simple 'os.type equals windows'
2) Run an enforcement set against the asset IDs in the CSV file:
2a) prompting to verify the count:
axonshell devices run-enforcement-from-csv --path data.csv --eset test
2b) With no prompting (will error out if the count mismatches):
axonshell devices run-enforcement-from-csv --path data.csv --eset test --no-prompt
2c) With no verification because we know the asset IDs are valid for this instance:
axonshell devices run-enforcement-from-csv --path data.csv --eset test --verified


- run-enforcement-from-text: Grab Asset IDs from any old text file and run an
Enforcement Set against them.

bash
Notes:
1) --path must be a text file with valid asset IDs
2) All lines will have any non alpha-numeric characters removed from them and
if a 32 character alpha numeric string is found it is considered an Asset ID.

Example:
1) Get assets in JSON format then use jq to extract the IDs to a text file:
axonshell devices get --export-format json --export-file data.json --export-overwrite --wiz simple 'os.type equals windows'
jq '.[].internal_axon_id' data.json > data.txt
2) Run an enforcement set against the asset IDs in the text file:
2a) prompting to verify the count:
axonshell devices run-enforcement-from-text --path data.txt --eset test
2b) With no prompting (will error out if the count mismatches):
axonshell devices run-enforcement-from-text --path data.txt --eset test --no-prompt
2c) With no verification because we know the asset IDs are valid for this instance:
axonshell devices run-enforcement-from-text --path data.txt --eset test --verified


API Client library changes

New Methods for client.devices/client.users/client.vulnerabilities:

- run_enforcement: Run an enforcement set against a manually selected list of assets.

python
'''Get a list of assets from a query and manually extract the IDs.
We know assets are valid because we just got them, so we pass verified=True.
'''
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
ITEMS = apiobj.get(wiz_entries=WIZ)
IDS = [x['internal_axon_id'] for x in ITEMS]
runner = apiobj.run_enforcement(eset=ESET, ids=IDS, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=None,
)
'''


- run_enforcement_from_items: Get Asset IDs from a list of dicts or strs and run
an Enforcement Set against them.

python
'''Get a list of assets from a query and use the grabber get the IDs.
We know assets are valid because we just got them, so we pass verified=True.
'''
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
ITEMS = apiobj.get(wiz_entries=WIZ)
runner = apiobj.run_enforcement_from_items(eset=ESET, items=ITEMS, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source=None,
),
)
'''


- run_enforcement_from_json: Get Asset IDs from a JSON string with a list of
dicts and run an Enforcement Set against them.

python
'''Get a list of assets from a query and export the assets to a JSON str
then run an enforcement against all asset IDs from the JSON str.
We know assets are valid because we just got them, so we pass verified=True.
'''
import io
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
FH = io.StringIO()
z = apiobj.get(wiz_entries=WIZ, export="json", export_fd=FH, export_fd_close=False)
FH.seek(0)
ITEMS = FH.getvalue()
runner = apiobj.run_enforcement_from_json(eset=ESET, items=ITEMS, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_json items type=str, length=15519 post_load type=list, length=31',
),
)
'''


python
'''Get a list of assets from a query and export the assets to a JSON file
then run an enforcement against all asset IDs from the JSON file.
We know assets are valid because we just got them, so we pass verified=True.
'''
import pathlib
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
PATH = pathlib.Path("data.json")
z = apiobj.get(wiz_entries=WIZ, export="json", export_file=PATH, export_overwrite=True)
runner = apiobj.run_enforcement_from_json(eset=ESET, items=PATH, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_json items type=PosixPath, length=None post_load type=list, length=31',
),
)
'''


- run_enforcement_from_jsonl: Get Asset IDs from a JSONL string with one dict
per line and run an Enforcement Set against them.

python
'''Get a list of assets from a query and export the assets to a JSONL str
then run an enforcement against all asset IDs from the JSONL str.
We know assets are valid because we just got them, so we pass verified=True.
'''
import io
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
FH = io.StringIO()
z = apiobj.get(
wiz_entries=WIZ, export="json", json_flat=True, export_fd=FH, export_fd_close=False)
FH.seek(0)
runner = apiobj.run_enforcement_from_jsonl(eset=ESET, items=FH, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_jsonl items type=StringIO, length=None post_load type=list, length=31',
),
)
'''


python
'''Get a list of assets from a query and export the assets to a JSONL file
then run an enforcement against all asset IDs from the JSONL file.
We know assets are valid because we just got them, so we pass verified=True.
'''
import pathlib
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
PATH = pathlib.Path("data.jsonl")
z = apiobj.get(
wiz_entries=WIZ, export="json", json_flat=True, export_file=PATH, export_overwrite=True)
runner = apiobj.run_enforcement_from_jsonl(eset=ESET, items=PATH, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_jsonl items type=PosixPath, length=None post_load type=list, length=31',
),
)
'''


- run_enforcement_from_csv: Get Asset IDs from a CSV string and run
an Enforcement Set against them.

python
'''Get a list of assets from a query and export the assets to a JSONL str
then run an enforcement against all asset IDs from the JSONL str.
We can also use a CSV file exported from the GUI.
We know assets are valid because we just got them, so we pass verified=True.
'''
from axonius_api_client.tools import bom_strip
import io
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
FH = io.StringIO()
z = apiobj.get(wiz_entries=WIZ, export="csv", export_fd=FH, export_fd_close=False)
FH.seek(0)
ITEMS = bom_strip(FH.getvalue())
runner = apiobj.run_enforcement_from_csv(eset=ESET, items=ITEMS, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=33,
count_found=31,
do_echo=True,
do_raise=False,
source='from_csv items type=str, length=6556 post_load type=list, length=33',
),
)
'''


python
'''Get a list of assets from a query and export the assets to a CSV file
then run an enforcement against all asset IDs from the CSV file.
We can also use a CSV file exported from the GUI.
We know assets are valid because we just got them, so we pass verified=True.
'''
import pathlib
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
PATH = pathlib.Path("data.csv")
z = apiobj.get(wiz_entries=WIZ, export="csv", export_file=PATH, export_overwrite=True)
runner = apiobj.run_enforcement_from_csv(eset=ESET, items=PATH, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=33,
count_found=31,
do_echo=True,
do_raise=False,
source='from_csv items type=PosixPath, length=None post_load type=list, length=33',
),
)
'''


- run_enforcement_from_text: Get Asset IDs from a text string and run
an Enforcement Set against them.

python
'''Get a list of assets from a query and export the assets to a text file
then run an enforcement against all asset IDs from the text file.
All lines will have any non alpha-numeric characters removed from them and if a
32 character alpha numeric string is found it is considered an Asset ID.
We know assets are valid because we just got them, so we pass verified=True.
'''
import pathlib
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
WIZ = "simple os.type equals Windows" "query of assets to target"
ESET = "test" "name or uuid of enforcement set"
PATH = pathlib.Path("data.txt")
ASSETS = apiobj.get(wiz_entries=WIZ)
IDS = [x['internal_axon_id'] for x in ASSETS]
PATH.write_text('\n'.join(IDS))
runner = apiobj.run_enforcement_from_text(eset=ESET, items=PATH, verified=True)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_text items type=PosixPath, length=None',
),
)
'''


- run_enforcement_from_json_path: Get Asset IDs from a JSON file with a list of
dicts and run an Enforcement Set against them.

python
'''Run an enforcement against all asset IDs from a JSON file.
We are unsure if Asset IDs are still valid for this instance so
we do not pass verified=True.
'''
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
PATH = "data.json"
ESET = "test" "name or uuid of enforcement set"
runner = apiobj.run_enforcement_from_json_path(eset=ESET, path=PATH)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=31,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_json_path /Users/jimbo/gh/Axonius/axonapi/data.json /
from_json items type=PosixPath, length=None post_load
type=list, length=31',
),
)
'''


- run_enforcement_from_jsonl_path: Get Asset IDs from a JSONL file with one
dict per line and run an Enforcement Set against them.

python
'''Run an enforcement against all asset IDs from a JSONL file.
We are unsure if Asset IDs are still valid for this instance so
we do not pass verified=True.
'''
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
PATH = "data.jsonl"
ESET = "test" "name or uuid of enforcement set"
runner = apiobj.run_enforcement_from_jsonl_path(eset=ESET, path=PATH)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=31,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_jsonl_path /Users/jimbo/gh/Axonius/axonapi/data.jsonl /
from_jsonl items type=PosixPath, length=None post_load type=list, length=31',
),
)
'''


- run_enforcement_from_csv_path: Get Asset IDs from a CSV file and run
an Enforcement Set against them.

python
'''Run an enforcement against all asset IDs from a JSONL file.
We are unsure if Asset IDs are still valid for this instance so
we do not pass verified=True.
'''
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
PATH = "data.csv"
ESET = "test" "name or uuid of enforcement set"
runner = apiobj.run_enforcement_from_csv_path(eset=ESET, path=PATH)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=31,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=33,
count_found=31,
do_echo=True,
do_raise=False,
source='from_csv_path /Users/jimbo/gh/Axonius/axonapi/data.csv /
from_csv items type=PosixPath, length=None post_load type=list, length=33',
),
)
'''


- run_enforcement_from_text_path: Get Asset IDs from a text file and run
an Enforcement Set against them.

python
'''Run an enforcement against all asset IDs from a text file.
All lines will have any non alpha-numeric characters removed from them and if a
32 character alpha numeric string is found it is considered an Asset ID.
We are unsure if Asset IDs are still valid for this instance so
we do not pass verified=True.
'''
client = globals()['client'] instance of axonius_api_client.Connect
apiobj = client.devices client.devices, client.users, or client.vulnerabilities
PATH = "data.txt"
ESET = "test" "name or uuid of enforcement set"
runner = apiobj.run_enforcement_from_text_path(eset=ESET, path=PATH)
print(runner)
'''
Runner(
state='Ran Enforcement Set against 31 supplied Asset IDs',
eset='test',
executed=True,
count_ids=31,
count_result=None,
verified=True,
verify_count=True,
prompt=False,
grabber=Grabber(
count_supplied=31,
count_found=31,
do_echo=True,
do_raise=False,
source='from_text_path /Users/jimbo/gh/Axonius/axonapi/data.txt /
from_text items type=PosixPath, length=None post_load type=generator, length=None',
),
)
'''


- _run_enforcement: Direct API method to run an Enforcement Set against a
list of Asset IDs

New classes:

- axonius_api_client.api.assets.runner.Runner: verify Asset IDs and run
an enforcement set against them
- axonius_api_client.parsers.grabber.Grabber: grab asset IDs from various
export formats (csv, json, jsonl, text)
- axonius_api_client.constants.fields.AXID: global constant for working with
Asset IDs (ala internal_axon_id)

New Schemas:

- axonius_api_client.api.json_api.assets.RunEnforcementRequestSchema
- axonius_api_client.api.json_api.assets.RunEnforcementRequest
- axonius_api_client.api.json_api.selection.IdSelectionSchema
- axonius_api_client.api.json_api.selection.IdSelection

Feature: support semi-colon instead of comma as CSV delimiter for env vars

- prepending the env var value with "semi:" will now
use ; instead of , as the delimiter for CSV strings passed to AX_COOKIES
and AX_HEADERS, i.e.:

bash
export AX_HEADERS="semi:key1=value1;key2=value2"


Bugfix: Role permissions throw KeyError for some RBAC category actions

- Fallback to False if an action for an RBAC category is not defined on a roles permissions

Bugfix: Reduce log output

- Reduced log spam from Http to make logs easier to read

What's Changed
* Feature/enforcement run manual selection by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/207
* Fix typos by mcsalgado in https://github.com/Axonius/axonius_api_client/pull/204
* 4.40.6 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/208

New Contributors
* mcsalgado made their first contribution in https://github.com/Axonius/axonius_api_client/pull/204

**Full Changelog**: https://github.com/Axonius/axonius_api_client/compare/4.40.5...4.40.6

4.40.5

<!-- MarkdownTOC -->

- [Bugfix: python 3.6 does not have re.Pattern](bugfix-python-36-does-not-have-repattern)
- [Bugfix: python 3.8 can not use typing.Union with isinstance](bugfix-python-38-can-not-use-typingunion-with-isinstance)
- [Bugfix: Parsing of --header and --cookie was being mishandled](bugfix-parsing-of---header-and---cookie-was-being-mishandled)
- [Bugfix: more header/cookie names should be hidden in logs by default](bugfix-more-headercookie-names-should-be-hidden-in-logs-by-default)

<!-- /MarkdownTOC -->

Bugfix: python 3.6 does not have re.Pattern

- now using typing.Pattern

Bugfix: python 3.8 can not use typing.Union with isinstance

- Would throw error
`TypeError: Subscripted generics cannot be used with class and instance checks`

- now using isinstance(val, (...))

Bugfix: Parsing of --header and --cookie was being mishandled

- fixed

Bugfix: more header/cookie names should be hidden in logs by default

- list of keys used to be

text
[
"api-key",
"api-secret",
]


- reworked to support string for exact key matches or regex patterns
- strings beginning with ~ will be turned into regex pattern
- list of keys is now

text
[
"~cookie",
"~auth",
"~token",
"~^cf_",
"~secret",
"~key",
"~username",
"~password",
]


What's Changed
* 4.40.5 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/205
* 4.40.5 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/206


**Full Changelog**: https://github.com/Axonius/axonius_api_client/compare/4.40.4...4.40.5

4.40.4

<!-- MarkdownTOC -->

- [Feature: Add support for supplying cookies](feature-add-support-for-supplying-cookies)
- [Feature: Specify request options when getting assets](feature-specify-request-options-when-getting-assets)
- [Bugfix: OS Env AX_HEADERS not parsing properly](bugfix-os-env-ax_headers-not-parsing-properly)
- [Bugfix: silence urllib3 deprecation warning](bugfix-silence-urllib3-deprecation-warning)
- [Schema Updates](schema-updates)
- [SavedQuery](savedquery)
- [Enforcements](enforcements)

<!-- /MarkdownTOC -->

Feature: Add support for supplying cookies

- New OS environment variable AX_COOKIES
- Treated as a CSV by default
- example: `AX_COOKIES="key1=value1,key2=value2"`
- Can be treated as JSON
- example: `AX_COOKIES='json:{"key1": "value1", "key2": "value2"}'`

- Added new argument to axonshell root command `--cookie`, examples:
- `axonshell --cookie key1=value1 --cookies key2=value2 devices count`
- `AX_COOKIES="key1=value1,key2=value2" axonshell devices count`
- `export AX_COOKIES="key1=value1,key2=value2"; axonshell devices count`

text
-cook, --cookie DICT_PARAM Additional cookies to supply with every
request (Example: 'key1=value1') (env var
parsed as CSV unless starts with 'json:')
(multiples) [env var: AX_COOKIES]


- Added more info to axonshell root command:

text
Using existing .env file: '/Users/jimbo/gh/Axonius/axonapi/.env'
AX_ENV=

Tips:
- All of the options listed above must be supplied BEFORE any commands or groups.
- CORRECT: axonshell --log-console devices count
- INCORRECT: axonshell devices count --log-console
- All values stored in a .env file will be treated as OS environment variables.
- Almost all options throughout axonshell have an associated OS environment variable.
- Use AX_ENV to point to a custom .env file:
- bash: export AX_ENV=/path/to/.env for all commands in current shell
- bash: AX_ENV=/path/to/.env axonshell tools shell for single commands
- cmd.exe: SET AX_ENV="c:\path\to\.env"
- powershell: $AX_ENV = "c:\path\to\.env"
- Use AX_COOKIES and AX_HEADERS as comma seperated values or json:
- AX_COOKIES="key1=value1,key2=value2,key3=value4"
- AX_HEADERS='json:{"key1": "value1", "key2": "value2"}'
- Use AX_URL, AX_KEY, AX_SECRET to specify credentials



- Internals: added new argument cookies:dict=None
- `axonius_api_client.http.Http.__init__`
- `axonius_api_client.http.Http.__call__`
- `axonius_api_client.connect.Connect.__init__`

Feature: Specify request options when getting assets

- Want to be able to set response timeout on specific calls
to get assets, example:

python
http_args = {"connect_timeout": 5, "response_timeout": 9999}
client.devices.get(http_args=http_args) noqa


- Internals: added new argument http_args:dict=None
- `client.devices.get`
- `client.users.get`
- `client.vulnerabilities.get`

Bugfix: OS Env AX_HEADERS not parsing properly

- Now works like the newly added AX_COOKIES

Bugfix: silence urllib3 deprecation warning

- Now only import pyopenssl on python<3.10.1

Schema Updates

SavedQuery

- new properties: access
- map access property to wonky private property replacement
- disable schema validation for "used_in" due to validation errors

Enforcements

- new properties: settings, description

What's Changed
* New example that adds adapter connections from a CSV. by nate-axonius in https://github.com/Axonius/axonius_api_client/pull/201
* 4.40.4 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/202
* 4.40.4 by lifehackjim in https://github.com/Axonius/axonius_api_client/pull/203


**Full Changelog**: https://github.com/Axonius/axonius_api_client/compare/4.40.3...4.40.4

Page 6 of 16

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.