aboutsummaryrefslogtreecommitdiff
path: root/hotline/access_test.go
AgeCommit message (Collapse)Author
2026-05-29Guard against panics from unchecked type assertionsJeff Halter
Replace two unchecked type assertions that could crash the server: - server.go: the file-transfer logger built remoteAddr via a bare ctx.Value(contextKeyReq).(requestCtx) assertion, which panics if the context value is absent or the wrong type. Use the comma-ok form and degrade to an empty string. - access.go: the legacy (< v0.17.0) AccessBitmap YAML array path used byte(v.(int)) with no element-type or bounds check, panicking on a non-int element or an array longer than the [8]byte bitmap. Iterate the slice from the type switch, bounds-check the index, and comma-ok each element, returning a wrapped error so a malformed user file fails to load loudly instead of crashing the server. Add regression tests for the non-int and oversized legacy array cases.
2025-11-29Ran goimports -w . to tidy upJeff Halter
2025-07-04Add comprehensive test coverage for AccessBitmap YAML marshalingJeff Halter
- Add tests for UnmarshalYAML covering array and map formats - Add tests for MarshalYAML with various permission combinations - Cover edge cases including empty bitmaps and full permissions - Ensure backward compatibility with legacy array format
2024-07-17Extensive refactor, quality of life enhancementsJeff Halter
* Added ability to reload config, agreement, news, and user accounts without restarting the server by sending SIGHUP to the running process * Added ability to use modern unix or windows line breaks in Agreement.txt and MessageBoard.txt instead of classic MacOS `\r` breaks. * Extensive refactor towards swappable backends for the active server state * Extensive refactored towards making the hotline package generic and re-usable for alternate server implemenations * Fix bug where users whose accounts have been deleted would not be disconnected
2022-06-26Refactor user access bitmap handlingJeff Halter