简体   繁体   English

使用 Web 服务保护数据库

[英]Using a web service to secure a database

There are some rumors floating around that the team at my company will soon be using web services for all future application development.有传言说我公司的团队很快将使用 Web 服务进行所有未来的应用程序开发。 The architecture is supposed to be something like this:架构应该是这样的:

Application --> Web Service --> Database应用程序 --> Web 服务 --> 数据库

The stated reasoning behind it is security.其背后的陈述理由是安全性。 This sounds like a huge waste of time for little if any benefit.这听起来像是在浪费时间,但几乎没有任何好处。 My question is, in what ways does a web service make your data more secure than a database?我的问题是,Web 服务在哪些方面使您的数据比数据库更安全? I would think that if an attacker wanted to get all your data and had already gotten onto the app server, it would be fairly trivial to figure out how the application is getting it's data.我认为,如果攻击者想要获取您的所有数据并且已经进入应用服务器,那么弄清楚应用程序如何获取数据将是相当简单的。

Please keep in mind that these web services would be purely for data, and would have little if any business/validation logic, and would also be outside the application developers control (at least that's the way it's worked with all previous applications that have used web services).请记住,这些 Web 服务将纯粹用于数据,并且几乎没有业务/验证逻辑,并且也不受应用程序开发人员的控制(至少这是它与所有以前使用 Web 的应用程序一起工作的方式)服务)。

One important thing about Web Services is interoperability so that different applications from different platforms later can utilize the services and data.关于 Web 服务的一件重要事情是互操作性,以便来自不同平台的不同应用程序以后可以利用这些服务和数据。 Your company will benefit a lot by doing so.这样做,您的公司将受益匪浅。 And you are right about the security, it is definitely one of the good reasons to use web service rather than expose a public endpoint of the database, it is dangerous!而且您对安全性的看法是正确的,这绝对是使用 Web 服务而不是公开数据库的公共端点的充分理由之一,这很危险!

Web Services enable the accessibility of your data, For example, your data can be accessed within browser by javascript.网络服务使您的数据可访问,例如,您的数据可以通过 javascript 在浏览器中访问。 There is no way to access the database on the server directly within Javascript.无法直接在 Javascript 中访问服务器上的数据库。

All in all, go for it, that is the right approach.总而言之,去吧,这是正确的方法。

If it's true that there will be no business logic or validation on the web services, then there is only a limited security benefit to adding the additional layer of abstraction.如果 Web 服务上没有业务逻辑或验证是真的,那么添加额外的抽象层只会带来有限的安全优势。 I say limited because the interface between your application and the database is still more limited than if they were directly talking to each other.我说有限是因为您的应用程序和数据库之间的接口仍然比它们直接相互通信时更加有限。

If you add validation and business logic to the equation, there is a significant security benefit, as anyone who has access to the application account can only do the database what the application is able to do.如果您将验证和业务逻辑添加到等式中,则会带来显着的安全优势,因为有权访问应用程序帐户的任何人都只能对数据库执行应用程序能够执行的操作。 Additionally, this is a better design because it reduces coupling between your application and implementation details of how the data is stored in the database.此外,这是一个更好的设计,因为它减少了您的应用程序和数据如何存储在数据库中的实现细节之间的耦合。 If you wanted to change the database schema, you only need to update the web services, and not entire applications.如果您想更改数据库架构,您只需更新 Web 服务,而不是整个应用程序。

the security argument is questionable;安全论点是有问题的; authenticating to a web service is no different than authenticating to the database对 Web 服务进行身份验证与对数据库进行身份验证没有什么不同

there are legitimate reasons for moving db operations to web services and SOA in general, but security isn't one of them一般来说,将数据库操作转移到 Web 服务和 SOA 是有正当理由的,但安全性不是其中之一

If you use a webservice hopefully you will also be using some kind of queue when sending the data to the database.如果您使用网络服务,希望您在将数据发送到数据库时也会使用某种队列。 If you are using a webservice and queue combo then the security come into place with less chance of lost data.如果您使用的是 Web 服务和队列组合,那么安全性就会降低,丢失数据的机会就会减少。 If you do not have a webservice and queue combo if you send data to the database and it never gets there you have no were for it to go it just disappears.如果您没有 Web 服务和队列组合,如果您将数据发送到数据库并且它永远不会到达那里,那么您就不会让它消失,它就会消失。

You are correct though if someone wants to break into your system a webservice isnt going to help if anything it might make it worse if you make the webservice public and they find the name of your webservice because then they can just query your DB using the webservice and any security features on your servers will just think it is you applications getting the information.您是对的,但如果有人想闯入您的系统,那么网络服务将无济于事并且您服务器上的任何安全功能只会认为是您的应用程序获取了信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM