Delete a scan and its findings from memory and database
(self, scan_id: str)
| 6034 | except Exception as e: |
| 6035 | return (False, f"Failed to set CSA method: {str(e)}") |
| 6036 | |
| 6037 | # Create and configure user |
| 6038 | try: |
| 6039 | user_resp = self._zap_api_call('JSON/users/action/newUser', { |
| 6040 | 'contextId': context_id, |
| 6041 | 'name': 'script_user' |
| 6042 | }) |
| 6043 | user_id = user_resp.get('userId') |
| 6044 | except Exception as e: |
| 6045 | return (False, f"Failed to create user for script auth: {str(e)}") |
| 6046 | |
| 6047 | if not user_id: |
| 6048 | return (False, "Failed to create user - no user ID returned") |
| 6049 | |
| 6050 | # Set credentials |
| 6051 | try: |
| 6052 | self._zap_api_call('JSON/users/action/setAuthenticationCredentials', { |
| 6053 | 'contextId': context_id, |
| 6054 | 'userId': user_id, |
| 6055 | 'authCredentialsConfigParams': urllib.parse.urlencode({ |
| 6056 | 'username': username, |
| 6057 | 'password': password, |
| 6058 | }) |
| 6059 | }) |
| 6060 | except Exception as e: |
| 6061 | return (False, f"Failed to set script auth credentials: {str(e)}") |
| 6062 | |
| 6063 | # Enable user |
| 6064 | try: |
| 6065 | self._zap_api_call('JSON/users/action/setUserEnabled', { |
| 6066 | 'contextId': context_id, |
| 6067 | 'userId': user_id, |
| 6068 | 'enabled': 'true' |
| 6069 | }) |
no test coverage detected