
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@fe-cookie/client-request-crypto
Advanced tools
全局拦截API 请求的参数[GET/POST],并转换为 JSON 格式。- 请求体中附加时间戳参数,参数字段为
_,值为时间戳。- 对转换后的请求体 JSON 进行排序,
- 对排序好的 JSON 进行字符串拼接,
- 拼接好的字符串(通过
key=val&)最后再附加上固定盐值得到最后需要加密的字符串(即...&key=val&salt)。- 使用
MD5的方式加密最后拼接的字符串,得到加密密钥。
- 只对对象的 key 进行排序。
- 进行深度遍历排序。
- 当遇到数组时,检测数组的每项值,若为
对象(Object/Array)则遍历对象进行递归排序,其他类型不做处理。
- 遍历 JSON 对象(只遍历第一层),通过
key=val&的方式进行拼接 (使用&符合进行字段间的拼接)。- 当某个 key 对应的值为
Object类型时候(即:JSON/Array)时,通过JSON.stringify转换为字符串再进行拼接。
import { clientCrypto } from '@fe-cookie/client-request-crypto'
// mock api params
// GET OR POST 请求
const getParams = {
name: 'gaga',
age: 20
}
const { sign } = clientCrypto({ params, salt: 'xxx' })
axios({
url: 'xxx',
method: 'GET',
headers: {
'X-AUTHO-TOKEN': sign
}
})
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.