Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLM Integration #5861

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

LLM Integration #5861

wants to merge 13 commits into from

Conversation

TmmmmmR
Copy link

@TmmmmmR TmmmmmR commented Oct 30, 2024

Overview

This extension integrates LLM with ZAP and includes two main features:

  • API Sequencing: Import Swagger/OpenAPI definitions to generate sequences of HTTP calls for subsequent scanning operations.
  • Alert Review: Examine an alert and determine the confidence level based on evidence from ZAP, complete with an explanation for the updated confidence level.

Related Issues

Specify any related issues or pull requests by linking to them.

Checklist

  • Update help
  • Update changelog
  • Run ./gradlew spotlessApply for code formatting
  • Write tests
  • Check code coverage
  • Sign-off commits
  • Squash commits
  • Use a descriptive title

For more details, please refer to the developer rules and guidelines.

Copy link

github-actions bot commented Oct 30, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Member

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

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

I'll have to finish the rest of my review in a bit, but here's some starting bits.

Copy link
Member

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

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

Should only have the base help and messages.

@kingthorin
Copy link
Member

There's likely a bunch of places swagger should be replaced with openapi.

https://swagger.io/blog/api-strategy/difference-between-swagger-and-openapi/

@yns000
Copy link

yns000 commented Nov 8, 2024

Hi TmmmmmR,

I started my review on this, but ended up having a few questions, can I propose we setup a meeting between yourself and the 2 reviewers so that to see a demo of the addon?

Thank you,
Yiannis

@TmmmmmR
Copy link
Author

TmmmmmR commented Nov 11, 2024

Hello @yns000, yes of course ! I'm available on slack under the dev-llm channel, my username is temmar.

@TmmmmmR
Copy link
Author

TmmmmmR commented Nov 20, 2024

I have read the CLA Document and I hereby sign the CLA.

Signed-off-by: Abdessamad TEMMAR <temmar.abdessamad@gmail.com>
Signed-off-by: Abdessamad TEMMAR <temmar.abdessamad@gmail.com>
Signed-off-by: Abdessamad TEMMAR <temmar.abdessamad@gmail.com>
Signed-off-by: Abdessamad TEMMAR <temmar.abdessamad@gmail.com>
Signed-off-by: Abdessamad TEMMAR <temmar.abdessamad@gmail.com>
@psiinon
Copy link
Member

psiinon commented Dec 20, 2024

You'll need to add "llm" here https://github.com/zaproxy/zap-extensions/pull/5861/files otherwise it cant be deployed.
I've done that locally and I can see the extension in ZAP but I cant see any GUI changes for it. I'll look into that some more..

Copy link
Member

@psiinon psiinon left a comment

Choose a reason for hiding this comment

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

Added some comments which should get the help displayed correctly

kingthorin pushed a commit to kingthorin/cla that referenced this pull request Dec 28, 2024
@psiinon
Copy link
Member

psiinon commented Jan 23, 2025

Logo
Checkmarx One – Scan Summary & Detailsa8b4ff51-9c76-4c3f-b200-066b3a6967c0

New Issues (9)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
HIGH CVE-2024-21538 Npm-cross-spawn-7.0.3
detailsRecommended version: 7.0.5
Description: Versions of the package cross-spawn prior to 6.0.6 and 7.x prior to 7.0.5 are vulnerable to Regular Expression Denial of Service (ReDoS), due to im...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
HIGH CVE-2024-52798 Npm-path-to-regexp-0.1.10
detailsRecommended version: 0.1.12
Description: path-to-regexp turns path strings into a regular expressions. In certain cases, path-to-regexp will output a regular expression that can be exploit...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
MEDIUM CVE-2025-24010 Npm-vite-4.5.5
detailsRecommended version: 4.5.6
Description: Vite is a frontend tooling framework for JavaScript. Vite allowed any websites to send any requests to the development server and read the response...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
MEDIUM SSRF /addOns/llm/src/main/java/org/zaproxy/addon/llm/ui/settings/LlmOptionsPanel.java: 129
detailsThe application sends a request to a remote server, for some resource, using openConnection in /addOns/llm/src/main/java/org/zaproxy/addon/llm/ui/s...
Attack Vector
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 46
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /cla.yml: 19
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /ci.yml: 26
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 34
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 27
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
Fixed Issues (9)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
LOW Heap_Inspection /addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/AuthUtils.java: 392
LOW Heap_Inspection /addOns/authhelper/src/test/java/org/zaproxy/addon/authhelper/AuthUtilsUnitTest.java: 901
LOW Heap_Inspection /addOns/authhelper/src/test/java/org/zaproxy/addon/authhelper/AuthUtilsUnitTest.java: 854
LOW Heap_Inspection /addOns/authhelper/src/test/java/org/zaproxy/addon/authhelper/AuthUtilsUnitTest.java: 877
LOW Log_Forging /addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpiderDialog.java: 342
LOW Log_Forging /addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpiderDialog.java: 342
LOW Log_Forging /addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpiderDialog.java: 342
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 35
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 50

@psiinon
Copy link
Member

psiinon commented Jan 28, 2025

You need to add "llm" at https://github.com/zaproxy/zap-extensions/blob/main/settings.gradle.kts#L75 in order for it to be built via gradle.
How are you currently deploying it?
I'm not seeing any of the GUI changes taking effect, so I'll dig into that some more..

Signed-off-by: Abdessamad TEMMAR <temmar.abdessamad@gmail.com>
@TmmmmmR
Copy link
Author

TmmmmmR commented Jan 28, 2025

Sorry I didn't https://github.com/zaproxy/zap-extensions/blob/main/settings.gradle.kts to my commit.
you can build using : .\gradlew.bat addOns:llm:copyZapAddOn

@psiinon
Copy link
Member

psiinon commented Jan 28, 2025

Thanks, thats how I am building it. I'm still not seeing the GUI changes though :/ Will investigate - it could be a local problem, although other add-ons seem to deploy fine that way

@kingthorin
Copy link
Member

You can suppress the serialized warning. Just look around the repo you'll find other examples.

@psiinon
Copy link
Member

psiinon commented Jan 30, 2025

I'm still not able to see and of the PR changes after deploying the add-on, and I've not had a chance to look into that yet.
Any other reviewers see the same or does it work for you?

@psiinon
Copy link
Member

psiinon commented Jan 31, 2025

I've just tried to save my options for something else and I couldnt - I get a message saying Failed to save the options: LLM API Key not defined - this should not be mandatory 😁

@TmmmmmR
Copy link
Author

TmmmmmR commented Feb 4, 2025

I've just tried to save my options for something else and I couldnt - I get a message saying Failed to save the options: LLM API Key not defined - this should not be mandatory 😁

Do I need to remove the re-implementation of the validateParam method ? currently I validate both apikey and the LLM endpoint URL and display warnings in case they are invalid.

@kingthorin
Copy link
Member

I cleaned up the GGiven comments, I had done this review the other day when GitHub had an incident and apparently that cause some repeats/duplication 😞

@kingthorin
Copy link
Member

I've just tried to save my options for something else and I couldnt - I get a message saying Failed to save the options: LLM API Key not defined - this should not be mandatory 😁

It seems the options handler also isn't being unloaded, even after un-installing the add-on it still complains though it can't find the proper resource message :) Had to restart ZAP in order to save options changes.

@thc202
Copy link
Member

thc202 commented Feb 5, 2025

That's a side effect of not doing this way #5861 (comment)

@TmmmmmR
Copy link
Author

TmmmmmR commented Feb 6, 2025

Thank you for all feedbacks, I have updated my PR with the requested edits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants