Google App Engine 应用程序是否容易受到 SQL 注入攻击?

发布于 2024-11-13 06:22:03 字数 69 浏览 2 评论 0原文

由于 App Engine 实际上并不使用 SQL,这是否意味着 App Engine 应用程序不会受到 SQL 注入攻击?

Since App Engine doesn't actually use SQL, does that mean that App Engine apps are immune from SQL injection attacks?

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

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

发布评论

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

评论(2

三五鸿雁 2024-11-20 06:22:03

是的,只要您按照将用户输入与 GQL 字符串连接起来的方式进行操作,它们都同样容易受到注入攻击。

但是,如果您遵循 Google 在 GQL 字符串中输入值时使用参数的最佳实践建议,那么您应该可以使用 GQL。因此,

query = GqlQuery("SELECT * FROM Song WHERE composer = 'Lennon, John'")

您可以使用:

query = GqlQuery("SELECT * FROM Song WHERE composer = :1", "Lennon, John")

或:

query = GqlQuery("SELECT * FROM Song WHERE composer = :composer", composer="Lennon, John")

另外,您可以通过使用 查询类来生成查询。

Yes, they are both equally susceptible to injection attacks, provided you do something along the lines of concatenating user-inputs with the GQL string.

However, if you follow Google's best-practice suggestion of using parameters when inputting values in a GQL string, you should be fine with GQL. So instead of:

query = GqlQuery("SELECT * FROM Song WHERE composer = 'Lennon, John'")

you can use:

query = GqlQuery("SELECT * FROM Song WHERE composer = :1", "Lennon, John")

or:

query = GqlQuery("SELECT * FROM Song WHERE composer = :composer", composer="Lennon, John")

Additionally, you will avoid this problem entirely by using the Query class to generate the query.

旧话新听 2024-11-20 06:22:03

好吧,根据定义,没有 SQL==没有 SQL 注入。 :-)

但是,如果应用程序使用 GQL 并且天真地将字符串文字值粘贴到查询中而不转义,那么您当然可以进行 GQL 注入。这样做造成的损害比某些 SQL 变体要小,这些变体允许您 ; 终止当前查询并在同一字符串中开始新查询,但它仍然存在潜在危险。

不过,GQLQuery 提供简单的内置参数绑定机制(与某些语言的默认库不同...)。因此,确实没有理由仍然将字符串文字填充到查询字符串中。

Well no SQL==no SQL injection, by definition. :-)

But you could certainly do GQL injection, if the app is using GQL and naïvely sticking string literal values into queries without escaping. The damage you can do with that is less than some variants of SQL that let you ;-terminate the current query and begin a new one in the same string, but it's still potentially dangerous.

GQLQuery provides a simple built-in parameter binding mechanism, though (unlike some languages' default libraries...). So there's really no excuse to still be stuffing string literals into a query string.

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