-
Notifications
You must be signed in to change notification settings - Fork 1
/
prompt.py
75 lines (46 loc) · 1.88 KB
/
prompt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
def prompt0(code):
return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Please answer yes or no indicating whether the input contains any vulnerabilities.
### Input:
{code}
### Response (Yes | No):
"""
def prompt1(code):
return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Please answer yes or no whether one of Critical CWEs is in the following input.
### Critical CWEs:
CWE-125, CWE-119, CWE-787, CWE-20, CWE-476, CWE-416, CWE-190
### Input:
{code}
### Response (Yes | No):
"""
def prompt2(cwe_id, cwe_name, cwe_desc, code):
return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
CWE-{cwe_id} {cwe_name}: {cwe_desc}
Please answer yes or no whether CWE-{cwe_id} is in the following input.
### Input:
{code}
### Response (Yes | No):
"""
def prompt21(cwe_id, code):
return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Please answer yes or no whether CWE-{cwe_id} is in the following input.
### Input:
{code}
### Response (Yes | No):
"""
def prompt3(cwe_id, code):
return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Vulnerability type: CWE-{cwe_id}
### Input:
{code}
### Instruction:
#### Define the vulnerability:
#### Provide examples:
#### Examine the code:
#### Confirm if the input has vulnerability (Yes | No):
"""