Skip to content

Add: Custom transport#636

Merged
hahwul merged 3 commits intohahwul:mainfrom
Bide-UK:add-custom-transport
Mar 2, 2025
Merged

Add: Custom transport#636
hahwul merged 3 commits intohahwul:mainfrom
Bide-UK:add-custom-transport

Conversation

@Bide-UK
Copy link

@Bide-UK Bide-UK commented Feb 26, 2025

Add Custom Transport Feature

This PR adds support for custom HTTP transports in DalFox, enabling advanced integration with security testing pipelines and enhanced control over HTTP requests.

Features

  • Custom Transport Interface: Implement support for custom HTTP transports via the model.Options.CustomTransport field
  • Transport Chain: Create chains of transports to apply multiple modifications to requests
  • Header Transport: Add custom headers to requests
  • Example Implementations: Include examples for common use cases:
    • Custom TLS configuration
    • Transport chains
    • Retry mechanisms
    • OAuth2 authentication
    • Rate limiting
    • Request/response logging

Benefits for Pipeline Integration

This feature is particularly valuable for integrating DalFox with other security testing pipelines:

  • HTTP Control Flow: Customize request handling with headers and routing logic
  • Resilient Scanning: Implement automatic retries with configurable backoff strategies
  • Authentication: Support complex auth flows like OAuth2 and JWT
  • Rate Control: Prevent being blocked by target systems
  • Logging: Add detailed request/response tracking for debugging
  • Proxy Integration: Seamlessly work with custom proxy solutions

Documentation

  • Added comprehensive documentation in docs/custom_transport.md
  • Included practical examples in pkg/scanning/transport_example.go
  • Added tests demonstrating usage patterns

Testing

All tests pass, including new tests for:

  • Custom transport creation
  • Transport chaining
  • Header application
  • Integration with DalFox scanning

This implementation maintains backward compatibility while adding significant new capabilities for advanced users.

Copy link
Owner

Choose a reason for hiding this comment

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

Might need to move this to a separate examples(samples) directory later.

Copy link
Owner

@hahwul hahwul left a comment

Choose a reason for hiding this comment

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

@Bide-UK
Thanks for the PR! The code looks great, no issues on my end. I’ve adjusted the documentation for better web display and added front matter. This will be included in the next release (planned for 2.10.0), and I’ll make sure it gets deployed quickly. Really appreciate your contribution again!

@hahwul hahwul added this to the v2.10.0 milestone Mar 2, 2025
@hahwul hahwul merged commit 291e18b into hahwul:main Mar 2, 2025
5 checks passed
Copy link
Owner

Choose a reason for hiding this comment

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

@Bide-UK Bide-UK deleted the add-custom-transport branch May 1, 2025 15:39
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.

2 participants