Skip to content

bug: whitespace-only LIBRAVDB_AUTH_SECRET still reaches gRPC HMAC path #219

@compoodment

Description

@compoodment

Summary

loadSecretFromEnv() trims secret-file contents, but the direct LIBRAVDB_AUTH_SECRET environment value is checked before trimming. A value like LIBRAVDB_AUTH_SECRET=" " is truthy, so the gRPC client treats auth as configured with a blank HMAC key.

Impact

The client can enter the signed-auth path without a usable secret and later fail with call initializeSession before authenticated RPCs. It also prevents fallback to LIBRAVDB_AUTH_SECRET_FILE.

Scope

Configuration/debuggability bug. This is not an auth bypass.

Fix Path

Trim the direct env secret before deciding whether it is set. Treat whitespace-only direct secrets as unset so file fallback can still work.

Verification Target

  • Unit tests for direct whitespace secret.
  • Unit tests proving file fallback still works when direct secret is whitespace.

A previous broad PR (#218) included this but was closed for bundling unrelated changes. Bring this back as a narrow auth-secret patch.

– Vale

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