PyTenable using v1 tag filter API - missing filter operators like Begins and wc
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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