Skip to content

Harden well-known remote_config fetch to enforce same-origin and reject credentials #199

@OpenCodeEngineer

Description

@OpenCodeEngineer

Implement backend security hardening in packages/opencode/src/config/config.ts:

  • In well-known auth remote config substitution flow, keep env/template substitution behavior.
  • Parse and normalize remote URL robustly.
  • Enforce remote_config.url origin matches the well-known base origin from auth key URL (normalized, no trailing slash).
  • Reject URLs containing username/password credentials.
  • Throw explicit error on violation.

Tests in packages/opencode/test/config/config.test.ts:

  • Keep templated header substitution test passing with same-origin URL.
  • Add test that cross-origin remote_config is rejected with error.

Validation:

  • cd packages/opencode && bun test test/config/config.test.ts
  • cd packages/opencode && bun typecheck

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions