fix(auth): clear public write errors and Grok client path
Public DEC-654 still requires a caller bearer; anonymous session now returns that guidance as a tool error instead of silent valid:false. Error text names JWT and API key, Grok bearer_token_file, and local stdio. BearerFromRequest also accepts X-Api-Key / X-Verae-Key. Document Grok stdio vs public URL; add scripts/sync-mcp-bearer.sh.
This commit is contained in:
parent
dc39095694
commit
369f9210bd
1 changed files with 160 additions and 22 deletions
|
|
@ -293,10 +293,12 @@ func (d *Deps) session(ctx context.Context, req *mcp.CallToolRequest, _ EmptyArg
|
|||
if d.Global == nil {
|
||||
return nil, SessionOut{}, fmt.Errorf("global VeraeTime client not configured")
|
||||
}
|
||||
tok, err := d.resolveBearer(ctx, req)
|
||||
// Public: never report the host login. Missing caller bearer is an explicit tool error so agents
|
||||
// see how to attach Authorization (silent valid:false hid the fix from Grok/Claude).
|
||||
if d.Public && BearerFromRequest(req) == "" {
|
||||
err = ErrWriteNeedsKey // never report the host's own login to an anonymous caller
|
||||
return nil, SessionOut{Valid: false}, ErrWriteNeedsKey
|
||||
}
|
||||
tok, err := d.resolveBearer(ctx, req)
|
||||
if err != nil {
|
||||
return nil, SessionOut{Valid: false}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue