Repository navigation
Fix all code-review findings (structure, data types, bugs) - #13
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes every finding from the whole-codebase review (#12), across all 10 criticals, 20+ majors, and minors.
Security
crypto/randtokens,HttpOnly/Secure/SameSite=Laxcookies; 401 JSON for API paths instead of a login redirect; password-change path locked with a mutex and empty-password rejection; loud startup warning when defaultadmin/adminis still in use.safeJoinhelper (join-then-check with containment) applied to every file endpoint — provision editor, file viewer/delete, upload, boot-menu submit, and TFTP RRQ/WRQ (CR-7).MaxBytesReader) +ValidateTFTPUploadactually wired up; JS-escaped template output; header-injection-safe filenames; BoltDB opened0600(was0744).DHCP core (CR-8..CR-10, M-C8..C15, M-C20..C21, M-T13)
RWMutexon the service handler map; shared allocation mutex across scan-pick-save in bothAssignLeaseand the packet path — no more racy double-allocation.Start(), non-blockingStop().LeaseState;To4()normalization at boundaries; MAC secondary index (leases_by_mac) with old-DB repair; typeddb.ErrNotFound;GetAllsurfaces corrupt rows instead of skipping them;DeleteAllKVno longer deletes insideForEach.Downloads (M-C1..C7, M-C19)
ExpectedChecksum).InstallBootFilesimplemented for real; unifieddlstatuspackage with typed status constants; UUID download IDs.:8080).Structure (M-T1..T15)
interfaces/package (nothing imported it);testdata/→cli/.GetDB()leak removed; graceful shutdown instead oflog.Fatalfin a goroutine.template.Muston the request path); unifiedAppError/HandleErrorhandling — no internal error text leaked to clients; deduped IP-sort/server-view/server-lookup helpers.SERVER_IPenv override, deep-copied catalog inBuild().Verification
go build ./...,go vet ./...,gofmt,go test ./...all green, plus-raceon the concurrency-sensitive packages (dhcp, db, osimage, syslinux, handlers). New regression tests:db/fixes_test.go,dhcp/fixes_test.go,dhcp/repository_test.go,dlstatustests, TFTP traversal tests.Follow-ups worth a look (not blockers):
syslinuxdelete/get-one/list-all endpoints return honest 501s — the UI may want those actions hidden; TFTP status reports "unknown" until the app layer calls the newSetTFTPRunning; per-file (vs per-version) checksums if desired.