Skip to content

Commit 88ae31c

Browse files
jgamblinclaude
andcommitted
feat: replace Ask ChatGPT with provider-agnostic AI Review
Replace the single-provider "Ask ChatGPT" button with a transparent, provider-agnostic "AI Review" workflow: - New modal shows the full prompt text before sending, so users can review exactly what data will be shared with the AI provider - Dropdown to select provider: ChatGPT, Claude, or Gemini - Copies prompt to clipboard and opens the selected provider - Improved prompt with structured 6-point CVE quality review covering description quality, affected block, schema compliance, CWE classification, references, and completeness - Adds JSON parse error handling and fixes "inut" typo Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ac2cf61 commit 88ae31c

5 files changed

Lines changed: 88 additions & 13 deletions

File tree

cveInterface.js

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,67 @@ var allFieldsForm;
3131
function add_option(w, v, f, s) {
3232
$(w).append($("<option/>").attr({ value: v, selected: s }).text(f));
3333
}
34-
function askchatGPT(CVE_JSON) {
35-
if (!CVE_JSON) CVE_JSON = ace.edit("mjsoneditor").getValue();
36-
if (check_json(JSON.parse(CVE_JSON))) {
37-
const prompt =
38-
'I have this CVE record and want help improve it especially the "affected" block.\nPlease check it against the CVE JSON 5.x schema guidance (https://github.com/CVEProject/cve-schema/blob/main/schema/docs/versions.md).\nHere is the full CVE Record:\n\n ' +
39-
CVE_JSON;
40-
const url = "https://chat.openai.com/?prompt=" + encodeURIComponent(prompt);
41-
window.open(url, "_blank");
42-
} else {
34+
const _ai_providers = {
35+
chatgpt: "https://chatgpt.com/",
36+
claude: "https://claude.ai/new",
37+
gemini: "https://gemini.google.com/app",
38+
};
39+
function buildAIPrompt(CVE_JSON) {
40+
return (
41+
'You are a CVE record quality reviewer. Analyze this CVE JSON 5.x record and provide specific, actionable feedback to improve it before publication.\n\nReview the record for:\n\n1. Description Quality — Is the vulnerability description specific about the impact, attack vector, and affected component? Does it follow the pattern: "[Vulnerability type] in [component] in [product] [version] allows [attacker type] to [impact] via [vector]"?\n\n2. Affected Block — Are vendor, product, and version fields precise? Should versionType (e.g., "semver"), lessThan/lessThanOrEqual, or defaultStatus be used instead of listing only exact versions? Are version ranges properly expressed?\n\n3. Schema Compliance — Does this conform to CVE JSON 5.x per the schema guidance at https://github.com/CVEProject/cve-schema/blob/main/schema/docs/versions.md\n\n4. CWE Classification — Is the CWE ID present and correctly formatted? Does it use the cweId field?\n\n5. References — Are reference URLs present and tagged with appropriate types (e.g., "advisory", "patch", "vendor-advisory")?\n\n6. Completeness — Are there missing recommended fields like metrics (CVSS), timeline, or additional affected products?\n\nFor each issue found, explain what is wrong and why it matters. Then provide a corrected version of the complete JSON with all improvements applied.\n\nCVE Record:\n\n' +
42+
CVE_JSON
43+
);
44+
}
45+
function showAIReview() {
46+
var CVE_JSON = ace.edit("mjsoneditor").getValue();
47+
try {
48+
if (!check_json(JSON.parse(CVE_JSON))) {
49+
swal.fire({
50+
type: "error",
51+
html: "It seems like your CVE JSON is not ready. Please input required content before sending for validation.",
52+
title: "CVE JSON not ready or created yet!",
53+
});
54+
return;
55+
}
56+
} catch (e) {
4357
swal.fire({
4458
type: "error",
45-
html: "It seems like your CVE JSON is not ready. Please inut required content before sending for validation.",
46-
title: "CVE JSON not ready or created yet!",
59+
html: "Invalid JSON. Please fix syntax errors before requesting AI review.",
60+
title: "Invalid JSON",
4761
});
62+
return;
4863
}
64+
var prompt = buildAIPrompt(CVE_JSON);
65+
document.getElementById("aiReviewPrompt").value = prompt;
66+
$("#aiReviewModal").modal("show");
67+
}
68+
function copyAndOpenAI() {
69+
var prompt = document.getElementById("aiReviewPrompt").value;
70+
var provider = document.getElementById("aiProvider").value;
71+
var url = _ai_providers[provider] || _ai_providers.chatgpt;
72+
navigator.clipboard
73+
.writeText(prompt)
74+
.then(function () {
75+
$("#aiReviewModal").modal("hide");
76+
window.open(url, "_blank");
77+
swal.fire({
78+
type: "success",
79+
html:
80+
"Prompt copied to clipboard. Paste it into " +
81+
provider.charAt(0).toUpperCase() +
82+
provider.slice(1) +
83+
" to start your review.",
84+
title: "Prompt Copied!",
85+
timer: 3000,
86+
});
87+
})
88+
.catch(function () {
89+
swal.fire({
90+
type: "info",
91+
html: "Could not copy automatically. Please select all text in the prompt box and copy manually.",
92+
title: "Manual Copy Needed",
93+
});
94+
});
4995
}
5096
function checkurl(x) {
5197
try {
3.55 KB
Loading
93.8 KB
Loading

docs/images/before-ask-chatgpt.png

4.08 KB
Loading

index.html

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ <h5 class="col-12 modal-title text-center">
513513
</form>
514514
</div>
515515
<div class="modal-footer">
516-
<a href="javascript:void(0)" class="btn btn-info askgpt"
517-
onclick="askchatGPT(ace.edit('mjsoneditor').getValue())"> Ask ChatGPT</a>
516+
<a href="javascript:void(0)" class="btn btn-info"
517+
onclick="showAIReview()"> AI Review</a>
518518
<a href="javascript:void(0)" class="btn btn-primary cveupdate"
519519
onclick="publish_cve()">
520520
Publish CVE</a>
@@ -786,6 +786,35 @@ <h6> Demo of CVE 5.0 service client</h6>
786786

787787
</div>
788788
</main>
789+
<div class="modal fade" id="aiReviewModal" tabindex="-1" role="dialog" aria-hidden="true">
790+
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
791+
<div class="modal-content">
792+
<div class="modal-header">
793+
<h5 class="col-12 modal-title text-center">AI Review Prompt
794+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
795+
<span aria-hidden="true">&times;</span>
796+
</button>
797+
</h5>
798+
</div>
799+
<div class="modal-body">
800+
<p class="text-muted small">Review the prompt below before sending. Your CVE record data will be shared with the selected AI provider.</p>
801+
<textarea class="form-control" id="aiReviewPrompt" rows="14" readonly style="font-family:monospace;font-size:0.85rem;"></textarea>
802+
<div class="form-group mt-3">
803+
<label for="aiProvider">AI Provider</label>
804+
<select class="form-control" id="aiProvider">
805+
<option value="chatgpt">ChatGPT</option>
806+
<option value="claude">Claude</option>
807+
<option value="gemini">Gemini</option>
808+
</select>
809+
</div>
810+
</div>
811+
<div class="modal-footer">
812+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
813+
<button type="button" class="btn btn-info" onclick="copyAndOpenAI()">Copy &amp; Open AI</button>
814+
</div>
815+
</div>
816+
</div>
817+
</div>
789818
<script src="cveInterface.js?v=1.0.22"></script>
790819
</body>
791820
</html>

0 commit comments

Comments
 (0)