Skip to content

v0.0.1.dev4

Pre-release
Pre-release

Choose a tag to compare

@VanDung-dev VanDung-dev released this 02 Jan 04:25
· 1745 commits to main since this release

HieraChain v0.0.1.dev4 - Security Hardening

Pre-release Warning: This is a development preview and is not intended for production use. APIs may change without notice.

What's New

Security Hardening

  • Secure Logging: Added secure_logging.py and sanitization.py utilities to prevent sensitive data leakage in logs (d4d645d).
  • API Authentication: Enhanced auth status logging on startup, refined logging levels (b9fba70).
  • Error Handling: Added RecursionError handler to prevent JSON bomb DoS attacks (7922aca).
  • Payload Limits: Implemented 5MB payload size limit middleware (7922aca).
  • Security Headers: Enhanced security headers (X-Content-Type-Options, X-Frame-Options, CSP, Cache-Control) (27d700b).
  • Rate Limiting: Added in-memory rate limiter middleware with configurable limits (f442b84).
  • Hash Algorithm: Replaced MD5 with SHA256 for improved security (7d79c98).

Vulnerability Fixes

  • CVE-2024-23342 (HIGH): Removed unused python-jose dependency which pulled in vulnerable ecdsa package with unfixable Minerva timing attack vulnerability (134f97b).

Configuration & Settings

  • Production Settings: Enhanced security defaults for production environment including mandatory AUTH, restricted CORS, HSTS, and rate limiting (a63501f).
  • Configurable API Host: API host now configurable via HRC_API_HOST environment variable (44a72d3).
  • Connection Handling: Improved connection handling with keep-alive timeout and concurrency limits (f442b84).

Security Testing

  • Probe Scripts: Added security probe scripts for vulnerability detection (4f17875):
    • http_headers_probe.py - Security headers verification
    • auth_bypass_probe.py - Authentication bypass testing
    • input_fuzzer.py - Input validation testing
    • api_key_edge_cases_probe.py - API key handling edge cases
    • log_level_test.py - LOG_LEVEL disclosure testing
    • And more...
  • SAST Integration: Added bandit and pip-audit to development dependencies for static analysis (551526f).

API Improvements

  • Secure Endpoints: Integrated secure logging and sanitization for v2 API endpoints (ab3ce70).

Files Changed

File Changes Commit
hierachain/security/secure_logging.py Add secure logging utilities d4d645d
hierachain/security/sanitization.py Add sanitization utilities d4d645d
hierachain/config/settings.py Enhance security/performance settings, configurable API host a63501f](a63501f), 44a72d3
hierachain/api/server.py Security headers, recursion error handler, payload limit, rate limiter 27d700b, 7922aca, f442b84
hierachain/api/v2/endpoints.py Integrate secure logging and sanitization [ab3ce70
requirements.txt Remove python-jose (CVE-2024-23342) 134f97b
pyproject.toml Remove python-jose, add bandit and pip-audit 134f97b
scripts/security/* Add probe scripts for vulnerability detection 4f17875

Security Audit Summary

Tool Result
Bandit (SAST) ✅ CLEAN - 0 issues in 23,236 lines of code
pip-audit (SCA) ✅ CLEAN - All vulnerabilities resolved

Known Limitations

  • Not production-ready
  • Documentation still in progress
  • Some security probe scripts require server to be running with AUTH_ENABLED=True for full testing

Links

Documentation

Ecosystem


Full Changelog: v0.0.1.dev3...v0.0.1.dev4