Anthropic SDK for Java 2.60.0
Last reviewed Sep 23, 2026
Prompt Details
Prompt Composition
2prompts
- Java 25113 lines · 2.8K tokens
- Anthropic SDK for Java 2.60.0135 lines · 5.2K tokens
Total248 lines · 8K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 201
- 208
- 209
- 214
- 294
- 295
- 297
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 488
- 494
- 502
- 532
- 611
- 639
- 653
- 681
- 732
- 770
- 772
- 776
- 789
- 807
- 829
- 841
- 862
- 863
- 915
- 916
- 918
- 922
- 942
- 1333
- 1426
- 1427
Prompt Preview
Apply these rules whenever you write or review code that uses com.anthropic:anthropic-java 2.60.0. The SDK supports Java 8 and later; use these rules with the Java 25 baseline for Java 25 deployments. Use the APIs present in 2.60.0 rather than assuming newer SDK examples apply unchanged.
Treat the model, every tool result, every MCP server, and every webhook sender as an untrusted source. The SDK moves that data into your process faithfully; it does not sanitize it, confine it, or authorize it for you.
Client construction and credential resolution
- Reuse a long-lived
AnthropicClientwithin one credential and tenant trust boundary. KeepwithOptionsmodifiers under application control; derived clients share transport resources and are not independent security boundaries. - Inject credentials from a secret store through
apiKey,authToken, or protected environment configuration. Keep secrets out of-Danthropic.apiKeyand-Danthropic.authTokencommand-line arguments, and account for these system properties taking precedence over environment variables infromEnv(). - Configure only the intended authentication mode: a populated
apiKeyorauthTokenprevents federation/profile resolution. With environment resolution enabled and no static credential,ANTHROPIC_PROFILEprecedes direct federation environment variables and the active/default on-disk profile. - Protect profile files,
active_config, and credential caches from other users. Their root isANTHROPIC_CONFIG_DIR, otherwise~/.config/anthropicon Unix or%APPDATA%\Anthropicon Windows; a