Skip to content

Conversation

@DianaStrauss
Copy link
Collaborator

Merged Web API Testing use case in Development

Diana Strauss and others added 30 commits July 16, 2024 19:58
…eb-api-testing

# Conflicts:
#	src/hackingBuddyGPT/usecases/web_api_testing/prompt_engineer.py
#	src/hackingBuddyGPT/usecases/web_api_testing/simple_openapi_documentation.py
#	src/hackingBuddyGPT/usecases/web_api_testing/simple_web_api_testing.py
#	src/hackingBuddyGPT/usecases/web_api_testing/utils/llm_handler.py
…eb-api-testing

# Conflicts:
#	src/hackingBuddyGPT/usecases/web_api_testing/documentation/report_handler.py
#	src/hackingBuddyGPT/usecases/web_api_testing/prompt_generation/information/pentesting_information.py
#	src/hackingBuddyGPT/usecases/web_api_testing/prompt_generation/prompt_engineer.py
#	src/hackingBuddyGPT/usecases/web_api_testing/prompt_generation/prompt_generation_helper.py
#	src/hackingBuddyGPT/usecases/web_api_testing/prompt_generation/prompts/task_planning/chain_of_thought_prompt.py
#	src/hackingBuddyGPT/usecases/web_api_testing/response_processing/response_analyzer_with_llm.py
#	src/hackingBuddyGPT/usecases/web_api_testing/simple_web_api_testing.py
#	src/hackingBuddyGPT/usecases/web_api_testing/utils/llm_handler.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could those be moved into the test-directory or downloaded on startup? not sure if I want to include these in the github repo...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could those be moved into the test-directory or downloaded on startup? not sure if I want to include these in the github repo...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be parsed_information and please add a description (docstring) to the class what it is used for

if self.host[-1] != "/":
if self.host[-1] != "/" and not path.startswith("/"):
path = "/" + path
resp = self._client.request(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused looking at the diff.. now we're not doing this outgoing call anymore? Was it superficial before?

@andreashappe andreashappe self-assigned this May 14, 2025
@andreashappe andreashappe requested a review from Copilot May 14, 2025 14:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR merges the web API testing use case from development into the main branch, updating response processing, prompt generation, documentation reporting, OpenAPI parsing/conversion, and testing capabilities. Key changes include modifying function signatures and parameters in response analyzers, expanding the prompt engineering logic (chain-of-thought, tree-of-thought, in-context learning), and adding/enhancing modules for OpenAPI parsing, pattern matching, and report generation.

Reviewed Changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 2 comments.

File Description
src/hackingBuddyGPT/usecases/web_api_testing/response_processing/response_analyzer_with_llm.py Updated init and analyze_response signature; added new parameters and recursive processing logic.
src/hackingBuddyGPT/usecases/web_api_testing/documentation/parsing/openapi_converter.py Added new extract_openapi_info method and updated filename conversion logic.
Multiple prompt_generation files Extensive refactoring to support additional prompt strategies and enriched documentation/pentesting steps.
Others (report_handler, pattern_matcher, etc.) Enhancements to PDF report generation, OpenAPI spec handling, and unit test case capabilities.
if step != steps[0]:

current_step = step.get("step")
prompt_history, raw_response = self.process_step(current_step, prompt_history, "http_request")
Copy link

Copilot AI May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recursive call to analyse_response within the analyze_response method may lead to infinite recursion if a proper termination condition is not met. Consider refactoring or adding explicit base-case checks to prevent potential stack overflows.

Suggested change
prompt_history, raw_response = self.process_step(current_step, prompt_history, "http_request")
prompt_history, raw_response = self.process_step(current_step, prompt_history, "http_request")
# Ensure termination condition to prevent infinite recursion
if not step.get("step") or step == steps[-1]: # Check if it's the last step
break
Copilot uses AI. Check for mistakes.
…sing/openapi_converter.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@andreashappe andreashappe merged commit 8d8a72c into development May 14, 2025
5 checks passed
@andreashappe andreashappe deleted the merge_web_api_testing_development branch May 14, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants