Skip to content

Commit fd47803

Browse files
authored
Merge pull request #714 from AikidoSec/internals
Upgrade zen internals to v0.1.46
2 parents 0a71a5a + 3c3add6 commit fd47803

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

benchmarks/hono-pg/app/posts.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,40 @@ class Posts {
1919
}
2020

2121
async add(title, text, authors) {
22-
// This is unsafe! This is for demo purposes only, you should use parameterized queries.
2322
const articleRes = await this.db.query(
24-
`INSERT INTO posts (title, text) VALUES ('${title}', '${text}') RETURNING id;`
23+
'INSERT INTO posts (title, text) VALUES ($1, $2) RETURNING id',
24+
[title, text]
2525
);
2626

2727
const articleId = articleRes.rows[0].id;
2828

2929
for (const author of authors) {
3030
const authorExists = await this.db.query(
31-
`SELECT id FROM authors WHERE name = '${author}';`
31+
'SELECT id FROM authors WHERE name = $1',
32+
[author]
3233
);
3334
let authorId;
3435
if (authorExists.rows.length === 0) {
3536
const authorRes = await this.db.query(
36-
`INSERT INTO authors (name) VALUES ('${author}') RETURNING id;`
37+
'INSERT INTO authors (name) VALUES ($1) RETURNING id',
38+
[author]
3739
);
3840
authorId = authorRes.rows[0].id;
3941
} else {
4042
authorId = authorExists.rows[0].id;
4143
}
4244

4345
await this.db.query(
44-
`INSERT INTO post_authors (post_id, author_id) VALUES (${articleId}, ${authorId});`
46+
'INSERT INTO post_authors (post_id, author_id) VALUES ($1, $2)',
47+
[articleId, authorId]
4548
);
4649
}
4750
}
4851

4952
async find(title) {
5053
const post = await this.db.query(
51-
`SELECT title, text FROM posts WHERE title = '${title}';`
54+
'SELECT title, text FROM posts WHERE title = $1',
55+
[title]
5256
);
5357

5458
return post.rows.length > 0 ? post.rows[0] : null;

scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
const execAsync = promisify(exec);
1212

1313
// Zen Internals configuration
14-
const INTERNALS_VERSION = "v0.1.45";
14+
const INTERNALS_VERSION = "v0.1.46";
1515
const INTERNALS_URL = `https://github.com/AikidoSec/zen-internals/releases/download/${INTERNALS_VERSION}`;
1616
// ---
1717

0 commit comments

Comments
 (0)