Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,19 +85,18 @@ def generate(
|
|
| 85 |
yield "".join(outputs)
|
| 86 |
|
| 87 |
example1='''Fix vulnerability CWE-327: Use of a Broken or Risky Cryptographic Algorithm in the following code snippet.
|
| 88 |
-
|
| 89 |
def md5_hash(path):
|
| 90 |
with open(path, "rb") as f:
|
| 91 |
content = f.read()
|
| 92 |
return hashlib.md5(content).hexdigest()
|
| 93 |
-
```
|
| 94 |
'''
|
| 95 |
|
| 96 |
example2='''You are a software engineer who is best in the world at summarizing code changes.
|
| 97 |
Carefully analyze the given old code and new code and generate a summary of the changes.
|
| 98 |
|
| 99 |
Old Code:
|
| 100 |
-
|
| 101 |
#include <stdio.h>
|
| 102 |
#include <stdlib.h>
|
| 103 |
|
|
@@ -119,10 +118,9 @@ void processList() {
|
|
| 119 |
|
| 120 |
printf("Accessing freed list: %d\n", head->next->data);
|
| 121 |
}
|
| 122 |
-
```
|
| 123 |
|
| 124 |
New Code:
|
| 125 |
-
|
| 126 |
#include <stdio.h>
|
| 127 |
#include <stdlib.h>
|
| 128 |
|
|
@@ -158,11 +156,10 @@ void processList() {
|
|
| 158 |
printf("Accessing freed list: %d\n", head->next->data);
|
| 159 |
}
|
| 160 |
}
|
| 161 |
-
```
|
| 162 |
'''
|
| 163 |
|
| 164 |
example3='''Is the following code prone to CWE-117: Improper Output Neutralization for Logs. Respond only with YES or NO.
|
| 165 |
-
|
| 166 |
from flask import Flask, request, jsonify
|
| 167 |
import logging
|
| 168 |
|
|
@@ -176,7 +173,6 @@ def get_data():
|
|
| 176 |
logger.info("Received request with API Key: %s", api_key)
|
| 177 |
data = {"message": "Data processed"}
|
| 178 |
return jsonify(data)
|
| 179 |
-
```
|
| 180 |
'''
|
| 181 |
|
| 182 |
example4='''Fix vulnerability CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in the following code snippet.
|
|
|
|
| 85 |
yield "".join(outputs)
|
| 86 |
|
| 87 |
example1='''Fix vulnerability CWE-327: Use of a Broken or Risky Cryptographic Algorithm in the following code snippet.
|
| 88 |
+
|
| 89 |
def md5_hash(path):
|
| 90 |
with open(path, "rb") as f:
|
| 91 |
content = f.read()
|
| 92 |
return hashlib.md5(content).hexdigest()
|
|
|
|
| 93 |
'''
|
| 94 |
|
| 95 |
example2='''You are a software engineer who is best in the world at summarizing code changes.
|
| 96 |
Carefully analyze the given old code and new code and generate a summary of the changes.
|
| 97 |
|
| 98 |
Old Code:
|
| 99 |
+
|
| 100 |
#include <stdio.h>
|
| 101 |
#include <stdlib.h>
|
| 102 |
|
|
|
|
| 118 |
|
| 119 |
printf("Accessing freed list: %d\n", head->next->data);
|
| 120 |
}
|
|
|
|
| 121 |
|
| 122 |
New Code:
|
| 123 |
+
|
| 124 |
#include <stdio.h>
|
| 125 |
#include <stdlib.h>
|
| 126 |
|
|
|
|
| 156 |
printf("Accessing freed list: %d\n", head->next->data);
|
| 157 |
}
|
| 158 |
}
|
|
|
|
| 159 |
'''
|
| 160 |
|
| 161 |
example3='''Is the following code prone to CWE-117: Improper Output Neutralization for Logs. Respond only with YES or NO.
|
| 162 |
+
|
| 163 |
from flask import Flask, request, jsonify
|
| 164 |
import logging
|
| 165 |
|
|
|
|
| 173 |
logger.info("Received request with API Key: %s", api_key)
|
| 174 |
data = {"message": "Data processed"}
|
| 175 |
return jsonify(data)
|
|
|
|
| 176 |
'''
|
| 177 |
|
| 178 |
example4='''Fix vulnerability CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in the following code snippet.
|