imsun / gitment

A comment system based on GitHub Issues.

Home Page:https://imsun.github.io/gitment/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

暴露 client secret 的问题

handsomecheung opened this issue · comments

既然请求 proxy server 是不能避免的(因为 CORS Header),那可以在 proxy server 提供加密接口,通过 host 和 passphrase 加密 client secret,在获取 access token 时,仅提供 encoded client secret 即可,proxy server 通过 Referer 和内置的 passphrase 解密 encoded client secret 后转发给 github API。

虽然 Referer 也可以伪造,但应该能在一定程度上防止 client secret 被恶意使用。而且获取 access token 必须经过 proxy server,所有恶意请求也都能被追溯以及控制。

不知道这个方案如何?