Skip to content

feat: Extend automated ingredient validation to include argSelector ingredients (#2641)#2643

Open
mansiverma897993 wants to merge 1 commit into
gchq:masterfrom
mansiverma897993:argselector-validation-2641
Open

feat: Extend automated ingredient validation to include argSelector ingredients (#2641)#2643
mansiverma897993 wants to merge 1 commit into
gchq:masterfrom
mansiverma897993:argselector-validation-2641

Conversation

@mansiverma897993

@mansiverma897993 mansiverma897993 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Description

This PR extends the automated ingredient validation framework to include argSelector ingredients, resolving a bug where providing empty or invalid values to argSelector inputs (like cipher modes or key/IV source options) caused unhandled runtime exceptions instead of clean validation errors.

How it addresses the issue:

  1. src/core/Ingredient.mjs:
    • Detects if the ingredient is of type argSelector.
    • Resolves array-like defaultValue configurations to their selected index string (checkVal[this.defaultIndex ?? 0]?.name || "") to prepare for validation checks.
    • Updates the empty check logic (isAllowedOptionEmpty) to check if any of the option names is "".
    • Adds validation to map each object in the defaultValue array to its name property, filters out optgroups ([Group 1]), and verifies that checkVal matches one of the permitted options case-insensitively.
  2. src/node/api.mjs:
    • Updates the transformArgs wrapper mapping so that omitted argSelector arguments automatically resolve to their default string option (e.g. "CBC" or "Off") instead of remaining an array of configuration objects, which would trigger runtime exceptions inside the operations.
  3. tests/operations/tests/AutomatedValidation.mjs:
    • Configured AutomatedValidationTestOp to include a test argSelector ingredient.

@mansiverma897993

Copy link
Copy Markdown
Contributor Author

@GCHQDeveloper581 take a look and leeme know if any changes required !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Extend automated ingredient validation to include "argSelector" ingredients

1 participant