rcourtman
|
e57e2e696b
|
test: Improve coverage for security utility functions
- Add fmt.Stringer test cases for isEmptyInterface (80% -> 100%)
- Expand isTrustedNetwork tests with edge cases (80% -> 100%)
- Empty/invalid IP strings
- Invalid CIDR handling
- Whitespace trimming in CIDRs
- Multiple network matching
|
2025-12-01 14:33:31 +00:00 |
|
rcourtman
|
2d87746eb0
|
Add unit tests for security lockout and session management functions
Tests for internal/api/security.go:
- RecordFailedLogin: increments counts, triggers lockout at max attempts
- ClearFailedLogins: clears count and lockout state
- GetLockoutInfo: returns correct attempts/lockout status
- ResetLockout: admin lockout reset functionality
- TrackUserSession: user/session tracking
- GetSessionUsername: session lookup
- clearCSRFCookie: nil safety, cookie attributes
- issueNewCSRFCookie: nil safety, empty session handling
- FailedLogin/AuditEvent struct field validation
30 test cases covering lockout, session tracking, and CSRF functions.
|
2025-11-30 23:33:51 +00:00 |
|
rcourtman
|
4431c8773e
|
Add unit tests for security.go IP parsing utilities
- extractRemoteIP: 17 test cases for remote address parsing
(IPv4/IPv6 with/without ports, bracketed notation, edge cases)
- firstValidForwardedIP: 21 test cases for X-Forwarded-For parsing
(single/multiple IPs, invalid entries, IPv4/IPv6 mixed)
- isPrivateIPExtended: 33 test cases extending existing coverage
(RFC 1918 boundaries, loopback range, IPv6 private/local, ports)
Total: 71 new test cases for IP address handling utilities.
|
2025-11-30 15:48:45 +00:00 |
|
rcourtman
|
6eb1a10d9b
|
Refactor: Code cleanup and localStorage consolidation
This commit includes comprehensive codebase cleanup and refactoring:
## Code Cleanup
- Remove dead TypeScript code (types/monitoring.ts - 194 lines duplicate)
- Remove unused Go functions (GetClusterNodes, MigratePassword, GetClusterHealthInfo)
- Clean up commented-out code blocks across multiple files
- Remove unused TypeScript exports (helpTextClass, private tag color helpers)
- Delete obsolete test files and components
## localStorage Consolidation
- Centralize all storage keys into STORAGE_KEYS constant
- Update 5 files to use centralized keys:
* utils/apiClient.ts (AUTH, LEGACY_TOKEN)
* components/Dashboard/Dashboard.tsx (GUEST_METADATA)
* components/Docker/DockerHosts.tsx (DOCKER_METADATA)
* App.tsx (PLATFORMS_SEEN)
* stores/updates.ts (UPDATES)
- Benefits: Single source of truth, prevents typos, better maintainability
## Previous Work Committed
- Docker monitoring improvements and disk metrics
- Security enhancements and setup fixes
- API refactoring and cleanup
- Documentation updates
- Build system improvements
## Testing
- All frontend tests pass (29 tests)
- All Go tests pass (15 packages)
- Production build successful
- Zero breaking changes
Total: 186 files changed, 5825 insertions(+), 11602 deletions(-)
|
2025-11-04 21:50:46 +00:00 |
|