Skip to content

feat(extension): add context env-var propagation for extensions#300

Open
margaretjgu wants to merge 3 commits into
mainfrom
feat/extension-context-env
Open

feat(extension): add context env-var propagation for extensions#300
margaretjgu wants to merge 3 commits into
mainfrom
feat/extension-context-env

Conversation

@margaretjgu
Copy link
Copy Markdown
Member

Summary

Closes #294. Part of #222.

  • Adds src/extension/context.ts with a single buildContextEnv(config: ResolvedConfig) export
  • Converts the active resolved config into a flat Record<string, string> to be merged into a child process env when spawning extensions
  • Exposed variables (only set when the value is present):
    • ELASTIC_ES_URL, ELASTIC_ES_API_KEY / ELASTIC_ES_USERNAME + ELASTIC_ES_PASSWORD
    • ELASTIC_KIBANA_URL, ELASTIC_KIBANA_API_KEY / ELASTIC_KIBANA_USERNAME + ELASTIC_KIBANA_PASSWORD
    • ELASTIC_CLOUD_URL, ELASTIC_CLOUD_API_KEY
  • 9 unit tests covering no-services, api_key auth, basic auth, auth-absent, each service independently, all three together, and no-undefined values guarantee

Test plan

  • npx tsc --noEmit passes clean
  • node --import tsx/esm --test test/extension/context.test.ts -- 9/9 pass

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 5.38s
✅ REPOSITORY gitleaks yes no no 90.49s
✅ REPOSITORY git_diff yes no no 0.44s
✅ REPOSITORY secretlint yes no no 25.52s
✅ REPOSITORY trivy yes no no 13.14s
✅ TYPESCRIPT eslint 2 0 0 3.73s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(extension): context env-var propagation to extensions

1 participant