Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .unreleased/pr_9799
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixes: #9799 Fix job_errors view leaking failed jobs to non-owners
Thanks: @homanp for reporting an information leak with the job_errors view
3 changes: 1 addition & 2 deletions sql/views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ FROM
LEFT JOIN
_timescaledb_catalog.bgw_job j ON (j.id = h.job_id)
WHERE
h.succeeded IS FALSE
OR h.succeeded IS NULL
(h.succeeded IS FALSE OR h.succeeded IS NULL)
AND (pg_catalog.pg_has_role(current_user,
(SELECT pg_catalog.pg_get_userbyid(datdba)
FROM pg_catalog.pg_database
Expand Down
12 changes: 3 additions & 9 deletions tsl/test/expected/bgw_job_stat_history_errors_permissions.out
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,17 @@ SET ROLE :ROLE_DEFAULT_PERM_USER;
SELECT job_id, proc_schema, proc_name, sqlerrcode, err_message
FROM timescaledb_information.job_errors WHERE job_id >= 1000
ORDER BY job_id;
job_id | proc_schema | proc_name | sqlerrcode | err_message
--------+-------------+--------------+------------+-----------------------------------------------------
1000 | public | job_fail | P0001 | raising an exception
1002 | public | custom_proc2 | 40001 | could not serialize access due to concurrent update
11111 | | | | not an error
22222 | | | |
job_id | proc_schema | proc_name | sqlerrcode | err_message
--------+-------------+-----------+------------+----------------------
1000 | public | job_fail | P0001 | raising an exception

SET ROLE :ROLE_DEFAULT_PERM_USER_2;
SELECT job_id, proc_schema, proc_name, sqlerrcode, err_message
FROM timescaledb_information.job_errors WHERE job_id >= 1000
ORDER BY job_id;
job_id | proc_schema | proc_name | sqlerrcode | err_message
--------+-------------+--------------+------------+-----------------------------------------------------
1000 | public | job_fail | P0001 | raising an exception
1002 | public | custom_proc2 | 40001 | could not serialize access due to concurrent update
11111 | | | | not an error
22222 | | | |

SET ROLE :ROLE_SUPERUSER;
SELECT job_id, proc_schema, proc_name, sqlerrcode, err_message
Expand Down
Loading