air_wang 发表于 2009-3-25 23:16:00

CI的session安全问题

本帖最后由 air_wang 于 2009-3-25 23:18 编辑

《Professional Codeigniter》的第82页有以下这段话:
Here ’ s a very important note if you are security conscious. Even if you choose to save CodeIgniter
sessions in a database table, the same data are stored in a client - side cookie. That means that it is
available to the end - user. Even if you use encryption, it is possible to tamper with the cookie and thereby
cause problems. Therefore, in this book (and in your foreseeable CodeIgniter career), only use
CodeIgniter sessions (and flashdata) to store data that are unimportant. If you need to have secure
logins and authentication, use PHP sessions instead.
大致意思就是CI的session不够安全,如果有重要的数据,比如认证登录之类的数据还是需要用PHP sessions,请教各位高手,你们在做实际项目当中是使用CI的session还是PHP session,谢谢!
ps:我是指最新的1.7.1版本的session有没有改观,看到HEX老大之前的回复了。

neversaylate 发表于 2009-3-26 16:59:01

Because CodeIgniter sessions are cookies, you have the same limitations as you do with cookies
in general. For example, cookies can be tampered with by the end - user. This makes CodeIgniter
sessions (even if the data in them are encrypted) hard to trust. Another limitation is the fact that
a session cookie only holds 4 KB (kilobytes) of data. It is possible for someone to fill up their
session cookie either accidentally or with malicious intent.

You ’ re going to combine the two approaches. Your more sensitive data are going to go into PHP sessions.
Other data, like a flag that indicates whether there are any items in the Shopping Cart, will go into the
CodeIgniter session.

Hex 发表于 2009-3-26 17:04:45

CI 的 Session 是用 cookie 实现的,使用 cookie 是有其目的的,估计短期内不会换成其它方式,不过 171 提供了数据库方式,这个就没有安全问题了。
这个就要看你的应用打算怎么用 session 了,我在自己的应用中基本不使用 CI 自带的 Session。

kazaff 发表于 2009-8-28 09:55:46

不使用CI的session的话,怎么用session??我是菜鸟

Hex 发表于 2009-8-28 10:25:52

不使用CI的session的话,怎么用session??我是菜鸟
kazaff 发表于 2009-8-28 09:55 http://codeigniter.org.cn/forums/images/common/back.gif
用 KNDB Session

kazaff 发表于 2009-8-28 15:41:27

HEX大,1.7.1的CI的自带session如果用database存的话,还有什么问题么?
我是新手,没接触过以前的CI版本,听大家一直反复讨论CI的自带session,给我一种CI的自带session根本不能用的感觉!
如果开发一般的项目,我用自带的session存到数据库里,有啥弊端么?

还有,记得HEX说过,KNDB Session的使用方式和自带的一模一样,也就是说就是以前的老程序,也能平滑的用KNDB Session来代替原始session吧?

Hex 发表于 2009-8-28 17:18:41

第一个问题,用也没什么弊端,只是 session 都存储在客户端,可能会有安全问题。(是加密存储)
第二个问题,是一样的,可以平滑迁移。你可以测试一下呀。

kazaff 发表于 2009-8-29 07:56:59

谢谢HEX大

spt119 发表于 2009-8-29 10:47:10

使用PHP的原生session模式。
具体办法是在根目录,及与system同级目录下的index.php文件首行,加入:
Session_start();

kazaff 发表于 2009-8-29 11:22:37

LS的这么做也很帅啊,考虑~
页: [1] 2
查看完整版本: CI的session安全问题