-
Notifications
You must be signed in to change notification settings - Fork 1.7k
JS: Modeling of aws-sdk
clients*
#20135
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
Open
Napalys
wants to merge
13
commits into
github:main
Choose a base branch
from
Napalys:js/dynamodb
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+620
−3
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fda74cb
Added test cases for v2 and v3 sql injection of dynamodb
Napalys 94fb606
Added modeling of dynamodb v3 for sql injections
Napalys b2d1821
Added modeling for V2 of dynamoDB
Napalys 5e09416
Added change note
Napalys 44008a8
Added test cases for client-s v2 and v3 sql injection
Napalys 1af289c
Added modeling of client-s3 v2 and v3
Napalys c725191
Added test cases for athena v2 and v3 for sql injections
Napalys 238568d
Added modeling of athena v2 and v3 for sql injections
Napalys 0588274
Added test cases for client-rds-data for sql injections
Napalys a8a6fdf
Added modeling of rds v2 and v3 for sql injections
Napalys 0806bd6
Updated change note
Napalys 2ca5d81
Added tests and modeling of database-access-result
Napalys d93033b
Unified aws-db modeling into singular file
Napalys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: minorAnalysis | ||
--- | ||
* Added support for the `aws-sdk` and `@aws-sdk/client-dynamodb`, `@aws-sdk/client-athena`, `@aws-sdk/client-s3`, and `@aws-sdk/client-rds-data` packages. |
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
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
79 changes: 79 additions & 0 deletions
79
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXss/aws-db.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const { AthenaClient, GetQueryResultsCommand } = require('@aws-sdk/client-athena'); | ||
const { S3Client, GetObjectCommand } = require("@aws-sdk/client-s3"); | ||
const { RDSDataClient, ExecuteStatementCommand } = require("@aws-sdk/client-rds-data"); | ||
const { DynamoDBClient, GetItemCommand } = require("@aws-sdk/client-dynamodb"); | ||
|
||
|
||
const express = require('express'); | ||
const bodyParser = require('body-parser'); | ||
const app = express(); | ||
app.use(bodyParser.json()); | ||
|
||
app.post('/v3/all', async (req, res) => { | ||
const client = new AthenaClient({ region: "us-east-1" }); | ||
const results = await client.send(new GetQueryResultsCommand({ QueryExecutionId })); | ||
document.body.innerHTML = results.ResultSet.Rows[0].Data[0].VarCharValue; // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
const s3 = new S3Client({ region: "us-east-1" }); | ||
Napalys marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const command = new GetObjectCommand({ Bucket: bucket, Key: key }); | ||
const response = await s3.send(command); | ||
document.body.innerHTML = response.Body.toString(); // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
const clientRDS = new RDSDataClient({ region: "us-east-1" }); | ||
const response2 = await clientRDS.send(new ExecuteStatementCommand(command)); | ||
document.body.innerHTML = response2.records; // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
const clientDyamo = new DynamoDBClient({ region: "us-east-1" }); | ||
const response3 = await clientDyamo.send(new GetItemCommand(command)); | ||
document.body.innerHTML = response3.Item; // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
}); | ||
|
||
|
||
app.post('/v2/all', async (req, res) => { | ||
const AWS = require('aws-sdk'); | ||
const athena = new AWS.Athena(); | ||
const params = { | ||
QueryString: 'SELECT * FROM my_table', | ||
ResultConfiguration: { OutputLocation: 's3://bucket/prefix/' } | ||
}; | ||
const { QueryExecutionId } = await athena.startQueryExecution(params).promise(); | ||
|
||
const results = await athena.getQueryResults({ QueryExecutionId }).promise(); | ||
document.body.innerHTML = results.ResultSet.Rows[0].Data[0].VarCharValue; // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
athena.getQueryResults({ QueryExecutionId }, (err, data) => { | ||
document.body.innerHTML = data.ResultSet.Rows[0].Data[0].VarCharValue; // $ Alert[js/xss-additional-sources-dom-test] | ||
}); | ||
|
||
const s3 = new AWS.S3({ region: "us-east-1" }); | ||
const response = await s3.getObject({ Bucket: "bucket", Key: "key" }).promise(); | ||
document.body.innerHTML = response.Body.toString(); // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
s3.getObject({ Bucket: "bucket", Key: "key" }, (err, data) => { | ||
document.body.innerHTML = data.Body.toString(); // $ Alert[js/xss-additional-sources-dom-test] | ||
}); | ||
|
||
const rdsData = new AWS.RDSDataService({ region: "us-east-1" }); | ||
const response1 = await rdsData.executeStatement(params).promise(); | ||
document.body.innerHTML = response1.records; // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
rdsData.executeStatement(params, function(err, data) { | ||
document.body.innerHTML = data.records; // $ Alert[js/xss-additional-sources-dom-test] | ||
}); | ||
|
||
const response2 = await rdsData.batchExecuteStatement(params).promise(); | ||
document.body.innerHTML = response2.updateResults; // $ Alert[js/xss-additional-sources-dom-test] | ||
|
||
rdsData.batchExecuteStatement(params, function(err, data) { | ||
document.body.innerHTML = data.updateResults; // $ Alert[js/xss-additional-sources-dom-test] | ||
}); | ||
|
||
const dynamodb = new AWS.DynamoDB({ region: "us-east-1" }); | ||
dynamodb.executeStatement(params, (err, data) => { | ||
document.body.innerHTML = data.Item; // $ Alert[js/xss-additional-sources-dom-test] | ||
}); | ||
dynamodb.executeStatement(params).promise().then(data => { | ||
document.body.innerHTML = data.Item; // $ Alert[js/xss-additional-sources-dom-test] | ||
}); | ||
}); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.