tenable / tenable/pyTenable

PyTenable using v1 tag filter API - missing filter operators like Begins and wc

Open
#1,013 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
417
Forks
190
Avg merge
1d 10h
Merged PRs (30d)
3

Description

Describe the bug
I am trying to bulk upload tags, from a list of server names passed in by CSV with server name and the name of the service that server belongs to, for service tags to be created. Tenable sometimes records assets under servername, other times servername.domain and it is seemingly inconsistent/random what approach is taken. However in the current PyTenable tags.create() and tags.edit() the only filter operators available are eq, neq, match, nmatch, despite the main Tenable API supporting Begins and wc. Tenable support have advised to raise this issue on PyTenable as currently they present only these options:

Option 1 — Stay with PyTenable (V1 API)
Unfortunately, there's no native "begins with" operator in V1. The closest option is match, but be aware it converts to a double-sided wildcard (*value*) internally, which was the root cause of the performance/timeout issues with large hostname lists. For now, this remains a known limitation.

Option 2 — Use the V2 API directly (bypass PyTenable)
If the customer is comfortable making raw API calls, they can use the wc operator with a trailing wildcard value directly in the V2 format

You may want to check whether a newer version of PyTenable supports V2 filters natively — if so, upgrading could resolve this cleanly.

To Reproduce
tio.tags.edit(tag_value_uuid=tag_uuids[tag_value], filters=([('fqdn', 'eq', server_names)]), filter_type='and')

Expected behavior
Other filter operators to be supported like Begins or wc

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the PyTenable tags.create() and tags.edit() entry points, using the provided tags.edit() reproduction to trace how filter operators are handled. Compare the current eq, neq, match, and nmatch behavior with the requested Begins and wc operators, and verify that the reported hostname filtering use case works without the double-sided wildcard behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.