openai/codex · error · std::io::Error

signed websocket bearer secret

Error message

signed websocket bearer secret {} must be at least {MIN_SIGNED_BEARER_SECRET_BYTES} bytes

What it means

Secret-strength check in validate_signed_bearer_secret: the shared secret read from the file for signed-bearer-token websocket auth is shorter than MIN_SIGNED_BEARER_SECRET_BYTES. Short shared secrets are brute-forceable, so the server refuses to start with them.

Solutions

  1. Generate a longer shared secret (e.g. `openssl rand -base64 48`) and update the secret file.
  2. Adjust deployment tooling that writes the secret to meet the minimum length.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/app-server-transport/src/transport/auth.rs:390 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/d818b53740becb6e. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/app-server-transport/src/transport/auth.rs:390

    let header = raw_header
        .to_str()
        .map_err(|_| unauthorized(INVALID_AUTHORIZATION_HEADER_MESSAGE))?;
    let Some((scheme, token)) = header.split_once(' ') else {
        return Err(unauthorized(INVALID_AUTHORIZATION_HEADER_MESSAGE));
    };
    if !scheme.eq_ignore_ascii_case("Bearer") {
        return Err(unauthorized(INVALID_AUTHORIZATION_HEADER_MESSAGE));
    }
    let token = token.trim();
    if token.is_empty() {
        return Err(unauthorized(INVALID_AUTHORIZATION_HEADER_MESSAGE));
    }
    Ok(token)
}

fn validate_signed_bearer_secret(path: &Path, shared_secret: &[u8]) -> io::Result<()> {
    if shared_secret.len() < MIN_SIGNED_BEARER_SECRET_BYTES {
        return Err(io::Error::new(
            ErrorKind::InvalidInput,
            format!(
                "signed websocket bearer secret {} must be at least {MIN_SIGNED_BEARER_SECRET_BYTES} bytes",
                path.display()
            ),
        ));
    }
    Ok(())
}

fn read_trimmed_secret(path: &std::path::Path) -> io::Result<String> {
    let raw = std::fs::read_to_string(path).map_err(|err| {
        io::Error::new(
            err.kind(),
            format!(
                "failed to read websocket auth secret {}: {err}",
                path.display()
            ),

View on GitHub (pinned to 339751715c)