
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-cnb 是一个用于访问 CNB API 的 node 编写的 SDK。
npm install node-cnb
import { getClient } from "node-cnb";
// 参数分别为 api url 和 访问令牌
const client = getClient("https://api.cnb.cool", "xxx");
client.users.pinnedRepos
.list({
username: "xxx",
})
.then((res) => {
console.log(res);
});
const sdk = require("node-cnb");
// 参数分别为 api url 和 访问令牌
const client = sdk.getClient("https://api.cnb.cool", "xxx");
client.users.pinnedRepos
.list({
username: "xxx",
})
.then((res) => {
console.log(res);
});
方法路径有两种模式
方法路径为由如下几个元素组成:
/-/ 前的参数名例如:
/{repo}/-/git/branches 的路径下 get 请求的方法名为 repo.git.branches.list
/{repo}/-/git/branches/{branch} 的路径下 get 请求方法名为 repo.git.branches.get
对于此规则下方法路径仍然重复的 api,则单独定义在 pathMethodMap.json
在 swagger json 中可以看到每个方法都有一个 Tag 和 operationId,
可以用 client.<Tag>.<operationId> 调用:
const sdk = require("node-cnb");
// 参数分别为 api url 和 访问令牌
const client = sdk.getClient("https://api.cnb.cool", "xxx");
client.Repositories.GetPinnedRepoByID({
username: "xxx",
})
.then((res) => {
console.log(res);
});
完整api路径请参考 client.d.ts
FAQs
node sdk for cnb open api
We found that node-cnb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.