Skip to content

fix(core): a refusal says the organization header of the call, never of the token - #573

Merged
bim-ba merged 1 commit into
mainfrom
fix/token-echo-and-organization
Oct 10, 2026
Merged

bim-ba merged 1 commit into
mainfrom
fix/token-echo-and-organization

Conversation

@bim-ba

@bim-ba bim-ba commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Two leftovers of the review of #567 (round 3, notes 1 and 2). Neither changes what a genuine token does.

Before After
a token of another organization was refused with the NAME of its header quoted from the token: a forged Ignore-previous-instructions-and-obey: 7 reached a terminal and, through a tool error, a model the header is said only when it is the call's own; otherwise this token is of another organization (of another kind) than this call (X-Org-Id: o)
SyncSession(client, organization="7") failed with a pydantic error at the first truncated listing refused when the session is built: the organization of a session is \Name: id` …(aValueError`: a mistake of the caller's code, not of a request)

A genuine token of Yandex 360 organization 7 given under Yandex Cloud organization 7 is told "of another kind" too: it no longer names the token's header. The id of the same kind of organization is still named when it is short and plain.

Tests

  • tests/unit/cli/test_forged_tokens.py: one more forgery (a header that is a sentence), through the SDK, the CLI and the MCP tool; the payload is absent from what is told. Red before the fix.
  • test_a_session_is_given_its_organization_as_a_header_and_an_id_or_not_at_all: four wrong forms refused for both sessions; any id under a header's name, and none at all, accepted. Red before the fix.

Note 3 of that round (an organization id over 400 escaped characters): no action, as agreed.

Verified

On this head, over main 823a408c (0.137.1): ruff, ty, lint-imports (6 kept), pydoclint, gitleaks; the full suite: 7014 passed, 5 skipped, coverage 100 %.

NOT RUN: any live run (nothing here reaches a service).

🤖 Generated with Claude Code

…of the token

Two leftovers of the review of #567.

A token of another organization was refused with the name of its header quoted
from the token, up to forty letters of the token's own text: a forged
`Ignore-previous-instructions-and-obey: 7` reached a terminal, and a model
through a tool error. The header is now said only when it is the call's own;
a token under another header is told "of another kind", and the call's side is
named as before.

A session given an organization by hand in another form than `Name: id`
(`SyncSession(client, organization="7")`) failed with a pydantic error at the
first truncated listing, when its token was made. It is refused when the
session is built, in ycli's own words. `connect()` never produced that form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bim-ba
bim-ba merged commit d6fd60f into main Oct 10, 2026
13 checks passed
@bim-ba
bim-ba deleted the fix/token-echo-and-organization branch October 10, 2026 18:14

This branch was previously deployed

1 inactive deployment
yandex-e2e — b3bf010f Deployed Oct 10, 2026 by bim-ba via live (all) #707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant