Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
grpc-code-gen
Advanced tools
Code generator for grpc, for typescript and javascript.
grpc-code-gen gen -u git@git.myscrm.cn:2c/panther-statistics-proto.git,git@git.myscrm.cn:2c/panther-third-proto.git -b test -t ${token} -d test/code-gen-cli
//grpc-code-gen.config.js
module.exports = {
gitUrls: [
{
url: 'git@git.myscrm.cn:ykcommon/ykproto.git',
branch: 'master',
},
'git@git.myscrm.cn:2c/panther-statistics-proto.git',
'git@git.myscrm.cn:2c/panther-third-proto.git',
],
branch: 'test',
accessToken: '${token}',
baseDir: `${__dirname}/code-gen`,
resolvePath: (origin, target, rootDir) => {
if (/^git\.myscrm\.cn\/golang\/common\/proto\/(google|common)\//.test(target)) {
return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target.replace(/^git\.myscrm\.cn\/golang\/common\/proto\//, '')}`;
} else if (/^proto\/(common|google)\//.test(target)) {
return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target.replace(/^proto\//, '')}`;
} else if (/^proto\//.test(target)) {
return target.replace(/^proto\/([^\/]+)(.+)/, (_target, $1, $2) => {
return `${rootDir}/git.myscrm.cn/2c/${$1.replace(/_/g, '-')}${$2}`;
});
} else if (/^(common|google\/api)\//.test(target)) {
return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target}`;
}
return null;
},
};
then
grpc-code-gen gen
参数 | 类型 | 说明 | 默认值 |
---|---|---|---|
gitUrls | Array<string | {url: string, branch?: string, accessToken?: string}> | 仓库地址数组 | null |
branch | string | 分支,如参数没有,会去读取环境变量参数branch | null |
accessToken | string | git access token | null |
baseDir? | string | 生成目录 | null |
target? | javascript typescript | 目标语言 | null |
grpcNpmName? | string | grpc npm name, 可取值:grpc , @grpc/grpc-js , @yued/grpc-js | @grpc/grpc-js |
jsonSemanticTypes? | boolean | 生成json semantic types | false |
serviceCode? | boolean | 生成客户端代码 | true |
loaderOptions? | LoaderOptions | loader生成配置 | { defaults: true } |
callOptions? | callOptions | 方法调用配置 | null |
logOptions? | logOptions | 日志配置 | null |
参数 | 类型 | 说明 | 默认值 |
---|---|---|---|
timeout? | number | 超时时间,单位:ms | undefined |
参数 | 类型 | 说明 | 默认值 |
---|---|---|---|
disable? | boolean | 是否启用 | false |
attributes? | string[] | 记录字段,request, response | ['request'] |
const base = require('grpc-code-gen/build/base');
base.gen({
gitUrls: [
{
url: 'git@git.myscrm.cn:ykcommon/ykproto.git',
branch: 'master',
},
'git@git.myscrm.cn:2c/panther-statistics-proto.git',
'git@git.myscrm.cn:2c/panther-third-proto.git',
],
branch: 'test',
accessToken: process.env.token,
baseDir: `${__dirname}/code-gen`,
resolvePath: (origin, target, rootDir) => {
if (/^git\.myscrm\.cn\/golang\/common\/proto\/(google|common)\//.test(target)) {
return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target.replace(/^git\.myscrm\.cn\/golang\/common\/proto\//, '')}`;
} else if (/^proto\/(common|google)\//.test(target)) {
return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target.replace(/^proto\//, '')}`;
} else if (/^proto\//.test(target)) {
return target.replace(/^proto\/([^\/]+)(.+)/, (_target, $1, $2) => {
return `${rootDir}/git.myscrm.cn/2c/${$1.replace(/_/g, '-')}${$2}`;
});
} else if (/^(common|google\/api)\//.test(target)) {
return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target}`;
}
return null;
},
})
.catch((err)=>{
console.error(err.stack)
});
FAQs
Code generator for grpc, for typescript and javascript.
The npm package grpc-code-gen receives a total of 3 weekly downloads. As such, grpc-code-gen popularity was classified as not popular.
We found that grpc-code-gen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.