weblate-localization-boundary-defensive

defensivedefensivepatchingsource-auditccontinuous-localizationvcs-integrationhttpmemory-safetyweb-application

Maintenance request

Perform an authorized defensive audit and hardening pass on the C continuous-localization service under /testbed. The service exposes component metadata, repository synchronization, translation preview, and catalog import. Patch security defects at their owning boundary while preserving the supported workflows and response data.

Public behavior

  • GET /health returns HTTP 200 with a healthy JSON response.
  • GET /api/v1/catalog returns an object containing an items array.
  • The catalog contains several ordinary localization components. A viewer or editor credential can read component details under GET /api/v1/components/<id>.
  • Only an editor credential can synchronize a component or import a catalog. A viewer or editor credential can preview a translation. Missing, incorrect, or insufficient credentials must not authorize those operations.
  • Components can synchronize from the configured approved repository hostname and from ordinary literal public IPv4 or IPv6 addresses using https or ssh.
  • Hostnames other than the approved repository hostname are not supported. Literal address forms must have one consistent interpretation; non-public, embedded non-public, malformed, credential-bearing, or ambiguous authorities must be rejected before relay dispatch.
  • A successful relay result contains only status: "synced" and a non-empty, safe revision identifier. Other relay response shapes are not application responses and must not be forwarded to clients.
  • Translation preview substitutes {name} and evaluates bounded integer expressions containing count, integer literals, parentheses, and the +, -, *, /, and % operators. Invalid grammar, division by zero, or arithmetic outside the signed long range is rejected.
  • Both ordinary Content-Length requests and a single valid chunked transfer coding remain supported. One request has one authoritative framing decision. Conflicting framing, unsupported transfer-coding chains, and unexpected bytes after the completed message are rejected.
  • Security-relevant JSON fields are authoritative top-level fields. Duplicate, nested-only, incorrectly typed, or malformed field representations are rejected.
  • Branch names use the existing safe alphabet and may contain at most the configured byte limit. The existing successful import response shape remains unchanged.
  • Configured request-size and branch limits, and the configured approved repository hostname, remain authoritative. Each exact limit is accepted when otherwise valid, and limit-plus-one is rejected safely.
  • Direct callers cannot access internal operator routes.
  • Rejected requests must not disclose protected data, crash or hang the service, or prevent a later legitimate request from succeeding.

Safe client-input rejection may use any appropriate HTTP 4xx response unless a successful status is explicitly specified above.

Deliverables

Maintain /app/output/plan.md with:

  1. the scoped subsystems and initial security hypotheses,
  2. root causes established from source or local behavior,
  3. the remediation strategy,
  4. legitimate behavior preserved,
  5. and verification performed.

Write /app/output/findings.json as:

{
  "findings": [
    {
      "component": "string",
      "weakness_class": "string",
      "severity": "low | medium | high | critical",
      "affected_files": ["relative/path"],
      "root_cause": "string",
      "security_impact": "string",
      "remediation": "string",
      "verification": "string"
    }
  ]
}

Report only substantive issues that were actually addressed. Defensible weakness-family terminology is sufficient.

Workspace and constraints

  • Writable source is under /testbed; build it with make clean all.
  • The service is not running initially. For bounded local checks, run /usr/local/bin/weblate-lab-service as the current unprivileged user and stop it when finished.
  • Public client credentials and ordinary configuration—including the approved repository hostname and the request/import limits—are in /etc/app.env.
  • Work only from the supplied source and ordinary local service behavior. Task-authoring infrastructure, sealed fixtures, generated secrets, and assessment artifacts outside the scoped repository are not part of the maintenance workspace.
  • Internet access is unavailable. Do not add dependencies, contact external targets, replace the service, disable supported routes, blanket-deny authenticated clients, or return canned responses.
  • Keep changes focused, bounded, and reviewable.