ECLI-006: All extensions receive every configured Elastic credential
@margaretjgu is already working on this.
Since Aug 6, 2026.
Assessment
This issue has not been assessed yet.
Description
Severity: Medium
Problem
src/extension/context.ts:59–66 passes every credential from the active context to every extension with no scoping by declared service need:
export function buildContextEnv (config: ResolvedConfig): EnvMap {
const env: EnvMap = {}
const { elasticsearch, kibana, cloud } = config.context
if (elasticsearch != null) Object.assign(env, serviceEnv('ELASTIC_ES', elasticsearch))
if (kibana != null) Object.assign(env, serviceEnv('ELASTIC_KIBANA', kibana))
if (cloud != null) Object.assign(env, serviceEnv('ELASTIC_CLOUD', cloud))
return env
}
When the active context contains a Cloud credential, every extension receives ELASTIC_CLOUD_API_KEY, even if it does not use the Cloud API.
Each credential carries the privileges assigned when it was issued. A Cloud API key may authorize organization- or deployment-management operations, while Elasticsearch and Kibana credentials may also be broadly privileged. Passing credentials for unrelated services therefore unnecessarily expands an extension's available authority.
The README documents six variables but context.ts exports up to ten — ELASTIC_ES_USERNAME, ELASTIC_ES_PASSWORD, ELASTIC_KIBANA_USERNAME, and ELASTIC_KIBANA_PASSWORD are omitted. Extension authors who rely solely on the README do not know their process environment contains basic-auth passwords.
Fix
Short-term: Require extensions to declare the services they need in their manifest or extension registry entry. Only pass credentials for declared services:
{
"elastic": {
"services": ["elasticsearch"]
}
}
buildContextEnv reads this declaration and omits ELASTIC_CLOUD_* and ELASTIC_KIBANA_* entirely for an extension declaring only "elasticsearch".
At installation, display the requested credential scopes, require confirmation, and persist the approved scopes in the registry. On upgrade, require renewed consent before granting additional services. Fix the README table to document all ten exported variables.
- Provide an
elastic extension inspect <name>command showing: source, installed version or commit, entrypoint, declared credential scopes, and the environment variables the extension will receive. - Fail closed when the extension manifest has no credential declaration. Do not treat absence as a grant of all credentials.
Risk
Medium. A compromised extension receives the Cloud credential and whatever management-plane privileges that credential carries. Least-privilege gap, not privilege escalation.
Copied from the security review in elastic/infosec#27626 (ECLI-006).
- Dominant language
- TypeScript
- Stars
- 43
- Forks
- 24
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 59
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elastic/cli
-
cloud enhancement
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/models.dev#7701 ·