Skip to content

fix: address PR 265 review findings#279

Open
bussyjd wants to merge 1 commit intofeat/autoresearch-integrationfrom
fix/pr265-review-findings
Open

fix: address PR 265 review findings#279
bussyjd wants to merge 1 commit intofeat/autoresearch-integrationfrom
fix/pr265-review-findings

Conversation

@bussyjd
Copy link
Collaborator

@bussyjd bussyjd commented Mar 18, 2026

Summary

Addresses review findings from PR #265 (autoresearch marketplace foundations).

Critical fixes

  • Path traversal in worker_api.py: User-supplied experiment_id is now validated with ^[a-zA-Z0-9_-]+$ regex in both POST and GET handlers, preventing directory traversal attacks
  • GGUF format guard in publish.py: Added explicit check before ollama_create() — non-GGUF checkpoints now get a clear error with conversion instructions instead of a confusing Ollama failure
  • Non-root worker container: Dockerfile now creates and switches to a worker user, reducing privilege escalation risk from arbitrary code execution

Medium fixes

  • Provenance struct-to-map (sell.go): Replaced 6 manual if blocks with a JSON marshal/unmarshal round-trip — new Provenance fields are now automatically included
  • Weak test assertion (payment_test.go): TestApproximateRequestPriceFromPerHour now asserts exact expected values instead of just "not empty"
  • Guard int(amount) (coordinate.py): Wrapped in try/except to handle non-integer pricing strings gracefully
  • Remove CRD default (serviceoffer-crd.yaml): Removed default: "val_bpb" from spec.provenance.metricName — too domain-specific for a generic CRD field
  • Guard maxTimeoutSeconds (monetize.py): Wrapped parse in try/except for non-numeric values

Low priority

  • Added provenance propagation test for build_registration_doc
  • Fixed doc type inconsistency in coordination-protocol.md (metadata fields are strings, not float/int)
  • Assert all 6 Provenance fields in store_test.go

Test plan

  • go build ./... passes
  • go test ./internal/inference/... ./internal/schemas/... ./cmd/obol/... passes
  • python3 -m py_compile on all modified Python files
  • python3 -m unittest tests/test_sell_registration_metadata.py tests/test_autoresearch_worker.py tests/test_autoresearch_provenance.py passes

…erage

Critical:
- Fix path traversal in worker_api.py: validate experiment_id with regex
- Add GGUF format guard in publish.py before ollama_create()
- Run worker container as non-root user in Dockerfile

Medium:
- Replace manual provenance struct-to-map with JSON round-trip in sell.go
- Fix weak test assertion in TestApproximateRequestPriceFromPerHour
- Guard int(amount) cast in coordinate.py with try/except
- Remove domain-specific default "val_bpb" from CRD metricName field
- Guard maxTimeoutSeconds parse in monetize.py

Low:
- Add provenance propagation test for build_registration_doc
- Fix doc type inconsistency in coordination-protocol.md
- Assert all 6 Provenance fields in store_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant