【问题标题】:Passing Signatures Through AJAX for Security通过 AJAX 传递签名以确保安全
【发布时间】:2012-09-24 19:59:23
【问题描述】:

昨晚我阅读了有关通过 AJAX 传递签名以改进安全措施的信息。虽然我不记得它究竟阻止了什么,但我认为实施这样的措施没有任何问题。如果我在 AJAX 代码中实现签名,这样的结果会怎样?

//variable below passes through AJAX
$signature = time();

//AJAX file receives variable, checks it against this variable below
$signature2 = time();

//if signature1 and signature 2 are more than one minute apart the ajax file is 
dead

【问题讨论】:

  • 这是我不知道的问题。我可能会关闭这个问题。

标签: php ajax session jquery session-variables


【解决方案1】:

您可以尝试传递随机生成的“密钥”(每个用户一个)并保存在 cookie 中。然后,您从 JS 获取 cookie 获取 cookie 的值并将其发送到 PHP 文件。最后一个检查 ajax 发送的密钥是否与 cookie 中的相同。

【讨论】:

  • 这很愚蠢。服务器和客户端都可以访问 cookie 和 AJAX 变量。你什么都没有验证。
  • 我不打算使用 cookie,我会坚持使用会话数据。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-14
  • 2012-11-29
  • 1970-01-01
  • 2021-09-21
  • 1970-01-01
  • 2012-01-22
相关资源
最近更新 更多