对应 docs/operation-audit-halo-compliance.md 评审的两项不符合与第 5 节修复建议: 1. API 客户端生成(清单第 2 条):build.gradle 配置 haloPlugin.openApi 管线; 查询/导出/测试端点补 tag、参数声明与类型化 response(生成契约输入); bootstrap OpenAPI 规范 JSON(与 Springdoc 声明一一对手工对齐)驱动 devtools generateApiClient 产出 TS 客户端(ui/src/api/generated,openapi-generator 7.7.0); UI 经 ui/src/api 封装层复用宿主 axiosInstance,替换手写类型与裸 fetch; @halo-dev/api-client 由死依赖转为 axiosInstance 实际来源。 2. 出站安全与凭据(清单第 4 条):新增 OutboundUrlGuard——URI 解析 + scheme 白名单 + 禁止用户名/密码形态 + 全量 DNS 解析并拒绝环回/私网/链路本地/组播/未指定/ 云元数据(169.254.169.254、100.100.100.200、fd00:ec2::254)/CGNAT/ULA/Teredo/ 6to4/文档与保留段;PinnedAddressResolverGroup 钉定校验地址建连(DNS rebinding 防护,TLS SNI/Host 仍取原主机名);重定向显式关闭、三层超时 10 秒。 Webhook 地址凭据迁移 Halo Secret(settings.yaml 改 secret 输入存引用,服务端经 ReactiveExtensionClient 解析键 webhookUrl,fail closed);日志只记主机名, 不再记录可能内嵌 access_token 的完整地址。 测试:后端 244 用例(新增守卫地址段枚举/Secret 解析 fail closed/建连钉定证明等 25 例)+ UI vitest 54 用例 + vue-tsc + ./gradlew build 全部通过。
111 lines
3.8 KiB
TypeScript
111 lines
3.8 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* Operation Audit Extension API
|
|
* 操作审计插件自有子资源端点(query/export/test)的 OpenAPI 契约。本文件为 bootstrap 契约(与 SpringdocRouteBuilder 声明一一对应手工对齐),供 devtools generateApiClient 离线生成 TS 客户端;待有可用的 Halo 实例(Docker haloServer 或 useExistingServer)时,运行 ./gradlew generateOpenApiDocs 将以运行时 springdoc 输出覆盖本文件,再重新生成客户端即可(generateApiClient 每次先清空 outputDir)。版本号与插件版本保持同步。
|
|
*
|
|
* The version of the OpenAPI document: 0.1.0-SNAPSHOT
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
export interface ConfigurationParameters {
|
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
username?: string;
|
|
password?: string;
|
|
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
basePath?: string;
|
|
serverIndex?: number;
|
|
baseOptions?: any;
|
|
formDataCtor?: new () => any;
|
|
}
|
|
|
|
export class Configuration {
|
|
/**
|
|
* parameter for apiKey security
|
|
* @param name security name
|
|
* @memberof Configuration
|
|
*/
|
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
/**
|
|
* parameter for basic security
|
|
*
|
|
* @type {string}
|
|
* @memberof Configuration
|
|
*/
|
|
username?: string;
|
|
/**
|
|
* parameter for basic security
|
|
*
|
|
* @type {string}
|
|
* @memberof Configuration
|
|
*/
|
|
password?: string;
|
|
/**
|
|
* parameter for oauth2 security
|
|
* @param name security name
|
|
* @param scopes oauth2 scope
|
|
* @memberof Configuration
|
|
*/
|
|
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
/**
|
|
* override base path
|
|
*
|
|
* @type {string}
|
|
* @memberof Configuration
|
|
*/
|
|
basePath?: string;
|
|
/**
|
|
* override server index
|
|
*
|
|
* @type {number}
|
|
* @memberof Configuration
|
|
*/
|
|
serverIndex?: number;
|
|
/**
|
|
* base options for axios calls
|
|
*
|
|
* @type {any}
|
|
* @memberof Configuration
|
|
*/
|
|
baseOptions?: any;
|
|
/**
|
|
* The FormData constructor that will be used to create multipart form data
|
|
* requests. You can inject this here so that execution environments that
|
|
* do not support the FormData class can still run the generated client.
|
|
*
|
|
* @type {new () => FormData}
|
|
*/
|
|
formDataCtor?: new () => any;
|
|
|
|
constructor(param: ConfigurationParameters = {}) {
|
|
this.apiKey = param.apiKey;
|
|
this.username = param.username;
|
|
this.password = param.password;
|
|
this.accessToken = param.accessToken;
|
|
this.basePath = param.basePath;
|
|
this.serverIndex = param.serverIndex;
|
|
this.baseOptions = param.baseOptions;
|
|
this.formDataCtor = param.formDataCtor;
|
|
}
|
|
|
|
/**
|
|
* Check if the given MIME is a JSON MIME.
|
|
* JSON MIME examples:
|
|
* application/json
|
|
* application/json; charset=UTF8
|
|
* APPLICATION/JSON
|
|
* application/vnd.company+json
|
|
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
* @return True if the given MIME is JSON, false otherwise.
|
|
*/
|
|
public isJsonMime(mime: string): boolean {
|
|
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
}
|
|
}
|