是否可以自动缩小所有输出的客户端代码?
我希望能够缩小(删除所有空白)到提供给最终用户的任何页面。令我困扰的是,所有 ajax 调用对最终用户都是可见的,我想知道我是否缩小了它,这是否会最大限度地减少安全待遇,以及我是否将其和类文件从 www 中删除并将它们放在其他地方(如果最终)用户仍然能够访问它或造成损坏或帮助确保安全,
谢谢
i want to be able to minify (remove all white space) to any page provided to the end-user. the thing that bothers me is that all ajax calls is visible to the end-user and was wondering if i minified it if that would minimize the security treat and if i removed that and class files out of the www and put them elsewhere if the end user would still be able to access it or do damage or help with security
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然混淆输出不会提供太多安全性,但您可以通过将代码包装在 输出缓冲并通过您自己的混淆过滤器运行它,然后将其返回给客户端。
While obfuscatiing your output won't provide much in the way of security, you can achieve what you want by wrapping your code in Output Buffering and running it through your own obfuscation filter before returning it to the client.
正如您已经被告知的那样,它不会提供任何安全改进。您只会让网页上的 ajax/javascript 调用变得更加困难。使用输出缓冲是一种选择,如果您使用模板解析器,您还可以在解析/输出模板之前添加自己的代码,以便删除空格。但是,请确保不要删除文本之间的任何空格;-)
我想创建这个函数将是一个地狱般的函数,最后我认为创建这个函数没有什么意义,不值得花时间创建它。
As you are being told already it won't provide any security improvements. You would only make it harder to get a hold on your ajax/javascript calls on your webpage. Using output buffering is one option, if you are using a template parser you can also add your own code right before the template is parsed/outputted so remove whitespace. However, make sure you don't delete any of the spaces between text ;-)
I guess it will be a hell of a function to create and in the end I think it makes too little sense to create this to be worth the time creating it.