可信代码库-软件详情增加恶意代码信息

This commit is contained in:
付民康
2025-04-16 14:57:11 +08:00
parent 82f47b1f7f
commit 08688bdaa7
7 changed files with 888 additions and 12 deletions

View File

@@ -0,0 +1,69 @@
import request from '@/utils/request';
import {
type ListReqResData,
type MalwareDetailType,
type MalwareListItemType,
type UnitRes
} from "@/api/inboundTask/inboundTaskType";
import axios from 'axios';
export function inboundTaskReview(params: { taskId: number, isPass: number, approvalComment: string }): Promise<UnitRes<boolean>> {
return request({
url: `/task/storage/approvalTask`,
method: 'post',
data: params,
});
}
export function getMalwareListApi(params: { taskId: number, softwareId: number, current: number, size: number }): Promise<UnitRes<ListReqResData<MalwareListItemType>>> {
return axios.request({
url: '/gateway/detect' + `/malicious/queryPage`,
method: 'POST',
data: params,
headers: {
Authorization: 'Bearer ' + localStorage.getItem('access_token'),
},
});
}
export function getMalwareDetailApi(id: string | number): Promise<UnitRes<MalwareDetailType>> {
return axios.request({
url: '/gateway/detect' + `/maliciousDetails/detailById/${id}`,
method: 'get',
});
}
export function getMalwareDetailApi2(params) {
return request({
url: `/maliciousDetails/pageList`,
method: 'post',
data: params,
});
}
// 17. 申请入库-保存草稿
export function applicationTaskSave(params: any) {
return request({
url: `/software/saveInfo`,
method: 'post',
data: params,
}).then(res => res.data || {});
}
// 17. 申请入库-提交
export function applicationTaskSubmit(params: {softwareId: number}) {
return request({
url: `/task/storage/startTask`,
method: 'post',
data: params,
}).then(res => res.data || {});
}
// 17. 查询任务对应的入库软件id
export function queryTaskSoftwareDetail(params: {taskId: number}) {
return request({
url: `/task/storage/taskDetail`,
method: 'post',
data: params,
});
}

View File

@@ -0,0 +1,61 @@
import { type AxiosResponse } from "axios";
export interface CommonRes<T> {
code: number;
msg: string;
data: T;
}
export type UnitRes<T> = AxiosResponse<CommonRes<T>>;
export interface ListReqResData<T> {
records: T[];
total: number;
size: number;
current: number;
orders: any[];
optimizeCountSql: boolean;
searchCount: boolean;
countId: null;
maxLimit: null;
pages: number;
}
export interface MalwareListItemType {
id: number;
taskId: number; // 【扫描任务ID】
softwareId: number; // 【软件ID】
packageFullName: string; // 【包全名】
packagePath: string; // 【包路径】
packageName: string; // 【包名称】
packageVersion: string; // 【包版本号】
timestamp: string; // 【检测时间】
llmName: string; // 【使用的LLM名称】
totalApisCalledCount: number; // 【调用的敏感API总数】
suspiciousFilesCount: number; // 【检测的可疑文件总数】
isMalicious: number; // 【是否包含恶意代码】
isModelResponded: number; // 【大模型是否正常回复】
createTime: string; // 【创建时间】
updateTime: string;
}
export interface MalwareDetailType {
id: number;
resultId: number;
filePath: string;
codeType: string;
identifier: string;
tokenNum: number;
code: string;
suspiciousBehaviors: string; // 威胁信息 Array<string> 转换成的 JSON 字符串
apisCalled: string; // Array<string> 转换成的 JSON 字符串
isMalicious: number;
maliciousCodeCategory: string;
source: string;
sink: string;
flow: string;
purpose: string;
analysis: string;
createTime: string;
updateTime: string;
}