Giter Site home page Giter Site logo

Comments (4)

 avatar commented on May 28, 2024

尝试使用MD5token值加密

  get  'weixin/:encrypted_weixin_token', to: 'weixin#index'
  post 'weixin/:encrypted_weixin_token', to: 'weixin#reply'

缺点是要在Model里保存MD5值

from weixin_rails_middleware.

lanrion avatar lanrion commented on May 28, 2024

@turristan 一个是由开发者指定secret(自动生成到配置文件也可),通过这个sceret来做“混合”加密,这个是最简单的做法。另外一种可以考虑 "id+created_at+weixin_token" md5加密,同样,也是需要保存到库里,麻烦。第三种方法就是加密后的值,直接保存到用户配置的"token_column"内,页面上再解密显示。 你觉得哪种合适?

from weixin_rails_middleware.

 avatar commented on May 28, 2024

snapshot5

暴露在url中暴露token, 风险是程序可能被人盗用。

既然腾讯有一定的验证机制, 所以我们只要不暴露token就行了。
简单(到无脑)的方法是, Model 数据结构改成(rails g model WeiXinConfiguration secret token),将来还要加 app_keyapp_secret的。config 将 token_column 改成 secret_column。

  get  'weixin/:secret', to: 'weixin#index'
  post 'weixin/:secret', to: 'weixin#reply'

使用token_string也类似。
觉得加密并不是必须的。

from weixin_rails_middleware.

lanrion avatar lanrion commented on May 28, 2024

Fixed it in v1.1.0 version: https://github.com/lanrion/weixin_rails_middleware/tree/v1.1.0 .

from weixin_rails_middleware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.