postgresql_copy: add trust_input parameter (#313)

* postgresql_copy: add trust_input parameter

* add changelog fragment
This commit is contained in:
Andrew Klychkov 2020-05-12 09:33:42 +03:00 committed by GitHub
parent 51b8e79203
commit fce150fcf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 2 deletions

View file

@ -52,6 +52,7 @@
<<: *pg_parameters
copy_to: '{{ data_file_txt }}'
src: '{{ test_table }}'
trust_input: no
- assert:
that:
@ -76,6 +77,7 @@
<<: *pg_parameters
copy_from: '{{ data_file_txt }}'
dst: '{{ test_table }}'
trust_input: no
- assert:
that:
@ -101,18 +103,35 @@
<<: *pg_parameters
copy_to: '{{ data_file_txt }}'
src: non_existent_table
trust_input: no
- assert:
that:
- result.failed == true
- result.queries is not defined
- name: postgresql_copy - check trust_input
<<: *task_parameters
postgresql_copy:
<<: *pg_parameters
copy_to: '{{ data_file_txt }}'
src: '{{ test_table }}'
session_role: 'curious.anonymous"; SELECT * FROM information_schema.tables; --'
trust_input: no
ignore_errors: yes
- assert:
that:
- result is failed
- result.msg is search('is potentially dangerous')
- name: postgresql_copy - copy test table data to data_file_txt
<<: *task_parameters
postgresql_copy:
<<: *pg_parameters
copy_to: '{{ data_file_txt }}'
src: '{{ test_table }}'
trust_input: no
- assert:
that:
@ -142,6 +161,7 @@
- name
options:
format: csv
trust_input: no
- assert:
that:
@ -170,6 +190,7 @@
- name
options:
format: csv
trust_input: no
- assert:
that:
@ -198,6 +219,7 @@
columns: id, name
options:
delimiter: '|'
trust_input: no
when: ansible_distribution != 'FreeBSD'
- assert:
@ -218,6 +240,7 @@
columns: id, name
options:
delimiter: ','
trust_input: no
- assert:
that: