Skip to content
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

test sonar nosq #508

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/codemodder/temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import boto3
from flask import Flask, request

app = Flask(__name__)
AWS_SESSION = boto3.Session(
aws_access_key_id="YOUR_ACCESS_KEY",
aws_secret_access_key="YOUR_SECRET_KEY",
region_name="YOUR_REGION",
)


@app.route("/login")
def login():
dynamodb = AWS_SESSION.client("dynamodb")

username = request.args["username"]
password = request.args["password"]

dynamodb.scan(
FilterExpression="username = " + username + " and password = " + password,
TableName="users",
ProjectionExpression="username",
)
Comment on lines +19 to +23

Check failure

Code scanning / SonarCloud

NoSQL operations should not be vulnerable to injection attacks High

Change this code to not construct database queries directly from user-controlled data. See more on SonarCloud