fix(workflow): prevent prototype traversal and inherited CLI authorization

This commit is contained in:
gitea committed 2026-10-20 17:52:14 +08:00
1 parent fac81b08e8
commit d2e0d564ca
6 files changed
+62 -31

No files matched your search

+4 -1
View File
@@ -58,7 +58,7 @@ export function isJsonRequested(raw: string[]): boolean {
}
export function parseArgs(rawArgs: string[], areaOverride?: string): CliParsedArgs {
const options: Record<string, string | boolean | number> = {};
const options: Record<string, string | boolean | number> = Object.create(null);
const positional: string[] = [];
const context = findContext(rawArgs, areaOverride);
const flags = commandFlags(context.area, context.action);
@@ -115,6 +115,7 @@ export function stringOption(
fallback?: string
): string | undefined {
for (const k of keys) {
if (!Object.hasOwn(options, k)) continue;
const val = options[k];
if (typeof val === "string" && val.length > 0) return val;
}
@@ -127,6 +128,7 @@ export function booleanOption(
fallback: boolean = false
): boolean {
for (const k of keys) {
if (!Object.hasOwn(options, k)) continue;
const val = options[k];
if (typeof val === "boolean") return val;
if (typeof val === "string") {
@@ -144,6 +146,7 @@ export function numberOption(
fallback?: number
): number | undefined {
for (const k of keys) {
if (!Object.hasOwn(options, k)) continue;
const val = options[k];
if (typeof val === "number" && !Number.isNaN(val)) return val;
if (typeof val === "string") {