Security hardening across Go, TypeScript, and Ruby SDKs
Merged
JE
10mo ago+4145+4145+0123456789012345678901234567890123456789-148-148-012345678901234567890123456789
Summary
Comprehensive security audit and hardening across all three SDK implementations. Addresses SSRF, token leakage, DoS, and race condition vulnerabilities.
Security Controls Added
| Control | Go | TypeScript | Ruby |
|---|---|---|---|
| HTTPS enforcement (base URLs) | ✓ | ✓ | ✓ |
| HTTPS enforcement (OAuth endpoints) | ✓ | ✓ | ✓ |
| HTTPS enforcement (webhooks, no localhost) | ✓ | ✓ | ✓ |
| Response size limits (50MB/1MB) | ✓ | ✓ | ✓ |
| Error message truncation (500 chars) | ✓ | ✓ | ✓ |
| Pagination same-origin validation | ✓ | — | — |
| Cross-origin redirect credential stripping | ✓ | ✓ | ✓ |
| Auth manager race condition fixes | ✓ | — | ✓ |
| PKCE helper utilities | ✓ | ✓ | ✓ |
| Header redaction for logging | ✓ | ✓ | ✓ |
Key Fixes
- HIGH: Authorization endpoint HTTPS validation with localhost exception
- MEDIUM: Pagination Link header same-origin validation before first request
- LOW: Fail-closed when
httpResp.Requestis nil in pagination
Files Changed
SECURITY.md— Documents all security guaranteesgo/pkg/basecamp/security.go— Shared security helpersgo/pkg/basecamp/client.go— Pagination security, redirect protectiongo/pkg/basecamp/auth.go— Race condition fixestypescript/src/security.ts— Shared security helpersruby/lib/basecamp/security.rb— Shared security helpers- Comprehensive test suites for all security controls
Test plan
- Go tests pass (
go test ./...) - TypeScript tests pass (
npm test) - Ruby tests pass (
bundle exec rake test) - Race detection passes (
go test -race ./...) - Security tests cover attack scenarios