feat(config)!: one ordering for configuration sources, and a bootstrap deny rule
$DSH_HOME/.env had just become an ordinary environment layer, which left the harness resolving user-facing values from a flattened process.env that could no longer say where a value came from. A key stored through the web page stayed shadowed by an older key in the user's own .env. An endpoint could be redirected by the project: the invoking directory's .env is materialized like every other layer, and a base URL decides where a resolved API key is sent, so a DEEPSEEK_BASE_URL written into a model-editable workspace would send the user's credential — and the prompts carrying their code — to whatever host that file named. Give every user-facing value one ordering, with four kinds of source: explicit for this run per-operation override, CLI argument > authored by deployment --config / --config-replace > this launch's shell inherited process environment > product-managed store settings.yaml, .credentials.yaml > discovered file $DSH_HOME/.env > defaults schema default, shipped base, public default The domains differ only in which tiers exist. The earlier split — credentials ranking the environment over the managed file while settings ranked over the environment — was inconsistent: the distinguishing fact is who authored the source, not the domain. packages/util/environment owns an immutable snapshot with per-layer provenance. getFrom(name, sources) searches only the layers a caller names, and omitting one is a refusal rather than a demotion: the adapters ask for ['process', 'user-env'], so no reordering can let a project file back into a decision it was excluded from. isBootstrapOnly rejects, before anything is materialized, any .env setting a variable that governs how a process launches (PATH, SHELL, NODE_OPTIONS, LD_PRELOAD), where code or model-visible instructions load from (the whole DSH_* namespace, HOME, XDG_*), or how the network is reached (proxy and CA variables). The namespace is denied wholesale so a switch added later cannot become settable by being forgotten, and there is no opt-out. verify-config-source-ownership keeps both rules: no unregistered process.env read under packages/*/*/src (26 allowlisted with reasons), and no apiKey, baseURL, or headers inlined from the environment in shipped Cordis config — removing those inlines is what makes the deployment tier meaningful.
This commit is contained in:
45
pnpm-lock.yaml
generated
45
pnpm-lock.yaml
generated
@@ -243,6 +243,9 @@ importers:
|
||||
'@deepseek-ai/dsh-credentials-local':
|
||||
specifier: workspace:^
|
||||
version: link:../../packages/credentials/credentials-local
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../packages/util/environment
|
||||
'@deepseek-ai/dsh-frontend':
|
||||
specifier: workspace:^
|
||||
version: link:../web
|
||||
@@ -2638,6 +2641,9 @@ importers:
|
||||
'@deepseek-ai/dsh-credentials':
|
||||
specifier: workspace:^
|
||||
version: link:../credentials
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../util/environment
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
@@ -3609,6 +3615,9 @@ importers:
|
||||
'@deepseek-ai/dsh-credentials':
|
||||
specifier: workspace:^
|
||||
version: link:../../credentials/credentials
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../util/environment
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
@@ -3637,6 +3646,9 @@ importers:
|
||||
'@deepseek-ai/dsh-credentials':
|
||||
specifier: workspace:^
|
||||
version: link:../../credentials/credentials
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../util/environment
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
@@ -5673,6 +5685,9 @@ importers:
|
||||
|
||||
packages/ui/app-boot:
|
||||
dependencies:
|
||||
dotenv:
|
||||
specifier: ^17.2.0
|
||||
version: 17.4.2
|
||||
js-yaml:
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0
|
||||
@@ -5689,6 +5704,9 @@ importers:
|
||||
'@cordisjs/plugin-timer':
|
||||
specifier: workspace:^
|
||||
version: link:../../../vendor/timer
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../util/environment
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
@@ -5988,6 +6006,15 @@ importers:
|
||||
specifier: ^4.0.0-rc.7
|
||||
version: link:../../../vendor/cordis
|
||||
|
||||
packages/util/environment:
|
||||
devDependencies:
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
cordis:
|
||||
specifier: ^4.0.0-rc.7
|
||||
version: link:../../../vendor/cordis
|
||||
|
||||
packages/util/native-command:
|
||||
devDependencies:
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
@@ -6129,6 +6156,9 @@ importers:
|
||||
'@deepseek-ai/dsh-credentials-local':
|
||||
specifier: workspace:^
|
||||
version: link:../../credentials/credentials-local
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../util/environment
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
@@ -6148,6 +6178,9 @@ importers:
|
||||
specifier: ^3.18.0
|
||||
version: link:../../../vendor/schemastery
|
||||
devDependencies:
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../util/environment
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
@@ -6164,6 +6197,9 @@ importers:
|
||||
specifier: ^3.18.0
|
||||
version: link:../../../vendor/schemastery
|
||||
devDependencies:
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../util/environment
|
||||
'@deepseek-ai/dsh-invariants':
|
||||
specifier: workspace:^
|
||||
version: link:../../support/invariants
|
||||
@@ -6420,6 +6456,9 @@ importers:
|
||||
'@deepseek-ai/dsh-credentials':
|
||||
specifier: workspace:^
|
||||
version: link:../../packages/credentials/credentials
|
||||
'@deepseek-ai/dsh-environment':
|
||||
specifier: workspace:^
|
||||
version: link:../../packages/util/environment
|
||||
'@deepseek-ai/dsh-fs':
|
||||
specifier: workspace:^
|
||||
version: link:../../packages/fs/fs
|
||||
@@ -9776,6 +9815,10 @@ packages:
|
||||
dompurify@3.4.11:
|
||||
resolution: {integrity: sha512-zhlUV12GsaRzMsf9q5M254YhA4+VuF0fG+QFqu6aYpoGlKtz+w8//jBcGVYBgQkR5GHjUomejY84AV+/uPbWdw==}
|
||||
|
||||
dotenv@17.4.2:
|
||||
resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
dts-resolver@3.0.0:
|
||||
resolution: {integrity: sha512-1T1f+z+4tl9XD+m+0HBgWoL/nm0bOIffyWaUuUSBlFg/86IWvfx+wjNaO/ybU0AJzG9/Mi5hBUgGV6zCmWEN7Q==}
|
||||
engines: {node: ^22.18.0 || >=24.0.0}
|
||||
@@ -14828,6 +14871,8 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@types/trusted-types': 2.0.7
|
||||
|
||||
dotenv@17.4.2: {}
|
||||
|
||||
dts-resolver@3.0.0(oxc-resolver@11.20.0):
|
||||
optionalDependencies:
|
||||
oxc-resolver: 11.20.0
|
||||
|
||||
Reference in New Issue
Block a user