-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Follow-up items from @rgarcia's review of PR #53 (hypeman build system).
High Priority
-
Add size limit to multipart upload (
cmd/api/api/builds.go:63)The multipart parsing loop has no size limit on
sourceData—could be a DoS vector if someone uploads a huge file. -
Fix
ErrBuildInProgressnaming/semantics (lib/builds/errors.go:34,cmd/api/api/builds.go:200)The comment says "returned when trying to cancel a build that's already complete" but the error name is
ErrBuildInProgress—these are contradictory. Should this beErrBuildAlreadyCompleteor similar? -
Secrets timeout should be a hard fail (
lib/builds/builder_agent/main.go:401)If secrets are required for the build, proceeding without them will just cause a more confusing error later.
-
Queue goroutine cancellation on shutdown (
lib/builds/queue.go:73)Enqueuelaunches goroutines withgo wrappedFn(). If the queue is stopped/shutdown, there's no way to cancel these goroutines. ShouldstartFnaccept a context for cancellation? -
Race condition in build cancellation (
lib/builds/manager.go:683)When cancelling a building/pushing job, this deletes the instance but doesn't wait for confirmation. The deferred cleanup in
executeBuildmight race with this.
Medium Priority
-
Use
context.WithoutCancel(ctx)for trace propagation (lib/builds/manager.go:227)This uses
context.Background()instead of the parent context. If intentional, usecontext.WithoutCancel(ctx)so context values (like OpenTelemetry trace context) are still propagated. -
Reduce/eliminate 3-second sleep in hot path (
lib/builds/manager.go:423)Is there some way to avoid this or make it more precise / less fuzzy?
-
Implement
AllowedDomainsfiltering or remove field (lib/builds/types.go:75)AllowedDomainsis defined but doesn't appear inBuildConfigthat gets passed to the VM. Is domain filtering implemented, or is this a placeholder? -
Handle partial execution on queue recovery (
lib/builds/queue.go:24)The queue is purely in-memory. Recovery via
listPendingBuilds()could cause issues if astartFnhad already partially executed before the restart.
Low Priority (Logging & Observability)
-
Log errors in
listAllBuilds(lib/builds/storage.go:111)Silently skips invalid entries—a corrupted metadata file would be ignored.
-
Log
json.Marshalfailures in SSE events (cmd/api/api/builds.go:246)If
json.Marshal(event)fails, it silently continues. -
Return error or log for invalid secret IDs (
lib/builds/file_secret_provider.go:35)The path traversal check skips invalid IDs silently. If someone requests
my/tokenthey'd get no feedback.
Code Clarity
-
Add sync comments for duplicated types (
lib/builds/builder_agent/main.go:38,lib/middleware/oapi_auth.go:20)Note that these types must be kept in sync with
lib/builds/types.goandlib/builds/registry_token.go. -
Replace bubble sort with
sort.Strings(lib/builds/cache.go:154)Would be clearer and no slower for small slices.
-
Consider removing
build-buildersMakefile alias (Makefile:217)Seems premature if there's only one builder image.
Questions to Address
-
Provenance timestamp redundancy (
openapi.yaml:732)Maybe
completed_atwould be a better name? Or remove if redundant withBuild.completed_at? -
Registry URL configurability (
cmd/api/config/config.go:110)This has to be the hypeman registry URL since it relies on custom auth—maybe it should not be configurable?
-
Plan/timeline to remove deprecated IP fallback (
lib/middleware/oapi_auth.go:302)This IP fallback is marked as deprecated—is there a plan to remove it?
Reference: #53