可以用视图绕过拒绝读取权限吗?

发布于 2024-09-30 15:15:46 字数 455 浏览 3 评论 0原文

考虑用户被拒绝访问财务机密表:

SELECT * FROM Transactions
SELECT permission denied on object 'Transactions'

没问题:

CREATE VIEW dbo.Transactions2 AS SELECT * FROM Transactions
Command(s) completed succesfully.

SELECT * FROM Transactions2
(84,387,982 row(s) affected)

用户是否应该能够通过为表添加别名来绕过表的deny 权限?

编辑:酱料: 替代文字

Consider user is denied access to a table of financial secrets:

SELECT * FROM Transactions
SELECT permission denied on object 'Transactions'

No problem:

CREATE VIEW dbo.Transactions2 AS SELECT * FROM Transactions
Command(s) completed succesfully.

SELECT * FROM Transactions2
(84,387,982 row(s) affected)

Are users supposed to be able to bypass deny permissions on a table by aliasing the table?

Edit: Sauce:
alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挥剑断情 2024-10-07 15:15:46

这正如宣传的那样工作

它被称为“所有权链

  • dbo 拥有两者表和视图/函数/存储过程
  • 视图/函数/存储过程引用表表
  • 权限根本不检查(对于GRANT,DENY,等等)

如果您不想让别人看到列/表,视图/函数/存储过程中没有它。或者添加逻辑/连接以根据您使用的任何模型检查权限。

以前的答案:一个,< a href="https://stackoverflow.com/questions/3633012/how-to-deny-delete-on-a-table-for-all-users/3642473#3642473">两个

它是在SQL中Server 和 Sybase 已经很久了。

This is working as advertised

It's called "ownership chaining"

  • dbo owns both table and view/function/stored proc
  • view/function/stored proc references table
  • table permissions are not checked at all (for GRANT, DENY, whatever)

If you don't want someone to see a column/table, don't have it in the view/function/stored proc. Or add logic/joins to check permissions according to whatever model you've used.

Previous answers: one, two

It's been in SQL Server and Sybase since, well, long time.

行至春深 2024-10-07 15:15:46

这难道不是视图意图的一部分吗?当用户没有对基础表的选择权限时,要启用对表中某些特定信息的可见性吗?

听起来这里的问题是相关用户首先有权创建视图。

例如,假设您想公开该表中的非机密信息;您可以通过将结果限制为您希望看到的内容来做到这一点。

Isn't this part of the intent of views in the first place? To enable visibility to certain, specific information from tables when the user does not otherwise have select permissions on the underlying table(s)?

Sounds like the problem here is that the user in question has rights to create a view in the first place.

For example, say you wanted to expose the non-confidential information in that table; you could do that with a view that limits the results only to what you wanted to be seen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文