Skip to content

feat: Implement automated option-type ingredient validation#2625

Merged
GCHQDeveloper581 merged 4 commits into
gchq:masterfrom
mansiverma897993:feature/automated-parameter-validation
Jul 4, 2026
Merged

feat: Implement automated option-type ingredient validation#2625
GCHQDeveloper581 merged 4 commits into
gchq:masterfrom
mansiverma897993:feature/automated-parameter-validation

Conversation

@mansiverma897993

@mansiverma897993 mansiverma897993 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description

This PR extends the automated parameter validation framework to include validation of "option" type ingredients.
It implements global, automated checks for option parameters in Ingredient.mjs, filters out markdown-based optgroup headings, handles case-insensitive matches, and resolves default option list values (including array-based defaults) during hydration and validation.
It also fixes related option config typos and missing parameters in existing ciphers (e.g., SM4Encrypt mode list) and test definitions.

Existing Issue

Fixes #2623

AI disclosure

Gemini 3.5 Flash was used to help implement and verify these changes.

Test Coverage

Added tests in tests/operations/tests/AutomatedValidation.mjs verifying Option type argument validation:

  • Valid option parameter inputs.
      • Invalid option parameter inputs.
      • Optgroup subheadings are rejected.
      • Omitted/empty inputs behave correctly based on the allowEmpty configuration.
    • All 2,059 operation tests and 254 Node API tests pass successfully.

@GCHQDeveloper581

Copy link
Copy Markdown
Contributor

Just as a general comment - it would be hugely preferable if you raised PRs against CyberChef manually through the Github web ui, or at least ensured that the headings that the PR template adds are all present and completed.

The PR section headings should include:
Description
Existing Issue
AI disclosure
Test Coverage

In particular for this specific PR could you add an AI disclosure (which can, if appropriate be "No AI used")

@mansiverma897993

Copy link
Copy Markdown
Contributor Author

@GCHQDeveloper581 Apologies for the oversight! I have updated the PR description to follow the repository template, including the requested sections and the AI disclosure. Thank you!

@GCHQDeveloper581 GCHQDeveloper581 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GCHQDeveloper581

Copy link
Copy Markdown
Contributor

Thanks for updating the PR description

Please could you state the specific AI / version in the declaration as well - eg "GPT 5.5 was used to help implement and verify these changes."

@mansiverma897993

Copy link
Copy Markdown
Contributor Author

@GCHQDeveloper581 I have updated the validation logic in Ingredient.mjs to handle empty/omitted parameters correctly. Explicitly empty options (like in View_Bit_Plane('', 0)) are now rejected unless the options list explicitly permits them, while unspecified/hidden parameters now resolve to their default values.

I've also updated the PR description to explicitly declare the use of Gemini 3.5 Flash. All 2,059 tests are now fully passing.

@mansiverma897993

Copy link
Copy Markdown
Contributor Author

@GCHQDeveloper581 lemme know any further changes is required !!

Comment thread src/core/Ingredient.mjs Outdated
@mansiverma897993

Copy link
Copy Markdown
Contributor Author

@GCHQDeveloper581 I think now it's resloved !! take a look again

@GCHQDeveloper581 GCHQDeveloper581 enabled auto-merge (squash) July 4, 2026 11:18

@GCHQDeveloper581 GCHQDeveloper581 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Many thanks for your contribution.

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 "option" ingredients

2 participants