imperva / imperva/imperva-sdk-python

issue with get_all_web_service_custom_policies()

Open
#58 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
14
Forks
10
PR merge metrics
No merged PRs in 30d

Description

I can connect with MxConnection and get a version number back (its how I verify its working)
but when I attempt to iterate over the custom web server policies it crashes:

MX version 14.6.0.30

Traceback (most recent call last):
File "policiesSync.py", line 17, in
for pol_c in mx_cloud.get_all_web_service_custom_policies():
File "/home/XXXX/.local/lib/python3.8/site-packages/imperva_sdk/MxConnection.py", line 889, in get_all_web_service_custom_policies
return WebServiceCustomPolicy._get_all_web_service_custom_policies(connection=self)
File "/home/XXXX/.local/lib/python3.8/site-packages/imperva_sdk/WebServiceCustomPolicy.py", line 240, in _get_all_web_service_custom_policies
pol_obj = connection.get_web_service_custom_policy(Name=name)
File "/home/XXXX/.local/lib/python3.8/site-packages/imperva_sdk/MxConnection.py", line 899, in get_web_service_custom_policy
return WebServiceCustomPolicy._get_web_service_custom_policy(connection=self, Name=Name)
File "/home/XXXX/.local/lib/python3.8/site-packages/imperva_sdk/WebServiceCustomPolicy.py", line 246, in _get_web_service_custom_policy
validate_string(Name=Name)
File "/home/XXXX/.local/lib/python3.8/site-packages/imperva_sdk/core.py", line 54, in validate_string
raise MxException("Invalid string value for parameter - '%s - %s'" % (param, kwargs[param]))
imperva_sdk.core.MxException: Invalid string value for parameter - 'Name - WPS Hide Login Plugin Bypass #1'

I checked by the web gui and WPS Hide Login Plugin Bypass #1 is an actual policy name, so I can see its doing something.

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 with WebServiceCustomPolicy.py at _get_all_web_service_custom_policies and _get_web_service_custom_policy, following the call from MxConnection.py. Inspect core.py's validate_string using the reported policy name, then reproduce get_all_web_service_custom_policies(); done means valid custom policy names can be iterated without the shown exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.