-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update frogbot-scan-and-fix.yml #3
base: main
Are you sure you want to change the base?
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/python | ||
|
||
# Function definition is here | ||
def printme( str ): | ||
# This prints out a passed string into this function | ||
print (str) | ||
return; | ||
|
||
from project import db, app | ||
from Cryptodome.Cipher import ARC4 | ||
import hashlib | ||
|
||
def arc4_encrypt_password(key, password): | ||
cipher = ARC4.new(key.encode('utf-8')) | ||
encrypted_password = cipher.encrypt(password.encode('utf-8')) | ||
return hashlib.md5(encrypted_password).hexdigest() | ||
Check warning Code scanning / JFrog Frogbot Unsafe Hash Algorithm Medium test
Unsafe Hash Algorithm
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Static Application Security Testing (SAST) VulnerabilityFull descriptionOverviewAn unsafe hash algorithm vulnerability occurs when using a known insecure hash algorithm. Query operationIn this query we look for any usage of weak hash algorithms Vulnerable examplefrom flask import Flask, request
import hashlib
app = Flask(__name__)
@app.route('/login', methods=['POST'])
def login():
username = request.form.get('username')
password = request.form.get('password')
# Vulnerable hashing mechanism (MD5)
hashed_password = hashlib.md5(password.encode()).hexdigest()
if check_password(username, hashed_password):
return 'Login successful'
else:
return 'Login failed'
if __name__ == '__main__':
app.run() In this example, the application uses the MD5 hashing algorithm RemediationReplace any usage of the @app.route('/login', methods=['POST'])
def login():
username = request.form.get('username')
password = request.form.get('password')
- hashed_password = hashlib.md5(password.encode()).hexdigest()
+ hashed_password = hashlib.sha256(password.encode()).hexdigest()
if check_password(username, hashed_password):
return 'Login successful'
else:
return 'Login failed' |
||
|
||
# Now you can call printme function | ||
printme("Hello from JFROG FROGBOT"); | ||
printme("this is a log line that is monitored by the team and will cause alerts") |
Check failure
Code scanning / CodeQL
Use of a broken or weak cryptographic algorithm High test