Preventing SQL Injection in PL/pgSQL in psql

Поиск
Список
Период
Сортировка
От Karen Hill
Тема Preventing SQL Injection in PL/pgSQL in psql
Дата
Msg-id 1147219471.500510.248860@i40g2000cwc.googlegroups.com
обсуждение исходный текст
Ответы Re: Preventing SQL Injection in PL/pgSQL in psql  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-general
Is my understanding correct that the following is vulnerable to SQL
injection in psql:

CREATE OR REPLACE FUNCTION fx ( my_var bchar)
RETURNS void AS
$$
BEGIN
INSERT INTO fx VALUES ( my_var ) ;
END;
$$
LANGUAGE 'plpgsql' VOLATILE

Where this is NOT subject to SQL injection:

CREATE OR REPLACE FUNCTION fx ( my_var bpchar)
RETURNS void AS
$$
BEGIN
EXECUTE ' INSERT INTO fx VALUES ( ' || quote_literal( my_var) || ' ); '
END;
$$ LANGUAGE 'plpgsql' VOLATILE


Is this understanding correct?


В списке pgsql-general по дате отправления:

Предыдущее
От: "Ed L."
Дата:
Сообщение: Re: InitBufferPoolAccess crash
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Preventing SQL Injection in PL/pgSQL in psql