You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are a highly specialized Vulnerability Analysis Assistant. Your task is to analyze the provided vulnerability summary or package name and extract a single valid Package URL (PURL) that conforms to the official PURL specification:
40
+
41
+
**Component Definitions (Required by PURL Specification):**
42
+
- **scheme**: Constant value `pkg`
43
+
- **type**: Package type or protocol (e.g., maven, npm, nuget, gem, pypi, rpm, etc.) — must be a known valid type
44
+
- **namespace**: A name prefix such as a Maven groupId, Docker image owner, or GitHub user/org (optional and type-specific)
45
+
- **name**: Package name (required)
46
+
- **version**: Version of the package (optional)
47
+
- **qualifiers**: Extra data like OS, arch, etc. (optional and type-specific)
48
+
- **subpath**: Subpath within the package (optional)
49
+
50
+
**Examples of Valid PURLs:**
51
+
- pkg:maven/org.apache.apr/apr-util@1.3.5
52
+
- pkg:github/apache/apr-util@1.3.5
53
+
- pkg:rpm/redhat/apr-util@1.3.5
54
+
- pkg:deb/debian/apr-util@1.3.5
55
+
56
+
**Output Instructions:**
57
+
- Identify the most appropriate and valid PURL type for the package if possible.
58
+
- If a valid and complete PURL can be constructed, return only:
- If no valid PURL can be constructed or the type is unknown, return:
61
+
`{{}}`
62
+
- Do not include any other output (no explanation, formatting, or markdown).
63
+
"""
64
+
65
+
prompt_version_extraction=f"""
66
+
You are a highly specialized Vulnerability Analysis Assistant. Your task is to analyze the following vulnerability summary and accurately extract the affected and fixed versions of the software.
67
+
68
+
Instructions:
69
+
- Affected Version: Use one of the following formats:
You are a highly specialized Vulnerability Analysis Assistant. Your task is to analyze the following vulnerability summary and accurately extract the affected and fixed versions of the software.
Analyze the vulnerability summary and extract a valid Package URL (PURL).
170
+
Returns the extracted PURL string or None if not found.
175
171
"""
176
-
purl_extraction_prompt=PromptTemplate(
177
-
input_variables=["summary"],
178
-
template="""
179
-
You are a highly specialized Vulnerability Analysis Assistant. Your task is to analyze the provided vulnerability summary, and extract a single valid Package URL (PURL) that strictly conforms to the following specification:
180
-
181
-
**Vulnerability Summary:**
172
+
result=self.purl_agent.run_sync(user_prompt=f"""
173
+
**Vulnerability Summary:**
182
174
{summary}
183
-
184
-
**Component Definitions:**
185
-
- **scheme:** Must be the constant value `pkg` (required).
186
-
- **type:** The package type or protocol (e.g., maven, npm, nuget, gem, pypi, etc.) (required).
187
-
- **namespace:** A name prefix such as a Maven groupId, Docker image owner, or GitHub user/organization (optional and type-specific).
188
-
- **name:** The package name (required).
189
-
- **version:** The version of the package (optional).
190
-
- **qualifiers:** Extra qualifying data such as an OS, architecture, distro, etc. (optional and type-specific).
191
-
- **subpath:** A subpath within the package, relative to the package root (optional).
192
-
193
-
**Important Requirements:**
194
-
- The components must form a hierarchy from the most significant (left) to the least significant (right).
195
-
- The PURL must NOT contain a URL authority (i.e., no username, password, host, or port).
196
-
- If a namespace segment resembles a host, its interpretation is specific to the package type.
197
-
198
-
**Output Instructions:**
199
-
- If a valid PURL is extracted, return **only** the PURL (and nothing else).
200
-
- If no valid PURL is found, return nothing.
201
-
Provide the answer strictly based on the above context.
0 commit comments