Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: select security bug #879

Merged
merged 1 commit into from
Feb 27, 2024
Merged
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
5 changes: 4 additions & 1 deletion src/paginate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,13 @@ export async function paginate<T extends ObjectLiteral>(

// When we partial select the columns (main or relation) we must add the primary key column otherwise
// typeorm will not be able to map the result.
const selectParams =
let selectParams =
config.select && query.select && !config.ignoreSelectInQueryParam
? config.select.filter((column) => query.select.includes(column))
: config.select
if (!includesAllPrimaryKeyColumns(queryBuilder, query.select)) {
selectParams = config.select
}
if (selectParams?.length > 0 && includesAllPrimaryKeyColumns(queryBuilder, selectParams)) {
const cols: string[] = selectParams.reduce((cols, currentCol) => {
const columnProperties = getPropertiesByColumnName(currentCol)
Expand Down