Claude SDK for Go 1.68.0
Last reviewed Sep 24, 2026
Prompt Details
Prompt Composition
2prompts
- Go 1.27130 lines · 5.5K tokens
- Claude SDK for Go 1.68.082 lines · 3.8K tokens
Total212 lines · 9.3K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 252
- 257
- 287
- 294
- 295
- 307
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 426
- 444
- 488
- 494
- 522
- 532
- 636
- 639
- 732
- 759
- 770
- 772
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1275
- 1395
- 1427
- 1428
Prompt Preview
Apply the Go 1.27 baseline first. These rules cover github.com/anthropics/anthropic-sdk-go v1.68.0, whose minimum Go version is 1.24. Apply the optional tool, session, MCP, and cloud integration rules when those features are enabled.
Clients and credentials
- Construct
anthropic.NewClientin trusted server code. Select credentials deliberately: defaults try API-key and auth-token environment variables, an explicit profile, environment federation, then the fallback profile. Useoption.WithoutEnvironmentDefaults()with explicit credentials and a configured HTTP client when the application owns credential selection. - Protect
ANTHROPIC_BASE_URL, profile/config directories, federation token files, and all client or per-request options as deployment configuration. Keepoption.WithBaseURL,WithHeader,WithMiddleware, and rawclient.Execute/Get/Postpaths out of user control; absolute URLs can retain the client's authentication and retry settings. - Supply a trusted HTTPS endpoint and an
option.WithHTTPClientwhoseCheckRedirectrejects unexpected redirects before credentials leave the approved origin; do not assume Go strips the SDK'sX-Api-Keyheader on redirects. - Bind credentials,
anthropic-workspace-id,UserProfileID, and provider resource IDs to the authenticated application tenant. Keep organization administration, federation, vault, and deployment operations behind separate privileged authorization; exposingclient.Beta.Organizationis not a tenant access-control layer. - Scope federation with
option.FederationOptions.WorkspaceIDat