Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/ogimage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ const process = async (ctx, next) => {
const token = ctx.params.token;

// 1. Fetch Chat Data
// hal.table is an internal constant, not user input, but it is validated
// against a strict identifier allowlist before being interpolated to
// guard against SQL injection should that assumption ever change.
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(hal.table)) {
throw new Error('Invalid table name.');
}
const result = await dbio.queryOne(
`SELECT * FROM ${hal.table} WHERE token = $1`,
[token]
Expand Down