fix(auth): clear public write errors and Grok client path
Some checks failed
test-and-deploy / test (push) Failing after 12m11s
test-and-deploy / deploy-138 (push) Has been cancelled

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:
George Lambert 2026-10-12 14:09:22 -04:00
commit 369f9210bd

View file

@ -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
}