Skip to content

Commit

Permalink
Yj/feat/audit code2.0 (#2172)
Browse files Browse the repository at this point in the history
* feat:新增组件YakitVirtualList

* style:增加overflow:hidden

* feat: 新增项目管理

* feat: 审计功能扩展

* feat: 代码审计新流程处理

* feat: 暂存代码

* feat: 审计交互逻辑扩展

* feat: 图标替换与功能补充

* fix: 右部跳转逻辑完善

* feat: 审计代码段扩展为Codemirror展示

* feature(protoc):get json schema from backend

* feat: JsonSchema构建完成

* protoc: add SSAProgram and scan manage API

* feat: 项目管理接口接入

* feat: JsonSchema应用扩展

* fix: JsonSchema数据收集处理

* fix: 继续扩展 JsonSchema数据收集

* feat: 双流暂存

* feat: 代码扫描接入编译

* feat: yakrunner在远程模式下 支持手动输入路径

* fix: 上传文案更改

* protoc:modify protoc remove useless method

* feat: 新增项目管理\代码审计-重新编译

* fix: 项目管理列表排序处理

* fix: 细节打磨

1.解决字体大小
2.解决布局未对齐
3.点完开始后把参数收起
4.跳转切换为已编译项目
5.进度条日志进度条
6.项目关联删除后重置选择项

* fix: 细节收尾

* fix: 删除无关依赖项

---------

Co-authored-by: luoluo <[email protected]>
Co-authored-by: wlz <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2024
1 parent e4762fd commit 0d3afd4
Show file tree
Hide file tree
Showing 81 changed files with 4,867 additions and 1,834 deletions.
60 changes: 54 additions & 6 deletions app/main/handlers/syntaxFlow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {ipcMain} = require("electron");
const {ipcMain} = require("electron")

module.exports = (win, getClient) => {
const asyncQuerySyntaxFlowRuleGroup = (params) => {
Expand Down Expand Up @@ -34,16 +34,16 @@ module.exports = (win, getClient) => {
})

// 规则执行
const handlerHelper = require("./handleStreamWithContext");
const streamSyntaxFlowScanMap = new Map();
ipcMain.handle("cancel-SyntaxFlowScan", handlerHelper.cancelHandler(streamSyntaxFlowScanMap));
const handlerHelper = require("./handleStreamWithContext")
const streamSyntaxFlowScanMap = new Map()
ipcMain.handle("cancel-SyntaxFlowScan", handlerHelper.cancelHandler(streamSyntaxFlowScanMap))
ipcMain.handle("SyntaxFlowScan", (e, params, token) => {
let stream = streamSyntaxFlowScanMap.get(token)
if (stream) {
stream.write(params)
return
}
stream = getClient().SyntaxFlowScan();
stream = getClient().SyntaxFlowScan()
stream.write(params)
handlerHelper.registerHandler(win, stream, streamSyntaxFlowScanMap, token)
})
Expand All @@ -63,4 +63,52 @@ module.exports = (win, getClient) => {
ipcMain.handle("QuerySyntaxFlowResult", async (e, params) => {
return await asyncQuerySyntaxFlowResult(params)
})
}

const asyncQuerySSAPrograms = (params) => {
return new Promise((resolve, reject) => {
getClient().QuerySSAPrograms(params, (err, data) => {
if (err) {
reject(err)
return
}
resolve(data)
})
})
}
// 获取项目管理列表
ipcMain.handle("QuerySSAPrograms", async (e, params) => {
return await asyncQuerySSAPrograms(params)
})

const asyncUpdateSSAProgram = (params) => {
return new Promise((resolve, reject) => {
getClient().UpdateSSAProgram(params, (err, data) => {
if (err) {
reject(err)
return
}
resolve(data)
})
})
}
// 更新项目管理数据
ipcMain.handle("UpdateSSAProgram", async (e, params) => {
return await asyncUpdateSSAProgram(params)
})

const asyncDeleteSSAPrograms = (params) => {
return new Promise((resolve, reject) => {
getClient().DeleteSSAPrograms(params, (err, data) => {
if (err) {
reject(err)
return
}
resolve(data)
})
})
}
// 删除项目管理数据
ipcMain.handle("DeleteSSAPrograms", async (e, params) => {
return await asyncDeleteSSAPrograms(params)
})
}
3 changes: 3 additions & 0 deletions app/main/handlers/yakRunnerTerminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ module.exports = (win, getClient) => {
// 如果有问题,重置
stream.on("error", (e) => {
removeStreamRunner(id)
if(win){
win.webContents.send("client-listening-terminal-error", {id, path})
}
})

// 发送回数据
Expand Down
36 changes: 21 additions & 15 deletions app/protos/grpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5554,29 +5554,30 @@ message SSAProgram{
string Language = 6;
string EngineVersion = 7;

// need re-compile
// need re-compile
bool Recompile = 8;
// risk number
// risk number
int64 HighRiskNumber = 9;
int64 CriticalRiskNumber = 10;
int64 WarnRiskNumber = 11;
int64 LowRiskNumber = 12;
uint32 Id = 13;
}

message SSAProgramInput {
string Name = 1; // index
string Description = 2;
string Name = 1; // index
string Description = 2;
}

message SSAProgramFilter{
repeated string ProgramNames = 1;
repeated string Languages = 2;
repeated int64 Ids = 3;
repeated string ProgramNames = 1;
repeated string Languages = 2;
repeated int64 Ids = 3;

// update range
int64 BeforeUpdatedAt = 5;
int64 AfterUpdatedAt = 6;
// fuzz search
// fuzz search
string Keyword = 7 ;
// id range
int64 AfterID = 8;
Expand All @@ -5585,10 +5586,19 @@ message SSAProgramFilter{


message QuerySSAProgramRequest{
Paging Paging = 1;
Paging Paging = 1; // abort
Paging Pagination = 2;
SSAProgramFilter Filter = 3;
}

message QuerySSAProgramResponse{
Paging Paging = 1; // abort
Paging Pagination = 5;
repeated SSAProgram Programs = 2; // abort
repeated SSAProgram Data = 4;
int64 Total = 3;
}

message UpdateSSAProgramRequest{
SSAProgramInput ProgramInput = 1;
}
Expand All @@ -5598,11 +5608,6 @@ message DeleteSSAProgramRequest{
SSAProgramFilter Filter = 2;
}

message QuerySSAProgramResponse{
Paging Paging = 1;
repeated SSAProgram Programs = 2;
int64 Total = 3;
}

message CreateSyntaxFlowRuleRequest{
SyntaxFlowRuleInput SyntaxFlowInput = 1;
Expand Down Expand Up @@ -5646,14 +5651,15 @@ message SyntaxFlowScanRequest{

// 启动扫描任务
SyntaxFlowRuleFilter Filter = 2; // 用于指定扫描的规则
repeated string ProgramName = 3; // 用于指定扫描的程序
repeated string ProgramName = 3; // 用于指定扫描的程序
// 恢复扫描任务
string ResumeTaskId = 5; // 恢复任务ID

// 其他参数
bool IgnoreLanguage = 4; // 是否忽略语言 默认为false 将会只运行和当前项目语言一致的规则,最后运行的规则可能会比当前选中的规则少一些。
}


message QuerySyntaxFlowScanTaskRequest{
Paging Pagination = 1;
SyntaxFlowScanTaskFilter Filter = 2;
Expand Down
5 changes: 5 additions & 0 deletions app/renderer/src/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"@dnd-kit/core": "^4.0.1",
"@hello-pangea/dnd": "16.5.0",
"@prettier/plugin-xml": "^3.2.2",
"@rjsf/antd": "^5.22.4",
"@rjsf/core": "^5.22.4",
"@rjsf/utils": "^5.22.4",
"@rjsf/validator-ajv8": "^5.22.4",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
Expand All @@ -32,6 +36,7 @@
"axios": "^1.4.0",
"bizcharts": "^4.1.12",
"classnames": "^2.3.2",
"codemirror": "^5.65.2",
"cross-env": "7.0.3",
"customize-cra": "^1.0.0",
"diff": "^7.0.0",
Expand Down
Loading

0 comments on commit 0d3afd4

Please sign in to comment.