Skip to content

Conversation

mbaluda
Copy link
Contributor

@mbaluda mbaluda commented Feb 28, 2024

Closes #95

@mbaluda mbaluda self-assigned this Feb 28, 2024
const { book, quantity } = req2.params.category
const LOG = cds.log("nodejs");
LOG.info("CAP:" + book); // CAP log injection alert from non-CAP source
console.log("console:" + book); // non-CAP Log injection alert from non-CAP source

Check warning

Code scanning / CodeQL

Log injection

Log entry depends on a [user-provided value](1).
this.on ('submitOrder', async req => {
const {book,quantity} = req.data
const LOG = cds.log("nodejs");
LOG.info("CAP:" + book); // CAP log injection alert

Check warning

Code scanning / CodeQL

CAP Log injection

Log entry depends on a [user-provided value](1).
this.on('format', (req) => {
const cds2 = require('@sap/cds/lib')
const LOG = cds2.log('cds.log')
const $ = req.data; LOG.info('format:', $) // CAP log injection alert

Check warning

Code scanning / CodeQL

CAP Log injection

Log entry depends on a [user-provided value](1).
app.get("search", function handler(req2, res) {
const { book, quantity } = req2.params.category
const LOG = cds.log("nodejs");
LOG.info("CAP:" + book); // CAP log injection alert from non-CAP source

Check warning

Code scanning / CodeQL

CAP Log injection

Log entry depends on a [user-provided value](1).

const app = require("express")();
app.get("search", function handler(req2, res) {
pool.query(req2.params.category, [], function (err, results) { // non-CQL injection alert from non-CAP source

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources

This query string depends on a [user-provided value](1).
Comment on lines +40 to +44
app.get("search", function handler(req2, res) {
pool.query(req2.params.category, [], function (err, results) { // non-CQL injection alert from non-CAP source
// process results
});
});

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [a database access](1), but is not rate-limited.
let { stock } = await SELECT`stock`.from(Books, book)

let query = SELECT.from`Books`.where(`ID=${book}`)
let books = await cds.db.run(query) // CQL injection alert

Check failure

Code scanning / CodeQL

CQL query built from user-controlled sources

This query depends on a [user-provided value](1).
let query = SELECT.from`Books`.where(`ID=${book}`)
let books = await cds.db.run(query) // CQL injection alert

let books11 = await SELECT.from`Books`.where(`ID=${book}`) // CQL injection alert

Check failure

Code scanning / CodeQL

CQL query built from user-controlled sources

This query depends on a [user-provided value](1).
let books11 = await SELECT.from`Books`.where(`ID=${book}`) // CQL injection alert

let query2 = SELECT.from`Books`.where('ID=' + book)
let books2 = await cds.db.run(query2) // CQL injection alert

Check failure

Code scanning / CodeQL

CQL query built from user-controlled sources

This query depends on a [user-provided value](1).
let query2 = SELECT.from`Books`.where('ID=' + book)
let books2 = await cds.db.run(query2) // CQL injection alert

let books22 = await SELECT.from`Books`.where('ID=' + book) // CQL injection alert

Check failure

Code scanning / CodeQL

CQL query built from user-controlled sources

This query depends on a [user-provided value](1).
let books33 = await SELECT.from`Books`.where('ID=' + id) //safe

let cqn = CQL`SELECT col1, col2, col3 from Books` + book
let books222 = await cds.db.run(cqn) // CQL injection alert

Check failure

Code scanning / CodeQL

CQL query built from user-controlled sources

This query depends on a [user-provided value](1).
let books222 = await cds.db.run(cqn) // CQL injection alert

let cqn1 = cds.parse.cql(`SELECT * from Books` + book)
let books111 = await cds.db.run(cqn1) // CQL injection alert

Check failure

Code scanning / CodeQL

CQL query built from user-controlled sources

This query depends on a [user-provided value](1).
Copy link
Contributor

@jeongsoolee09 jeongsoolee09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeongsoolee09 jeongsoolee09 merged commit a726de1 into main Mar 1, 2024
@jeongsoolee09 jeongsoolee09 deleted the mbaluda/non-cap-sink-tests branch March 1, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate cap from non-cap sinks
2 participants