Fix unsafe schema lookups for types. Fixes #1728
parent
345ce1b6d2
commit
11e486f96d
|
@ -906,9 +906,10 @@ class TypeView(PGChildNodeView, DataTypeReader):
|
|||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
if 'schema' in data:
|
||||
# we need scid to update in browser tree
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_scid.sql']), tname=data['name'])
|
||||
'get_scid.sql']), schema=data['schema'])
|
||||
status, scid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=scid)
|
||||
|
@ -956,7 +957,7 @@ class TypeView(PGChildNodeView, DataTypeReader):
|
|||
return internal_server_error(errormsg=res)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_scid.sql']), tname=data['name'])
|
||||
'get_scid.sql']), tid=tid)
|
||||
|
||||
# Get updated schema oid
|
||||
status, scid = self.conn.execute_scalar(SQL)
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
{% if tid %}
|
||||
SELECT
|
||||
t.typnamespace as scid
|
||||
FROM
|
||||
pg_type t
|
||||
WHERE
|
||||
t.typname = {{tname|qtLiteral}}::text;
|
||||
t.oid = {{tid}}::oid;
|
||||
{% else %}
|
||||
SELECT
|
||||
ns.oid as scid
|
||||
FROM
|
||||
pg_namespace ns
|
||||
WHERE
|
||||
ns.nspname = {{schema|qtLiteral}}::text;
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue