Skip to content

test: add mutation-style regression coverage for validation#1315

Open
mythri2405 wants to merge 4 commits into
utksh1:mainfrom
mythri2405:task-886-tests-only
Open

test: add mutation-style regression coverage for validation#1315
mythri2405 wants to merge 4 commits into
utksh1:mainfrom
mythri2405:task-886-tests-only

Conversation

@mythri2405

Copy link
Copy Markdown
Contributor

Description

This PR adds mutation-style regression coverage for critical safe-mode validation branches in testing/backend/unit/test_validation.py.
The added tests strengthen negative-path coverage for security-sensitive validation logic and help prevent regressions caused by future refactors. The focus is on exercising existing validation behavior without modifying validation semantics.

Key additions

  • Added coverage for safe-mode rejection of unresolved hostnames
  • Added regression tests for public IP blocking in safe mode
  • Added coverage for link-local and multicast target rejection
  • Added tests for multi-record hostname resolution scenarios
  • Added loopback validation coverage under configuration constraints
  • Added allowed-network enforcement coverage for hostname resolution paths

Related Issues

Closes #886

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Executed the validation test suite locally:

python -m pytest testing/backend/unit/test_validation.py -v

Result:

47 passed, 1 warning

Coverage verified for:

  • Safe-mode hostname validation
  • Public IP rejection in safe mode
  • Link-local and multicast target blocking
  • Loopback restrictions when disabled by configuration
  • Multi-resolution hostname validation behavior
  • Allowed-network enforcement checks

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.

@utksh1 utksh1 added level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label area:backend Backend API, database, or service work labels Jun 26, 2026

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please revise before merge: this PR removes existing resolve_and_validate_target coverage while adding validation tests. Keep the existing webhook/target validation regression tests and add the new cases without reducing coverage.

@utksh1 utksh1 added gssoc:invalid Admin validation: invalid for GSSoC scoring and removed gssoc:invalid Admin validation: invalid for GSSoC scoring labels Jun 29, 2026

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for this contribution! I've reviewed the proposal and it looks like a valid addition. However, this branch currently has Git merge conflicts with main. Could you please pull the latest changes from upstream, resolve the conflicts, and push the rebased branch so we can continue the review process?

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

Labels

area:backend Backend API, database, or service work level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Add mutation-style coverage for safe-mode validation branches

2 participants