You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add configuration documents as reusable DSC resources - #1838
Reusable configurations currently require consumers to duplicate their nested resource definitions or expose group result trees. This adds configuration-backed document resources with a parameterized input contract and output-only public state.
Discover versioned .dsc.document.json, .dsc.document.yaml, and .dsc.document.yml definitions with an embedded manifest and document kind.
Validate effective parameters after defaults against an inline JSON Schema, including local $defs/$ref, then run explicitly declared get, set, and test operations in isolated configuration contexts.
Project declared outputs into standard resource responses while preserving aggregate child compliance, changes, and restart requirements. Reject recursion, including across group subprocesses, and keep child diagnostics in tracing.
Add schema export support, authoring documentation, a reusable greeting example, and focused coverage.
This initial implementation intentionally excludes export, delete, resolve, what-if, and graph expansion. Execution retains ordinary configuration failure semantics without transactional rollback; historical generated schemas are unchanged.
Validation
Targeted repository builds, Clippy, and document-resource Rust tests.
Document-resource integration tests and existing group, include, discovery, restart, and JSON-RPC regressions.
Generated schema validation, including invalid contracts, and example execution for get, set, and test.
Discover dedicated document definitions and run declared get, set, and test operations in isolated configuration contexts. Validate effective inputs against inline JSON Schema and expose declared outputs as public state while preserving child change and restart signals.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Changed code coverage measures only Rust lines added/modified in this PR.
Full codebase coverage measures all instrumented Rust lines across the project.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Expression string conversion can expose plaintext secrets in public state and logs, while group result handling misreports compliance and changes and drops restart requirements.
Adds configuration-backed DSC resources for #1499, allowing consumers to reuse parameterized configurations through a versioned resource interface with declared outputs as public state.
Changes:
Adds document-resource discovery, manifests, operation declarations, and input-schema validation.
Initialize the optional document definition to None in all three command-resource fixtures so full-workspace CI builds compile.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues expose secure values in trace logs, drop restart requirements from compliant groups, and reject valid expression-based parameters during validation.
This branch binds unevaluated consumer expressions as literal input, so an int parameter supplied as [variables('count')] fails validation even though execution would resolve it correctly. This also blocks execution inside Microsoft.DSC/Group, whose validate operation runs dsc config validate on the raw child properties (dsc/src/subcommand.rs:533–538). Separate static validation from runtime binding: evaluate expressions with the consumer context where possible, and defer checks that require runtime values.
Preserve Assertion state responses when normalizing Group results. Verify the adapter's received resource path without depending on sensitive argument traces.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Redact secure transport values in payload diagnostics and keep literal wrappers opaque. Preserve execution information and metadata during nested test-to-set conversion, with forwarding and compliant-pretest regressions.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Omitted secure-string defaults can leak through trace logs, while observed-only outputs and expression-valued inputs can cause incorrect execution or validation failures.
No open issues 🎉
3 previously missed issues
In code that hasn't changed since last review
Redact secure parameter defaults before trace logging
Omitting a secureString parameter can expose its default under -l trace: set_parameters() evaluates it before wrapping it, while the parser logs literals and unwrapped expression results. Make secure-default evaluation sensitivity-aware so these diagnostics are suppressed or redacted before entering the parser. Add trace regressions for omitted secure parameters with both literal and envvar() defaults.
Preserve observed-only properties in no-op before_state
When a compliant child returns an observed property omitted from its desired input, such as a generated id, this no-op path drops that property from before_state. A document output referencing it then fails during the before-state projection at document_resource.rs:246–249, so an idempotent set returns an error. Build before_state from the observed pretest state, retaining redaction, and add a regression with an observed-only output.
Defer validation of unresolved document input expressions
dsc config validate passes unevaluated properties with a fresh context, so this runtime-binding path rejects [variables('port')] as a string for an integer parameter even though execution resolves it successfully. Separate static validation from execution preparation and defer value checks that depend on unresolved consumer expressions. Add a configuration-validation regression using expression-valued document inputs.
Suppress sensitive default-evaluation diagnostics, preserve observed state for actual compliant pretests without changing what-if, and defer unresolved document inputs during static validation. Add focused Rust and CLI regressions and document the validation contract.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Addressed all three previously missed issues from the latest review in d8761b0:
Secure defaults: evaluate secure defaults under a scoped no-subscriber dispatcher, before wrapping, and return a sanitized error on evaluation failure. Trace regressions cover omitted literal and envvar() defaults during get/set/test, plus a malformed secure default.
Observed-only outputs: normalize compliant actual pretests from their observed state, recursively through groups, retaining before-state redaction and reporting no change. Synthetic what-if conversion remains unchanged. Regressions project a generated id from direct and grouped compliant children whose set commands must never run.
Expression-valued inputs: static document validation no longer performs runtime preparation. It checks declared names, known values and constraints, and defers unresolved expressions/defaults and dependent schema checks until full runtime validation. Regressions cover integer inputs supplied through variables, including Group validation/execution, nested expressions, and invalid known inputs.
Validation: repository build and Clippy passed; 11 document Rust tests and 150 focused Pester tests passed. Broader registry-dependent checks are blocked locally by the missing registry executable / Microsoft.Windows/Registry resource.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Secure defaults pass document validation but fail execution because constraints are checked after wrapping, causing omitted defaults to behave differently from identical explicitly supplied values.
Check default constraints against their unwrapped values while retaining secure transport wrappers for storage. Cover omitted and explicit values, wrapped defaults, invalid constraints, and trace-safe constrained document defaults.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because resource listings and evaluation logs expose secrets, while document-test projections can discard fields required by valid outputs.
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
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.
Summary
Reusable configurations currently require consumers to duplicate their nested resource definitions or expose group result trees. This adds configuration-backed document resources with a parameterized input contract and output-only public state.
.dsc.document.json,.dsc.document.yaml, and.dsc.document.ymldefinitions with an embedded manifest anddocumentkind.$defs/$ref, then run explicitly declared get, set, and test operations in isolated configuration contexts.This initial implementation intentionally excludes export, delete, resolve, what-if, and graph expansion. Execution retains ordinary configuration failure semantics without transactional rollback; historical generated schemas are unchanged.
Validation
Fixes: #1499