|
| 1 | +## Security |
| 2 | + |
| 3 | +> Follow these security guidelines for every change to the Atlan Java SDK. |
| 4 | +
|
| 5 | +### Contact |
| 6 | + |
| 7 | +- **Security Team:** #bu-security-and-it on Slack |
| 8 | + |
| 9 | +### Quickstart for Agents |
| 10 | + |
| 11 | +atlan-java is Atlan's Java SDK (multi-module Gradle, Kotlin DSL). Modules: |
| 12 | + |
| 13 | +- `sdk/` — Core Java SDK client (`AtlanClient`, `HttpClient`); API key auth via `Authorization: Bearer` header; `HttpURLConnectionClient` for HTTP transport; WireMock for unit tests. |
| 14 | +- `package-toolkit/runtime/` — Utilities for custom packages including S3 (`S3Utils`), GCS, ADLS connectors, CSV/Excel processing. |
| 15 | +- `package-toolkit/config/` — Pkl language support for package configuration. |
| 16 | +- `integration-tests/` — E2E tests against live Atlan environment using `ATLAN_BASE_URL` and `ATLAN_API_KEY` env vars. |
| 17 | + |
| 18 | +Review every change for: |
| 19 | + |
| 20 | +- **API key logging** — `AtlanClient` holds the API key and sets it as `Authorization: Bearer <key>` on every HTTP request; the key must never appear in log output, SLF4J messages, or exception `getMessage()` results; when logging `HttpClient` errors, strip the `Authorization` header value from the logged request details; `ATLAN_API_KEY` read from environment for integration tests must similarly not be logged. |
| 21 | +- **TLS certificate verification** — `HttpURLConnectionClient` must not disable hostname verification (`HttpsURLConnection.setDefaultHostnameVerifier(...)` with an always-true lambda) or bypass certificate validation via a trust-all `SSLContext`; if custom CA bundles are needed for corporate proxies, accept the CA certificate path, not a bypass flag. |
| 22 | +- **Package-toolkit S3/GCS/ADLS credential logging** — `S3Utils` and equivalent GCS/ADLS utilities accept access keys, secret keys, and service account credentials; these must not be logged; use `@ToString(exclude=...)` Lombok annotations or equivalent to exclude credential fields from `toString()`. |
| 23 | +- **Pkl config secrets** — `package-toolkit/config/` uses Pkl to define package configuration schemas; if any Pkl config field represents a secret (password, API key, token), mark it as sensitive and ensure it is excluded from serialization outputs used for logging or UI display. |
| 24 | +- **Dependency version pinning** — all direct dependencies in `sdk/build.gradle.kts` and `package-toolkit/*/build.gradle.kts` must use explicit version strings; avoid dynamic version ranges (`+`, `latest.release`) which allow supply-chain substitution. |
| 25 | + |
| 26 | +### Security Invariants |
| 27 | + |
| 28 | +- **[MUST]** API key (`ATLAN_API_KEY`, `apiKey`) must never appear in log output or exception messages. |
| 29 | +- **[MUST]** TLS certificate verification and hostname verification must not be disabled. |
| 30 | +- **[MUST]** S3/GCS/ADLS credential values must not be logged — use `@ToString(exclude=...)`. |
| 31 | +- **[MUST]** All direct dependencies must use explicit version pins — no dynamic version ranges. |
| 32 | + |
| 33 | +### Data Classification |
| 34 | + |
| 35 | +- **CONFIDENTIAL:** `ATLAN_API_KEY`, S3 secret access key, GCS service account JSON, ADLS client secret |
| 36 | +- **INTERNAL:** `ATLAN_BASE_URL`, workspace IDs, asset GUIDs, object storage bucket names |
| 37 | +- **PUBLIC:** SDK version, asset type names, API endpoint names |
| 38 | + |
| 39 | +### Review Checklist |
| 40 | + |
| 41 | +- [ ] `ATLAN_API_KEY` / `apiKey` absent from all log output and exception messages |
| 42 | +- [ ] No `trustAllCerts`, `setDefaultHostnameVerifier(always-true)`, or bypass `SSLContext` |
| 43 | +- [ ] S3/GCS/ADLS credential fields excluded from `toString()` via Lombok or equivalent |
| 44 | +- [ ] Pkl config secret fields marked sensitive and excluded from log serialization |
| 45 | +- [ ] All `build.gradle.kts` dependencies use explicit version pins (no `+` or `latest.release`) |
0 commit comments