From d4eeea2c839860720ef5281ad815af7812606df9 Mon Sep 17 00:00:00 2001 From: Jamie Nelson Date: Sun, 11 Oct 2026 07:59:03 +1100 Subject: [PATCH 1/2] fix: validate configured README sections before generation --- src/inputs.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/inputs.ts b/src/inputs.ts index 66b945fe..1c614d8e 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -963,7 +963,17 @@ export default class Inputs { 'sections', inputContext.sections ?? (this.config.get('sections') as ReadmeSection[]), ); - this.sections = this.config.get('sections') as ReadmeSection[]; + const configuredSections: unknown = this.config.get('sections'); + if ( + !Array.isArray(configuredSections) || + !configuredSections.every( + (section: unknown) => + typeof section === 'string' && (README_SECTIONS as readonly string[]).includes(section), + ) + ) { + throw new Error('Invalid sections configuration: expected an array of supported README sections'); + } + this.sections = configuredSections as ReadmeSection[]; this.readmePath = inputContext.readmePath ?? path.resolve(this.config.get(ConfigKeys.pathsReadme) as string); this.readmeEditor = inputContext.readmeEditor ?? new ReadmeEditor(this.readmePath); From df9882e17062e8805cc6072f7f78f4eacf5867b1 Mon Sep 17 00:00:00 2001 From: Jamie Nelson Date: Sun, 11 Oct 2026 09:43:08 +1100 Subject: [PATCH 2/2] fix: retain unknown section tolerance while validating array shape --- src/inputs.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/inputs.ts b/src/inputs.ts index 1c614d8e..5dfcdc4a 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -964,14 +964,8 @@ export default class Inputs { inputContext.sections ?? (this.config.get('sections') as ReadmeSection[]), ); const configuredSections: unknown = this.config.get('sections'); - if ( - !Array.isArray(configuredSections) || - !configuredSections.every( - (section: unknown) => - typeof section === 'string' && (README_SECTIONS as readonly string[]).includes(section), - ) - ) { - throw new Error('Invalid sections configuration: expected an array of supported README sections'); + if (!Array.isArray(configuredSections) || !configuredSections.every((section: unknown) => typeof section === 'string')) { + throw new Error('Invalid sections configuration: expected an array of section names'); } this.sections = configuredSections as ReadmeSection[]; this.readmePath =