Opened 5 years ago

Closed 5 years ago

#2308 closed enhancement (needinfo)

Modify the logic for flitering queries to allow ALTER

Reported by: Martin Reisinger Owned by: Kay Kittell
Priority: minor Milestone: Server 2.1.1
Component: Public Website 2 Version: N/A
Severity: Keywords:
Cc: Database Engine: N/A
Operating System: N/A

Description

Modify the code on the query page to allow "alter " (notice the space) so that alternate_name will work in SQL queries.

Change History (5)

comment:1 by Kay Kittell, 5 years ago

Milestone: → Next Release - Server
Status: new → addressed

Modified the words not allowed in queries to have a space after so that "alternate" is ok, while "alter " is not.

comment:2 by Kay Kittell, 5 years ago

Also added code so that if there's a sql error, there exact error is displayed.

comment:3 by Kay Kittell, 5 years ago

Milestone: Next Release - Server → Server 2.1.1

comment:4 by Benjamin Haag, 5 years ago

There may be a bug remaining: an user reported seeing the "Only SELECT is allowed" message when running the SQL below. I believe that the fix basically created a whitelist of allowed SQL commands; perhaps WHERE...IN is being blocked.

select distinct tg.taxonomy_species_id, t.name, g.country_code, g.adm1 AS "State", g.adm1_abbrev, tg.geography_status_code

from taxonomy_species t

join taxonomy_genus ge on ge.taxonomy_genus_id = t.taxonomy_genus_id

join taxonomy_geography_map tg on tg.taxonomy_species_id = t.taxonomy_species_id

join geography g on g.geography_id = tg.geography_id

where tg.geography_status_code = 'n'

AND t.taxonomy_genus_id IN ('292',

'5586',

'8512',

'3406',

'13004',

)

order by 2

comment:5 by Benjamin Haag, 5 years ago

Resolution: → needinfo
Status: addressed → closed
Note: See TracTickets for help on using tickets.