Skip to content

[ultra-review] Required array inputs skip minItems validation (validation bypass) #1189

@l2ysho

Description

@l2ysho

Severity: HIGH
Location: src/lib/input_schema.ts:328-350
Parent: #1188

Problem

getAjvValidator deep-clones the schema into copyOfSchema (line 329), then the mutation loop iterates the original inputSchema.properties and sets inputSchemaField.minItems = Math.max(1, …) on the original object — but the validator is compiled from copyOfSchema (line 349). The minItems constraint therefore never reaches the compiled validator, so required array fields accept empty arrays. As a side effect, the caller's schema object is silently mutated.

Impact

Any Actor with a required array input field passes validation with an empty array in apify run / apify call (validator used at src/commands/run.ts:526,563,609).

Suggested fix

Iterate copyOfSchema.properties in the mutation loop so the minItems change lands on the schema that is actually compiled.

Generated by an ultra code review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-dxIssues owned by the DX team.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions