Skip to content

fix(audit-2): address adversarial audit findings#2

Open
ajayita wants to merge 1 commit into
mainfrom
fix/audit-2-remediation
Open

fix(audit-2): address adversarial audit findings#2
ajayita wants to merge 1 commit into
mainfrom
fix/audit-2-remediation

Conversation

@ajayita

@ajayita ajayita commented May 27, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses the issues discovered in audit-2.md.

Fixes Applied

Fix Issue Resolution
Fix 3 Silent GMCP Parser Failures Strip null bytes globally from decoded payload. Return null on malformed UTF-8 or invalid JSON instead of swallowing errors.
Fix 4 Memory Leak / FD Exhaustion Always call await transport.close() in a finally block. Close _decompressorSink in TelnetTransport.close().
Fix 5 Missing Entry Point Create lib/telnet_sentinel.dart with a clean public API surface. Add homepage, repository, issue_tracker, and topics to pubspec.yaml. Introduce TelnetAuditor facade.
Fix 8 AuditResult Expressiveness / OOM Cap _rawBytesExchanged at 4KB. Serialize captured bytes as base64 in toJson(). Add per-probe latency tracking.
Fix 9 Negotiation Loop Protection Implement global + per-option rate limiter using monotonic Stopwatch. Throw TelnetProtocolException on loop detection instead of silently dropping.

Test Updates

  • Updated GMCP parser test to expect null for invalid JSON.
  • Added tests for null-byte stripping, malformed UTF-8 rejection, raw-byte capping, and rate-limit exception throwing.

Verification

  • dart analyze — clean
  • dart test — all 71 tests pass

- GMCP Parser: strip null bytes globally, return null on malformed UTF-8 or invalid JSON
- Transport Cleanup: always await transport.close() in finally; close decompressor sink properly
- AuditResult: add latency and capped (4KB) rawBytesExchanged; serialize bytes as base64 in JSON
- NegotiationStateManager: add global+per-option rate limiting with Stopwatch, throw TelnetProtocolException on loop detection
- Entry Point: create lib/telnet_sentinel.dart with clean public API and lib/telnet_auditor.dart
- pubspec.yaml: add homepage, repository, issue_tracker, and topics metadata
- Update tests to assert new strict GMCP behavior and add tests for rate limiting, raw byte capping, and null-byte stripping
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.

1 participant