diff options
author | Stephen Frost <sfrost@snowman.net> | 2015-01-12 17:04:11 -0500 |
---|---|---|
committer | Stephen Frost <sfrost@snowman.net> | 2015-01-28 12:32:06 -0500 |
commit | 3cc74a3d61f26e6558ee662b6700f74962bd1d8b (patch) | |
tree | f65fae680eaf9f47c241d9eacc578443ff416f5f /src/backend/commands/matview.c | |
parent | 3d5e857ab1ed7dbac28e6c0aea580d1dfb9dc9ed (diff) | |
download | postgresql-3cc74a3d61f26e6558ee662b6700f74962bd1d8b.tar.gz postgresql-3cc74a3d61f26e6558ee662b6700f74962bd1d8b.zip |
Fix column-privilege leak in error-message paths
While building error messages to return to the user,
BuildIndexValueDescription, ExecBuildSlotValueDescription and
ri_ReportViolation would happily include the entire key or entire row in
the result returned to the user, even if the user didn't have access to
view all of the columns being included.
Instead, include only those columns which the user is providing or which
the user has select rights on. If the user does not have any rights
to view the table or any of the columns involved then no detail is
provided and a NULL value is returned from BuildIndexValueDescription
and ExecBuildSlotValueDescription. Note that, for key cases, the user
must have access to all of the columns for the key to be shown; a
partial key will not be returned.
Back-patch all the way, as column-level privileges are now in all
supported versions.
This has been assigned CVE-2014-8161, but since the issue and the patch
have already been publicized on pgsql-hackers, there's no point in trying
to hide this commit.
Diffstat (limited to 'src/backend/commands/matview.c')
-rw-r--r-- | src/backend/commands/matview.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index 93b972e9b8f..dee8629c368 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -586,6 +586,13 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner, elog(ERROR, "SPI_exec failed: %s", querybuf.data); if (SPI_processed > 0) { + /* + * Note that this ereport() is returning data to the user. Generally, + * we would want to make sure that the user has been granted access to + * this data. However, REFRESH MAT VIEW is only able to be run by the + * owner of the mat view (or a superuser) and therefore there is no + * need to check for access to data in the mat view. + */ ereport(ERROR, (errcode(ERRCODE_CARDINALITY_VIOLATION), errmsg("new data for \"%s\" contains duplicate rows without any null columns", |