du8589840 2011-07-12 06:50
浏览 37
已采纳

Session_id在页面源中可见,可以吗?

I'm sending the session_id with the javascript. The session_id is visible in source of the page like:

function startUpload(id){
    var queryString = '&' + $('#new_doc_upload').serialize() + "&session_id=" + "01dfda2def225bae907b129d2ffb1";
    $('#fileUpload').fileUploadSettings('scriptData',queryString);
    $('#fileUpload').fileUploadStart();
}

Is it ok that the session_id is visible or can is it a security issue? Thanks.

  • 写回答

5条回答 默认 最新

  • dongpei2835 2011-07-12 07:05
    关注

    I would argue that it's perfectly fine. My rationale is that PHP sends it in clear text and so does the browser when you use sessions. Here's what happens in the background when you make a web request:

    > GET / HTTP/1.1
    Host: example.com
    Accept: */*
    
    < HTTP/1.1 200 OK
    < Date: Tue, 12 Jul 2011 07:00:26 GMT
    < Server: Apache
    < Set-Cookie: PHP_SESSID=2873fd75b29380bc9d775e43e41dc898; path=/; domain=example.com; secure
    < P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
    < Vary: Accept-Encoding
    < Content-Length: 5538
    < Content-Type: text/html; charset=UTF-8
    

    As you can see, I made a GET request and the server response with Set-Cookie: PHP_SESSID= followed by my session ID. Anyone that's "sniffing" the request who would be able to see the session ID in the JavaScript would be able to get it from the headers too. The only thing to worry about would be things like malicious browser plugins and other exploits that are not likely but can be avoided by properly securing your code.

    I'd recommend that you look at http://phpsec.org/projects/guide/4.html for some tips and information on session hijacking.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效