testing changed for python#26
Open
sa-ny wants to merge 1 commit into
Open
Conversation
|
Caution Breaking Flaws identified in code! Fixes for application/views/resetController.py: Fix suggestions: --- application/views/resetController.py
+++ application/views/resetController.py
@@ -60,7 +60,7 @@
elif(request.method == "POST"):
return processReset(request)
else:
- h = httplib2.Http(".cache", disable_ssl_certificate_validation=True) #CWE-295
+ h = httplib2.Http(".cache", verify_ssl=True) #CWE-295
h.add_credentials('thiswaskevinsidea','hardcode') #CWE-798
data=h.request("http://localhost/",method='GET')
return data
@@ -109,6 +109,7 @@
for blabber in users[2:]:
for listener in users[2:]:
if rand.choice([False, True]) and (blabber != listener):
+ rand = random.SystemRandom()
logger.info("Adding " + listener.username + " as a listener of " + blabber.username)
@@ -125,7 +126,8 @@
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)
+ rand = random.SystemRandom()
+ randomUserOffset = rand.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)
@@ -144,19 +146,20 @@
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
+ rand = random.SystemRandom()
+ count = rand.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.
+ randomUserOffset = rand.SystemRandom().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)
+ vary = rand.SystemRandom().randint(0, (30 * 24 * 3600)+1)
logger.info("Adding a comment from " + username + " on blab ID " + str(i))
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.