gpt4 book ai didi

php - 允许网站 URL 中的所有字符有哪些安全风险?

转载 作者:可可西里 更新时间:2023-10-31 22:57:10 24 4
gpt4 key购买 nike

我正在使用 Codeigniter PHP框架。在其中一个配置文件中,您可以设置允许的 URL 字符:

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; 

因此,如果我尝试转到此 url:website.com/controller/%22quotedString%22,我将收到错误消息,除非我将引号附加到允许的字符:

$config['permitted_uri_chars'] .= '"'; 

我的应用程序实际上需要在 URL 中允许 所有 奇怪的字符,但我不希望有一个巨大的硬编码字符列表。 Codeigniter 警告不要允许所有字符:

/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/

他们没有确切说明允许所有字符的安全问题。那么问题是什么?

最佳答案

在您的 URL 中允许所有可能的字符并没有固有的安全风险。安全问题取决于您的应用程序如何处理它们。

关于php - 允许网站 URL 中的所有字符有哪些安全风险?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12013732/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com