Skip to content

Go SDK: ErrForbidden has no Help — list its likely causes, and say why the exact cause is not given #1893

In review

Description

@auxesis

Background

The Go SDK is in languages/golang in this repository. It encrypts values in a Go program, and gets its keys from ZeroKMS, CipherStash's key management service. In November 2026 we audited version v0.1.0-rc.7 by building programs against a dev workspace and PostgreSQL 17 with EQL (Encrypt Query Language) v4.

Problem

Three different causes give the same ErrForbidden, with the same code and an empty Help:

  • a tenant mismatch;
  • a client without access;
  • the right keyset with the wrong scope. This gives code stack_kms::retrieve_key_failed, and never mentions the scope.

A developer cannot tell which one they hit.

Proposal

  1. Give ErrForbidden a Help that lists its likely causes, and names the keyset where the SDK has it.
  2. Say in the docs why the SDK cannot name the exact cause, and what to do instead.

Scope

This issue was narrowed on 2026-11-27. It first asked for a separate Help for each cause. That is not possible. It is also not wanted:

  • ZeroKMS refuses a data key with HTTP 403 for three causes: another context, a disabled keyset, or a token without the scope to retrieve keys. Its answer does not say which cause applies.
  • This is intentional. A refusal that named its cause would tell an attacker which part of a request to change.
  • A client with no grant for a keyset gets HTTP 404 (ErrNotFound) instead, as a live check in docs(golang): compare keysets, scopes and context_field for separating tenants #1934 showed.

To find the exact cause of a refusal, contact CipherStash Support.

Evidence

Verified by running code.

Activity

  1. added
    bug
    Golang
    on Nov 26, 2026
  2. self-assigned this
    on Nov 26, 2026
  3. changed the title [-]Go SDK: `ErrForbidden` has no Help, and does not say whether the tenant, the scope, or access is wrong[/-] [+]Go SDK: `ErrForbidden` has no Help — list its likely causes, and say why the exact cause is not given[/+] on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GolangSDKbug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions