Repository navigation
fix: harden API container bootstrap - #3203
Open
Tal Zaccai (TalZaccai) wants to merge 6 commits into
Open
Tal Zaccai (TalZaccai) wants to merge 6 commits into
Tal Zaccai (TalZaccai) wants to merge 6 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Default builds select the smoke runner, smoke imports fail, and Cosmos DB credentials bypass hosted filtering.
3 open issues
What changed in this PR
Hardens the production API container with non-root execution and dedicated managed-identity configuration.
Changes:
- Replaces Azure CLI bootstrap with validated, in-memory hosted configuration.
- Restricts runtime permissions and credential handling.
- Adds bootstrap regressions, container smoke checks, and deployment documentation.
| File | Description |
|---|---|
| ts/tools/scripts/testApiContainer.mjs | Builds and checks container images. |
| ts/packages/api/test/containerImage.spec.ts | Checks production image configuration. |
| ts/packages/api/test/containerBootstrap.spec.ts | Tests bootstrap validation and credential rejection. |
| ts/packages/api/src/typeAgentServer.ts | Accepts validated runtime configuration. |
| ts/packages/api/src/storageProviders/azureStorageProvider.ts | Uses the shared credential factory. |
| ts/packages/api/src/startup.ts | Gates startup on configuration loading. |
| ts/packages/api/src/index.ts | Integrates bootstrap before server startup. |
| ts/packages/api/src/containerBootstrap.ts | Implements dedicated hosted configuration loading. |
| ts/packages/api/README.md | Documents configuration and deployment requirements. |
| ts/packages/api/package.json | Restricts packaged runtime files. |
| ts/packages/api/container/start.sh | Adds fail-fast startup checks. |
| ts/packages/api/container/smoke.mjs | Checks runtime behavior with local mocks. |
| ts/packages/aiclient/test/auth.spec.ts | Tests credential selection. |
| ts/packages/aiclient/src/auth.ts | Adds managed-identity credential selection. |
| ts/Dockerfile | Separates build dependencies and configures non-root runtime. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Issue
The production API container ran as root, established an Azure CLI session, and used the general
getKeysbootstrap to import broad shared configuration into plaintext. A compromised API or dependency could therefore access substantially more credentials and runtime authority than required.Mitigating steps
getKeysbootstrap, and persistent Azure CLI account state from the runtime image.TYPEAGENT_API_CONFIG_VAULTand least-privilege Key Vault secret-read plus Azure OpenAI RBAC for the managed identity.