Skip to content

Commit

Permalink
Do not allow raw attribute selects (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl authored Jun 8, 2022
1 parent 4c536cc commit 0f2d85f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Service extends AdapterService {
}, params.sequelize);

if (filters.$select) {
q.attributes = filters.$select;
q.attributes = filters.$select.map(select => `${select}`);
}

const Model = this.applyScope(params);
Expand Down
6 changes: 6 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ describe('Feathers Sequelize Service', () => {
await people.remove(person.id);
});

it('does not allow raw attribute $select ', async () => {
await assert.rejects(() => people.find({
query: { $select: [['(sqlite_version())', 'x']] }
}));
});

it('hides the Sequelize error in ERROR symbol', async () => {
try {
await people.create({
Expand Down

0 comments on commit 0f2d85f

Please sign in to comment.