Platform scripts, MCP servers, deployment and docs for the KAB runs
- Scripts to run workflows from a YAML context or run inputs (kab_run_workflow.py, with --input name=@file), store per-project discovery connections, bootstrap agent MCP keys, refresh the KAB token, publish reports and build estate snapshots. - Hyperscaler discovery servers extended in place; cloud-knowledge folded into them. - deploy/crucible-kab-dev.yaml: the Discovery package agent and the Assessment agents. - Platform issue write-ups and current-wiring notes under docs/platform-issues/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
# Artifacts step: the lookup isn't scoped to the run's tenant or project
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Date | 2026-11-02 |
|
||||
| Environment | `modernization-platform` @ `c89aedcb9`, read from source. Not reproduced on `crucible-kab-dev-aks` |
|
||||
| Component | `agent-builder-temporal-workers`: the `select_artifacts` activity ("Artifacts" step). `agent-builder-api`: the execution routes' artifact check |
|
||||
| Severity | Possibly high: a tenant-isolation defect, if it's confirmed. Unconfirmed, because another layer may block it |
|
||||
| Status | Open; needs triage by the platform team |
|
||||
| Found by | Code review of the hand-off from ALZ-F01 Discovery to ALZ-F02 Assessment |
|
||||
|
||||
## Summary
|
||||
|
||||
`SelectArtifactsActivity.execute` reads the raw `artifacts` collection with no tenant or project filter. It matches
|
||||
each requested entry against the artifact's `_id`, `workflow_id` or `name`:
|
||||
|
||||
```python
|
||||
# packages/agent-builder-temporal-workers/src/temporal/activities/artifacts_activities.py, around lines 107-125
|
||||
collection = db.db["artifacts"]
|
||||
...
|
||||
query["$or"].extend([
|
||||
{"_id": {"$in": raw_ids}},
|
||||
{"workflow_id": {"$in": raw_ids}},
|
||||
{"name": {"$in": raw_ids}},
|
||||
])
|
||||
```
|
||||
|
||||
From reading the code, an id, name or workflow id that belongs to another tenant or project would resolve, and its
|
||||
content would be inlined into the run.
|
||||
|
||||
## What happens
|
||||
|
||||
| # | Behaviour | Code |
|
||||
|---|---|---|
|
||||
| 1 | The activity reads the unscoped `db.db["artifacts"]` collection | `temporal/activities/artifacts_activities.py:106` |
|
||||
| 2 | Nothing in the activity refers to `tenant_id` or `project_id`, although `ActivityContext` carries both | `temporal/activities/base_activity.py:41-42` |
|
||||
| 3 | The API's own check, when a run starts, uses the tenant-scoped `db._scoped("artifacts")`. But it only checks file types: it doesn't reject ids from outside the tenant | `agent-builder-api/src/api/workflows/workflow_execution_routes.py:1233` |
|
||||
| 4 | That API check reads only ids set when the workflow was built (`step.inputs.artifact_ids`). Ids given as the run input `<step_id>_artifact_ids` aren't checked at all | Same file, `:1244`; the auto-mapping is in `generic_workflow_executor.py:199-210` |
|
||||
| 5 | A match on `workflow_id` or `name` resolves to the first document found. Given a workflow id, the step returns one run's output, and nothing guarantees which | `artifacts_activities.py:139-146` `_resolve` |
|
||||
|
||||
## Not yet checked
|
||||
|
||||
- Whether Mongo users or roles in the worker limit what it can read.
|
||||
- Whether the UI or the API validates run inputs before the run starts.
|
||||
- Whether artifact names are unique across tenants. They're `{execution_id}_{step_id}` for step outputs, but a name on
|
||||
an uploaded artifact is chosen by the uploader.
|
||||
|
||||
## Impact on the CP1 workflows
|
||||
|
||||
None found so far: CP1 runs in one tenant. Until this is triaged, CP1 workflows select artifacts by exact `_id` only.
|
||||
|
||||
## Questions for the platform team
|
||||
|
||||
1. Can a run in tenant A select an artifact owned by tenant B through this step?
|
||||
2. If it can, could the query be scoped to the run's tenant and project, with any id resolving outside them rejected?
|
||||
3. Should `workflow_id` and `name` matches be kept? If so, could they be made deterministic, for example the latest
|
||||
completed run?
|
||||
|
||||
## Evidence
|
||||
|
||||
Code reading of `modernization-platform` @ `c89aedcb9`. Nothing was run against the platform, and nothing was changed.
|
||||
Reference in New Issue
Block a user