startcolumn added test #24
Annotations
31 warnings
build
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3, actions/upload-artifact@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
pipeline scan
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3, actions/download-artifact@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
Securityy findings:
app/views/userController.py#L22
from app.models import User, Blabber
from app.forms import RegisterForm
+from html import escape
+from flask import Flask, make_response, jsonify
# Get logger
|
Securityy findings:
app/views/userController.py#L108
parsed = sqlparse.parse(sqlQuery)[0]
logger.info("Attempted login with username and password: " + parsed[8].value)
- cursor.execute(sqlQuery)
+ cursor.execute("%s;" % sqlQuery, (username,))
# END VULN CODE
# GOOD CODE
# sqlQuery = "select username, password, password_hint, created_at, last_login, \
|
Securityy findings:
app/views/userController.py#L135
blab_name=row["blab_name"])
response = updateInResponse(currentUser, response)
- update = "UPDATE users SET last_login=datetime('now') WHERE username='" + row['username'] + "';"
- cursor.execute(update)
+ update = "UPDATE users SET last_login=datetime(now) WHERE username=%s;"
+ cursor.execute(update, (username,))
# if the username ends with "totp", add the TOTP login step
if username[-4:].lower() == "totp":
|
Securityy findings:
app/views/userController.py#L181
try:
logger.info("Creating the Database connection")
with connection.cursor() as cursor:
- sql = "SELECT password_hint FROM users WHERE username = '" + username + "'"
+ sql = "SELECT password_hint FROM users WHERE username = %s"
logger.info(sql)
- cursor.execute(sql)
+ cursor.execute(sql, (username,))
row = cursor.fetchone()
if (row):
|
Securityy findings:
app/views/userController.py#L194
formatString = "Username '" + username + "' has password: {}"
hint = formatString.format(password[:2] + ("*" * (len(password) - 2)))
logger.info(hint)
- return HttpResponse(hint)
+ return HttpResponse(escape(hint))
else:
- return HttpResponse("No password found for " + username)
+ return HttpResponse(escape("No password found for " + username))
except DatabaseError as db_err:
logger.error("Database error", db_err)
return HttpResponse("ERROR!")
|
Securityy findings:
app/views/userController.py#L222
#Create db connection
with connection.cursor() as cursor:
- sql = "SELECT totp_secret FROM users WHERE username = '" + username + "'"
+ sql = "SELECT totp_secret FROM users WHERE username = %s"
logger.info(sql)
- cursor.execute(sql)
+ cursor.execute(sql, (username,))
result = cursor.fetchone()
if result:
|
Securityy findings:
app/views/userController.py#L256
with connection.cursor() as cursor:
- sql = "SELECT totp_secret FROM users WHERE username = '" + username + "'"
+ sql = "SELECT totp_secret FROM users WHERE username = %s"
logger.info(sql)
- cursor.execute(sql)
+ cursor.execute(sql, (username,))
result = cursor.fetchone()
if result:
|
Securityy findings:
app/views/userController.py#L338
logger.info("Creating the Database connection")
try:
with connection.cursor() as cursor:
- sqlQuery = "SELECT username FROM users WHERE username = '" + username + "'"
- cursor.execute(sqlQuery)
+ sqlQuery = "SELECT username FROM users WHERE username = %s"
+ cursor.execute(sqlQuery, (username,))
row = cursor.fetchone()
if (row):
request.error = "Username '" + username + "' already exists!"
|
Securityy findings:
app/views/userController.py#L417
query += ("'" + blabName + "'")
query += (");")
#execute query
- cursor.execute(query)
+ cursor.execute('%s;' % query, (realName,))
sqlStatement = cursor.fetchone() #<- variable for response
logger.info(query)
# END EXAMPLE VULNERABILITY
|
Securityy findings:
app/views/userController.py#L491
with connection.cursor() as cursor:
# Find the Blabbers that this user listens to
logger.info(sqlMyHecklers)
- cursor.execute(sqlMyHecklers % username)
+ cursor.execute(sqlMyHecklers, (username,))
myHecklersResults = cursor.fetchall()
hecklers=[]
for i in myHecklersResults:
|
Securityy findings:
app/views/userController.py#L508
events = []
# START EXAMPLE VULNERABILITY
- sqlMyEvents = "select event from users_history where blabber=\"" + username + "\" ORDER BY eventid DESC; "
+ sqlMyEvents = "select event from users_history where blabber=%sORDER BY eventid DESC; "
logger.info(sqlMyEvents)
- cursor.execute(sqlMyEvents)
+ cursor.execute(sqlMyEvents, (username,))
userHistoryResult = cursor.fetchall()
# END EXAMPLE VULNERABILITY
|
Securityy findings:
app/views/userController.py#L518
events.append(result[0])
# Get the users information
- sql = "SELECT username, real_name, blab_name, totp_secret FROM users WHERE username = '" + username + "'"
+ sql = "SELECT username, real_name, blab_name, totp_secret FROM users WHERE username = %s"
logger.info(sql)
- cursor.execute(sql)
+ cursor.execute(sql, (username,))
myInfoResults = cursor.fetchone()
if not myInfoResults:
return JsonResponse({'message':'Error, no Inforesults found'})
|
Securityy findings:
app/views/userController.py#L557
# Initial response only get returns if everything else succeeds.
# This must be here in order to use set_cookie later in the program
msg = f"<script>alert('Successfully changed values!\\nusername: {username.lower()}\\nReal Name: {realName}\\nBlab Name: {blabName}');</script>"
- response = JsonResponse({'values':{"username": username.lower(), "realName": realName, "blabName": blabName}, 'message':msg},status=200)
+ response = JsonResponse(jsonify({'values':{"username": username.lower(), "realName": realName, "blabName": blabName},'message':msg}), status=200)
logger.info("entering processProfile")
sessionUsername = request.session.get('username')
|
Securityy findings:
app/views/userController.py#L704
if mime_type is None:
mime_type = "application/octet-stream"
logger.info("MIME type: " + mime_type)
- response = HttpResponse(file.read(), content_type=mime_type)
+ response = HttpResponse(escape(file.read()), content_type=mime_type)
response.headers['Content-Disposition'] = 'attachment; filename=' + imageName
return response
except ValueError as ve:
|
Securityy findings:
app/views/userController.py#L771
# Execute updates as part of a batch transaction
# This will roll back all changes if one query fails
for query in sqlStrQueries:
- cursor.execute(query % (newUsername,oldUsername))
+ cursor.execute('UPDATE users_history SET blabber="%s" WHERE blabber="%s"', (newUsername, oldUsername))
# Rename the user profile image to match new username
|
Securityy findings:
app/views/resetController.py#L60
elif(request.method == "POST"):
return processReset(request)
else:
- h = httplib2.Http(".cache", disable_ssl_certificate_validation=True) #CWE-295
+ h = httplib2.Http(".cache", disable_ssl_certificate_validation=False) #CWE-295
h.add_credentials('thiswaskevinsidea','hardcode') #CWE-798
data=h.request("http://localhost/",method='GET')
return data
|
Securityy findings:
app/views/resetController.py#L108
listenersStatement = "INSERT INTO listeners (blabber, listener, status) values ('%s', '%s', 'Active');"
for blabber in users[2:]:
for listener in users[2:]:
- if rand.choice([False, True]) and (blabber != listener):
+ rand = random.SystemRandom()
+ if rand.choice([False, True]) and (blabber!= listener):
logger.info("Adding " + listener.username + " as a listener of " + blabber.username)
|
Securityy findings:
app/views/resetController.py#L125
blabsStatement = "INSERT INTO blabs (blabber, content, timestamp) values (%s, %s, datetime('now'));"
for blabContent in blabsContent:
# Get the array offset for a random user
- randomUserOffset = rand.randint(2,len(users) - 1)
+ randomUserOffset = random.SystemRandom().randint(2, len(users) - 1)
# get the number or seconds until some time in the last 30 days.
#vary = rand.randint(0,(30 * 24 * 3600)+1)
|
Securityy findings:
app/views/resetController.py#L144
commentsStatement = "INSERT INTO comments (blabid, blabber, content, timestamp) values (%s, %s, %s, datetime('now'));"
for i in range(len(blabsContent)):
# Add a random number of comment
- count = rand.randint(0,5) # between 0 and 6
+ count = rand.SystemRandom().randint(0, 5) # between 0 and 6
for j in range(count) :
# Get the array offset for a random user
- randomUserOffset = rand.randint(2,len(users)-1) #removed +1 cause no admin, removed -2 because no admin and inclusive.
+ random = random.SystemRandom()
+ randomUserOffset = rand.randint(2, len(users)-1) #removed +1 cause no admin, removed -2 because no admin and inclusive.
username = users[randomUserOffset].username
# Pick a random comment to add
- commentNum = rand.randint(0,len(commentsContent)-1)
+ commentNum = rand.SystemRandom().randint(0, len(commentsContent)-1)
comment = commentsContent[commentNum]
# get the number or seconds until some time in the last 30 days.
- vary = rand.randint(0,(30 * 24 * 3600)+1)
+ rand = random.SystemRandom()
+ vary = rand.randint(0, (30 * 24 * 3600)+1)
logger.info("Adding a comment from " + username + " on blab ID " + str(i))
|
Securityy findings:
app/templates/app/feed.html#L157
len : 10
}, function(data) {
if (data) {
- $("#feed ul").append(data);
+$("#feed ul").append(DOMPurify.sanitize(data));
} else {
$(obj).remove();
}
|
Securityy findings:
app/views/blabController.py#L48
logger.info("Executing query to get all 'Blabs for me'")
blabsForMe = sqlBlabsForMe.format(10, 0)
- cursor.execute(blabsForMe % (username,))
+ cursor.execute(blabsForMe, (username, ))
blabsForMeResults = cursor.fetchall()
feedBlabs = []
|
Securityy findings:
app/views/blabController.py#L72
# Find the Blabs by this user
logger.info("Executing query to get all of user's Blabs")
- cursor.execute(sqlBlabsByMe % (username,))
+ cursor.execute(sqlBlabsByMe, (username, ))
blabsByMeResults = cursor.fetchall()
myBlabs = []
|
Securityy findings:
app/views/blabController.py#L117
addBlabSql = "INSERT INTO blabs (blabber, content, timestamp) values ('%s', '%s', datetime('now'));"
logger.info("Executing query to add new blab")
- cursor.execute(addBlabSql % (username, blab))
+ cursor.execute("INSERT INTO blabs (blabber, content, timestamp) values (%s, %s, datetime('now'));", (username, blab))
if not cursor.rowcount:
request.error = "Failed to add blab"
|
Securityy findings:
app/views/blabController.py#L159
logger.info("Executing query to see more Blabs")
blabsForMe = sqlBlabsForMe.format(len, cnt)
- cursor.execute(blabsForMe % (username,))
+ cursor.execute('%s', (username,))
results = cursor.fetchall()
ret = ""
for blab in results:
|
Securityy findings:
app/views/blabController.py#L170
except Exception as e:
logger.error("Unexpected error", e)
- return HttpResponse(ret)
+ return escape(HttpResponse(ret))
# Brings up the page to view a blab, or to write a blab
def blab(request):
|
Securityy findings:
app/views/blabController.py#L254
with connection.cursor() as cursor:
logger.info("Executing addComment")
- cursor.execute(addCommentSql % (blabid, username, comment, moment.now().format("YYYY-MM-DD hh:mm:ss")))
+ cursor.execute("%s", (blabid, username, comment, moment.now().format("YYYY-MM-DD hh:mm:ss")))
if not cursor.rowcount:
request.error = "Failed to add comment"
|
Securityy findings:
app/templates/app/profile.html#L216
$('input[name="' + key + '"]').val(val);
if (key === "username") {
- $('#profileImage').attr('src', image_path + val + '.png');
+$('#profileImage').attr('src', DOMPurify.sanitize(image_path + val + '.png'));
}
});
}
if ('message' in data) {
- $('body').append(data.message);
+ DOMPurify.sanitize($('#body').append(data.message));
}
}
},
|
Deprecation notice: v1, v2, and v3 of the artifact actions
The following artifacts were uploaded using a version of actions/upload-artifact that is scheduled for deprecation: "scan-target", "Veracode Pipeline-Scan Results".
Please update your workflow to use v4 of the artifact actions.
Learn more: https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
|
create fixes
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
Artifacts
Produced during runtime
Name | Size | |
---|---|---|
Veracode Pipeline-Scan Results
Expired
|
10.5 KB |
|
Veracode Pipeline-Scan Results
Expired
|
182 KB |
|
scan-target
Expired
|
726 KB |
|
uploaded-app
Expired
|
44.8 KB |
|