v0.8.3 POST authentication fixed
π Darktrace SDK v0.8.3 Release Notes
Release Date: July 1, 2025
Previous Version: v0.8.1
Current Version: v0.8.3
π Major Highlights
β RESOLVED: GitHub Issue #1 - Advanced Search POST Requests
After extensive investigation and testing, we've successfully resolved the long-standing issue with Advanced Search POST requests that were failing with "API SIGNATURE ERROR". This was the most requested fix in the community.
π§ Critical JSON Formatting Fix
Identified and fixed the root cause of POST request authentication failures across all SDK modules - inconsistent JSON formatting between signature generation and HTTP request bodies.
π Enhanced Darktrace 6.1+ Compatibility
Full support for modern Darktrace installations using POST-based Advanced Search queries.
π§ Technical Changes
Core Authentication System (darktrace/auth.py)
- Fixed JSON body parameter handling in signature generation
- Standardized JSON serialization using
separators=(',', ':')for consistent formatting - Enhanced debug output for POST request troubleshooting
- Improved parameter sorting for authentication consistency
Advanced Search Module (darktrace/dt_advanced_search.py) - MAJOR REWRITE
- β FIXED POST requests - Complete implementation of POST request support
- Removed NotImplementedError that was blocking POST functionality
- Added comprehensive query structure building for both GET and POST methods
- Enhanced timeframe handling (custom, interval-based, default)
- Added proper JSON body formatting with
{"hash": "encoded_string"}structure - Improved error handling and debug output
- Full backward compatibility with existing GET request usage
Statistics: +74 insertions, -23 deletions
Model Breaches Module (darktrace/dt_breaches.py)
- Fixed POST requests for
add_comment(),acknowledge(), andunacknowledge()methods - Standardized JSON serialization across all POST endpoints
- Added comprehensive debug output for response tracking
- Enhanced error handling with status code logging
Statistics: +93 insertions, -4 deletions
AI Analyst Module (darktrace/dt_analyst.py)
- Fixed POST requests for
add_comment()andcreate_investigation()methods - Improved JSON body handling for consistent authentication
- Added debug response logging
- Enhanced error tracking capabilities
Antigena Actions Module (darktrace/dt_antigena.py)
- Fixed multiple POST endpoints:
activate_action()extend_action()clear_action()reactivate_action()create_manual_action()
- Standardized error handling across all POST methods
- Improved debug output for troubleshooting
- Enhanced response status tracking
Additional Module Fixes
- Devices Module (
dt_devices.py): Fixedupdate()POST method - Intel Feed Module (
dt_intelfeed.py): Fixedcreate()POST method - Email Module (
dt_email.py): Fixedemail_action()andsearch_emails()POST methods - Model Breach Comments (
dt_mbcomments.py): Fixedadd()POST method
π Summary Statistics
Total Changes: 13 files modified
Lines Added: 271 insertions
Lines Removed: 119 deletions
Net Addition: +152 lines
Key Modules Updated:
- β Authentication System - Core fixes
- β Advanced Search - Complete POST implementation
- β Model Breaches - 3 POST methods fixed
- β AI Analyst - 2 POST methods fixed
- β Antigena Actions - 5 POST methods fixed
- β Devices, Intel Feed, Email, Comments - 1-2 POST methods each
π οΈ Breaking Changes
None. This release maintains full backward compatibility. All existing code will continue to work unchanged.
POST Request Upgrade: Users can now optionally use post_request=True parameter for Advanced Search and other POST-enabled endpoints, but this is entirely optional.
π Technical Deep Dive
Root Cause Analysis
The core issue was discovered to be inconsistent JSON formatting between:
- Signature Generation: Used
json.dumps(json_body, separators=(',', ':'))β{"key":"value"} - HTTP Request Body: Used
json.dumps(body)β{"key": "value"}(note the space)
This subtle difference caused Darktrace's strict signature verification to fail, resulting in "API SIGNATURE ERROR" responses.
Solution Implementation
- Standardized JSON serialization across all POST endpoints
- Updated authentication helper to handle JSON bodies consistently
- Enhanced debug output to track request/response details
- Added comprehensive test coverage for POST functionality
Advanced Search POST Implementation
The Advanced Search module now properly:
- Builds complete query structures with search, fields, offset, timeframe, and time parameters
- Encodes queries as base64 using the existing
encode_query()utility - Sends POST requests with
{"hash": "encoded_string"}body format - Handles custom timeframes for both GET and POST methods
- Provides extensive debug logging for troubleshooting
π Testing
Comprehensive Test Coverage
- β Advanced Search POST requests tested with SSL, TCP, and HTTP queries
- β Multiple timeframe configurations (default, custom, interval-based)
- β All POST endpoints verified across affected modules
- β Backward compatibility confirmed for existing GET request usage
- β Error handling validated for various failure scenarios
Production Validation
- β Tested against live Darktrace instances
- β Verified with real-world query patterns
- β Confirmed API response structure compatibility
- β Validated authentication signature generation
π― Migration Guide
For Advanced Search Users
Before (v0.8.1):
# Only GET requests worked
results = client.advanced_search.search(query=my_query)After (v0.8.3):
# Both GET and POST now work
results = client.advanced_search.search(query=my_query) # GET (default)
results = client.advanced_search.search(query=my_query, post_request=True) # POST (new!)For POST Endpoint Users
All POST endpoints that were previously failing should now work correctly without any code changes. The fixes are transparent to existing users.
π Bug Fixes
- Fixed GitHub Issue #1: Advanced Search POST requests now work correctly
- Fixed API signature errors across all POST endpoints
- Fixed JSON formatting inconsistencies in authentication
- Fixed parameter ordering in signature generation
- Enhanced error handling and debug output across modules
π Documentation Updates
- Updated README.md to reflect Advanced Search POST functionality
- Removed "Known Issues" section about Advanced Search POST problems
- Added practical examples for Advanced Search POST usage
- Enhanced Quick Start guide with POST request examples
- Updated version references throughout documentation
π What's Next
Upcoming Features (v0.8.4+)
- Additional endpoint coverage expansions
- Enhanced async support preparation
- Performance optimizations for large result sets
- Extended test coverage for edge cases
Community Feedback
We encourage users to test the new POST functionality and report any issues. This release resolves the most significant blocking issue in the SDK.
π Support
If you encounter any issues with this release:
- Check the updated examples in README.md
- Enable debug mode in your client for detailed logging
- Report issues on our GitHub repository with debug output
- Reference this release when asking for support
Download: pip install darktrace-sdk==0.8.3
Repository: https://github.com/LegendEvent/darktrace-sdk
Issues: https://github.com/LegendEvent/darktrace-sdk/issues
Made with β€οΈ for the Darktrace community. Happy querying! π
- Fix post request json formatting by @LegendEvent in #41
Full Changelog: v0.8.1...v0.8.3