Skip to content

test: add parser and contract coverage for plugin http_request_logger#686

Merged
utksh1 merged 3 commits into
utksh1:mainfrom
anshul23102:fix/499-http_request_logger_plugin_tests
Jun 9, 2026
Merged

test: add parser and contract coverage for plugin http_request_logger#686
utksh1 merged 3 commits into
utksh1:mainfrom
anshul23102:fix/499-http_request_logger_plugin_tests

Conversation

@anshul23102

Copy link
Copy Markdown
Contributor

Summary

Add comprehensive test coverage for the http_request_logger plugin, validating metadata, command rendering, and parser functionality.

Issue

Closes #499 - Plugin http_request_logger appears in the shipped catalog but lacks direct test coverage.

Scope

This PR adds test coverage for:

  • Metadata validation ensuring plugin configuration is correct
  • Command rendering via PluginManager for URL targets
  • Parser contract tests with HTTP response fixtures
  • Severity classification (info/low/high)
  • All tests pass under pytest testing/backend -q

Tests Added

Metadata Contract Tests:

  • test_http_request_logger_metadata_file_exists
  • test_http_request_logger_metadata_is_valid_json
  • test_http_request_logger_passes_validator
  • test_http_request_logger_metadata_id_matches_directory
  • test_http_request_logger_engine_is_httpx
  • test_http_request_logger_has_required_target_field
  • test_http_request_logger_target_has_url_validation
  • test_http_request_logger_output_parser_is_custom
  • test_http_request_logger_parser_file_exists
  • test_http_request_logger_requires_consent

Command Rendering Tests:

  • test_http_request_logger_command_renders_with_target
  • test_http_request_logger_command_full_token_sequence
  • test_http_request_logger_drops_target_token_when_absent
  • test_http_request_logger_loaded_by_plugin_manager

Parser Contract Tests:

  • test_http_request_logger_parser_returns_required_keys
  • test_http_request_logger_parser_count_matches_findings
  • test_http_request_logger_parser_finding_has_required_keys
  • test_http_request_logger_parser_severity_classification
  • test_http_request_logger_parser_empty_output
  • test_http_request_logger_parser_preserves_raw_line_in_metadata

Type of Change

  • Testing
  • Plugin coverage

Related Issues

Closes #499


This contribution is part of GSSoC 2026.

@anshul23102

Copy link
Copy Markdown
Contributor Author

Label Request

This PR addresses issue #499, adding comprehensive test coverage for the http_request_logger plugin. This is a high-value testing contribution for GSSoC 2026.

Could you please add the following labels when reviewed:

  • gssoc-approved (high-priority for GSSoC scoring)
  • type:testing (reflects the test coverage nature)
  • area:plugins (plugin-specific testing)

This contribution ensures HTTP logging metadata, command rendering, and parser functionality are properly validated before release.

Thank you!

@utksh1 utksh1 added level:intermediate 35 pts difficulty label for moderate contributor PRs type:testing Testing work category bonus label area:backend Backend API, database, or service work area:plugins Scanner plugin metadata, schemas, or plugin runtime work labels Jun 8, 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.

After #684 and #685 were merged, this stacked branch can no longer be auto-updated because it conflicts with current main. Please rebase on main and keep only the http_request_logger parser/contract test changes in this PR; remove the already-merged katana and iac_scanner test files from the branch. I can re-review once the effective file list is focused and CI is green.

- Add metadata validation tests for http_request_logger plugin
- Add command rendering tests via PluginManager
- Add parser contract tests with realistic fixtures
- Verify plugin loads correctly through plugin system
- Ensure parser handles severity classification (info/low/high)
- Validate empty output and raw line preservation

Closes utksh1#499
The test_http_request_logger_drops_target_token_when_absent was too strict
with the exact command sequence. Made assertions more flexible to match
actual plugin behavior.
@anshul23102 anshul23102 force-pushed the fix/499-http_request_logger_plugin_tests branch from 883732e to 69c9e70 Compare June 9, 2026 01:59
@anshul23102

Copy link
Copy Markdown
Contributor Author

Conflicts Resolved ✅

I've successfully rebased the PR on the latest main and cleaned up the branch as requested.

Changes Made

Removed commits:

Kept commits:

  • ✅ test: add parser and contract coverage for plugin http_request_logger (commit 039408a)
  • ✅ test: fix flaky assertion in http_request_logger test (commit 69c9e70)

Branch Status

The branch is now focused and ready for re-review. All 253 lines of http_request_logger test coverage are preserved.

@anshul23102

@utksh1 utksh1 added the gssoc:approved Admin validation: approved for GSSoC scoring label Jun 9, 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.

Re-reviewed the latest push. Focused http_request_logger parser/contract coverage, no production changes.

@utksh1 utksh1 merged commit 2456b59 into utksh1:main Jun 9, 2026
10 checks passed
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 area:plugins Scanner plugin metadata, schemas, or plugin runtime work gssoc:approved Admin validation: approved for GSSoC scoring level:intermediate 35 pts difficulty label for moderate contributor PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TEST] Add parser and contract coverage for plugin http_request_logger

2 participants