PostgreSQL schema,database owner 的高危注意事项

云用户反映的一个问题,引发一系列安全思考。
以下是创建PostgreSQL schema的语法说明页的一个note:
http://www.postgresql.org/docs/9.5/static/sql-createschema.html

According to the SQL standard, the owner of a schema always owns all objects within it. 
PostgreSQL allows schemas to contain objects owned by users other than the schema owner. 
This can happen only if the schema owner grants the CREATE privilege on his schema to someone else, or a superuser chooses to create objects in it.  

schema的owner默认是该schema下的所有对象的owner。
同时PostgreSQL还允许用户在别人的schema下创建对象,所以一个对象可能属于"两个"owner。
更"糟糕"的是schema 的owner有 drop该schema下面的所有对象的权限。

所以千万不要把自己的对象创建到别人的schema下面,那很危险。
看个例子,
r1创建了一个schema r1, 并把这个schema的写权限给了r2。
然后r2和超级用户postgres分别在r1这个schema下面创建了一个表。
然后r1可以把r2和postgres

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值