Get overall vulnerability summary (combines memory and database)
(self)
| 5969 | try: |
| 5970 | self._zap_api_call('JSON/users/action/setUserEnabled', { |
| 5971 | 'contextId': context_id, |
| 5972 | 'userId': user_id, |
| 5973 | 'enabled': 'true' |
| 5974 | }) |
| 5975 | except Exception as e: |
| 5976 | return (False, f"Failed to enable BBA user: {str(e)}") |
| 5977 | |
| 5978 | logger.info(f"ZAP OAuth2/BBA authentication configured for context {context_name}") |
| 5979 | return (True, None) |
| 5980 | |
| 5981 | elif auth_type == 'script_auth': |
| 5982 | # Script-Based Authentication for custom/complex flows |
| 5983 | # This allows users to provide a custom authentication script |
| 5984 | |
| 5985 | script_name = auth_params.get('script_name', '').strip() |
| 5986 | login_url = auth_params.get('login_url', '').strip() |
| 5987 | username = auth_params.get('username', '').strip() |
| 5988 | password = auth_params.get('password', '') |
| 5989 | |
| 5990 | if not login_url: |
| 5991 | return (False, "Login URL is required for script-based authentication") |
| 5992 | if not username: |
| 5993 | return (False, "Username is required for script-based authentication") |
| 5994 | if not password: |
| 5995 | return (False, "Password is required for script-based authentication") |
| 5996 | |
| 5997 | # Include the target URL's host in the context |
| 5998 | try: |
| 5999 | parsed_url = urllib.parse.urlparse(login_url) |
| 6000 | include_regex = f"{parsed_url.scheme}://{parsed_url.netloc}.*" |
| 6001 | self._zap_api_call('JSON/context/action/includeInContext', { |
| 6002 | 'contextName': context_name, |
| 6003 | 'regex': include_regex |
| 6004 | }) |
| 6005 | except Exception as e: |
| 6006 | logger.warning(f"Could not add URL to context: {e}") |
| 6007 | |
| 6008 | # If a script name is provided, use script-based auth |
| 6009 | # Otherwise fall back to form-based as a starting point |
| 6010 | if script_name: |
| 6011 | try: |
nothing calls this directly
no test coverage detected