Cgi 脚本以 html/text 形式返回数据。这有多安全?

发布于 2024-07-29 01:21:33 字数 234 浏览 2 评论 0原文

使用 post 方法提交表单时返回数据是有意义的。 看起来好像只能返回html/text...... 我在客户端使用 gwt,如果返回纯文本/文本,它似乎无法正常工作。

问题:使用 html/text 返回所有类型的文本有多安全? 某些数据是否可能会破坏 gwt 或 formpanel? 另外,返回 json 格式的内容有多安全?

我想以这种方式返回二进制数据是不安全的。 我没试过。

It makes sense to return data when a form is submitted using post method.
It looks as if only html/text can be returned ordinarily...
I use gwt on the client side and it does not seem to work properly if plain/text is returned.

The question: how safe is to return all kind of text using html/text?
Is it possible that some data could break gwt or formpanel?
Also, how safe is to return something json format?

I guess it is not safe to return binary data in that way. I have not tried.

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

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

发布评论

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

评论(2

拔了角的鹿 2024-08-05 01:21:33

这取决于您使用的协议。 GWT 可以使用 GWT RPC、SOAP、XMLRPC、JSON 或几乎任何内容。 我不明白为什么返回 text/html 内容类型不安全。

不要在 javascript 中对 JSON 使用 eval() ,除非它是您信任的服务器。 有可用的 javascript JSON 解析器,它们比 eval() 更安全、更快。 预计下一个 ECMAScript 标准将包含原生 JSON 解析器支持。

要发送二进制数据,最好对其进行 Base64 编码。

It depends on what protocol you are using. GWT can use GWT RPC, SOAP, XMLRPC, JSON or almost anything. I don't see why it would not be safe to return text/html content type.

Don't use eval() for JSON in your javascript unless it is a server you trust. There are javascript JSON parsers available which are safer and faster than eval(). It is expected that native JSON parser support will be included in the next ECMAScript standard.

To send binary data, it might be best that you base64 encode it.

夜无邪 2024-08-05 01:21:33

返回 text/html 类型并不安全,因为如果不知道发生了什么变化,它似乎会更改数据。

在客户端,它注意到
- 多个空间变成一个空间
-标签消失
-<> 改为< 和>

IT is not safe to return text/html type because it seems to change the data if one does not know what changes.

On the client side, it noticed that
-multiple space become one space
-tabs disappeared
-<> changed into < and >

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