Skip to content

Commit dca38cb

Browse files
authored
Merge branch 'main' into add-registry-what-if
2 parents 60e97bc + f0ffdf4 commit dca38cb

File tree

35 files changed

+1592
-189
lines changed

35 files changed

+1592
-189
lines changed

CHANGELOG.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,33 @@ changes since the last release, see the [diff on GitHub][unreleased].
8181
[actual configuration set operation][ur-ab], except that the metadata field
8282
[executionType][ur-ac] is set to `WhatIf` instead of `Actual`.
8383

84-
In this release, the generated output is synthetic, based on the results of the resources' `test`
85-
operation. In the future, resources will be able to participate in what-if operations, reporting
86-
more specifically how they will change the system. For example, participating resources could
87-
indicate whether an actual set operation will require a reboot or whether the current user has
88-
the correct permissions to manage that resource instance.
84+
By default, the generated output is synthetic, based on the results of the resources' `test`
85+
operation. Resources can define the [whatIf][ur-ad] property in their resource manifest to
86+
participate in what-if operations, reporting more specifically how they will change the system.
87+
For example, participating resources could indicate whether an actual set operation will require
88+
a reboot or whether the current user has the correct permissions to manage that resource
89+
instance.
90+
91+
Participating resources have the [WhatIf capability][ur-ae].
8992

9093
<details><summary>Related work items</summary>
9194

9295
- Issues: [#70][#70]
93-
- PRs: [#400][#400]
96+
- PRs:
97+
- [#400][#400]
98+
- [#441][#441]
9499

95100
</details>
96101

97-
- Added support for [importer resources][ur-ad]. These resources resolve external sources to a
102+
- Added support for [importer resources][ur-af]. These resources resolve external sources to a
98103
nested DSC Configuration document. The resolved instances are processed as nested resource
99104
instances.
100105

101106
This required some updates to the schemas, all backwards-compatible:
102107

103-
- Added a new [resourceKind][ur-ae] named `Import`.
104-
- Added the [resolve][ur-af] command to resource manifests.
105-
- Added the new [`Resolve`][ur-ag] capability, returned in the output for the
108+
- Added a new [resourceKind][ur-ag] named `Import`.
109+
- Added the [resolve][ur-ah] command to resource manifests.
110+
- Added the new [`Resolve`][ur-ai] capability, returned in the output for the
106111
[dsc resource list][cmd-rlist] command when DSC discovers an importer resource.
107112

108113
<details><summary>Related work items</summary>
@@ -202,7 +207,6 @@ the correct permissions to manage that resource instance.
202207

203208
</details>
204209

205-
206210
### Fixed
207211

208212
- Fixed the JSON Schema for [exit codes][ur-fa] in the resource manifest to support negative
@@ -216,14 +220,29 @@ the correct permissions to manage that resource instance.
216220

217221
</details>
218222

223+
- Fixed the behavior of the [int()][int()] configuration function to error when given an input
224+
value other than a string or integer. Prior to this release, when you specified a number with
225+
a fractional part as input for the function, it coerced the input value to an integer representing
226+
the fractional part. Starting with this release, the `int()` function raises an invalid input
227+
error when the input value isn't a string or an integer.
228+
229+
<details><summary>Related work items</summary>
230+
231+
- Issues: [#390][#390]
232+
- PRs: [#438][#438]
233+
234+
</details>
235+
219236
<!-- Unreleased change links -->
220237
[ur-aa]: ./docs/reference/cli/config/set.md#-w---what-if
221238
[ur-ab]: ./docs/reference/schemas/outputs/config/set.md
222239
[ur-ac]: ./docs/reference/schemas/metadata/Microsoft.DSC/properties.md#executiontype
223-
[ur-ad]: ./docs/reference/schemas/definitions/resourceKind.md#importer-resources
224-
[ur-ae]: ./docs/reference/schemas/definitions/resourceKind.md
225-
[ur-af]: ./docs/reference/schemas/resource/manifest/resolve.md
226-
[ur-ag]: ./docs/reference/schemas/outputs/resource/list.md#capability-resolve
240+
[ur-ad]: ./docs/reference/schemas/resource/manifest/whatif.md
241+
[ur-ae]: ./docs/reference/schemas/outputs/resource/list.md#capability-whatif
242+
[ur-af]: ./docs/reference/schemas/definitions/resourceKind.md#importer-resources
243+
[ur-ag]: ./docs/reference/schemas/definitions/resourceKind.md
244+
[ur-ah]: ./docs/reference/schemas/resource/manifest/resolve.md
245+
[ur-ai]: ./docs/reference/schemas/outputs/resource/list.md#capability-resolve
227246
[ur-fa]: ./docs/reference/schemas/resource/manifest/root.md#exitcodes
228247

229248
## [v3.0.0-preview.7][release-v3.0.0-preview.7] - 2024-04-22
@@ -1481,6 +1500,7 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v
14811500
[#382]: https://github.com/PowerShell/DSC/issues/382
14821501
[#385]: https://github.com/PowerShell/DSC/issues/385
14831502
[#388]: https://github.com/PowerShell/DSC/issues/388
1503+
[#390]: https://github.com/PowerShell/DSC/issues/390
14841504
[#397]: https://github.com/PowerShell/DSC/issues/397
14851505
[#400]: https://github.com/PowerShell/DSC/issues/400
14861506
[#401]: https://github.com/PowerShell/DSC/issues/401
@@ -1491,6 +1511,8 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v
14911511
[#429]: https://github.com/PowerShell/DSC/issues/429
14921512
[#432]: https://github.com/PowerShell/DSC/issues/432
14931513
[#434]: https://github.com/PowerShell/DSC/issues/434
1514+
[#438]: https://github.com/PowerShell/DSC/issues/438
1515+
[#441]: https://github.com/PowerShell/DSC/issues/441
14941516
[#45]: https://github.com/PowerShell/DSC/issues/45
14951517
[#49]: https://github.com/PowerShell/DSC/issues/49
14961518
[#57]: https://github.com/PowerShell/DSC/issues/57

CODE_OF_CONDUCT.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Code of Conduct
1+
# Microsoft Open Source Code of Conduct
22

3-
This project has adopted the [Microsoft Open Source Code of Conduct][conduct-code].
4-
For more information see the [Code of Conduct FAQ][conduct-FAQ] or contact [[email protected]][conduct-email] with any additional questions or comments.
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
54

6-
[conduct-code]: https://opensource.microsoft.com/codeofconduct/
7-
[conduct-FAQ]: https://opensource.microsoft.com/codeofconduct/faq/
8-
[conduct-email]: mailto:[email protected]
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
10+
- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ To run the link-checker, follow these steps:
6666
## Code of Conduct Enforcement
6767

6868
Reports of abuse will be reviewed by the PS-Committee and if it has been determined that violations of the
69-
Code of Conduct has occurred, then a temporary ban may be imposed.
69+
[Code of Conduct](CODE_OF_CONDUCT.md) has occurred, then a temporary ban may be imposed.
7070
The duration of the temporary ban will depend on the impact and/or severity of the infraction.
7171
This can vary from 1 day, a few days, a week, and up to 30 days.
7272
Repeat offenses may result in a permanent ban from the PowerShell org.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ DSCv3 uses JSON schemas to define the structure of resources, configuration docu
6565
outputs that DSCv3 returns. These schemas make it easier to integrate DSCv3 with other tools,
6666
because they standardize and document how to interface with DSCv3.
6767

68+
## Code of Conduct
69+
70+
Please see our [Code of Conduct](CODE_OF_CONDUCT.md) before participating in this project.
71+
72+
## Security Policy
73+
74+
For any security issues, please see our [Security Policy](SECURITY.md).
75+
6876
[00]: https://github.com/powershell/psdesiredstateconfiguration
6977
[01]: https://github.com/PowerShell/DSC/releases/latest
7078
[02]: https://learn.microsoft.com/powershell/dsc/overview?view=dsc-3.0&preserve-view=true

SECURITY.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,41 @@
1-
# Security Vulnerabilities
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
22

3-
Security issues are treated very seriously and will, by default,
4-
takes precedence over other considerations including usability, performance,
5-
etc... Best effort will be used to mitigate side effects of a security
6-
change, but DSC must be secure by default.
3+
## Security
74

8-
## Reporting a security vulnerability
5+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin) and [PowerShell](https://github.com/PowerShell).
96

10-
If you believe that there is a security vulnerability in DSC,
11-
it **must** be reported using [https://aka.ms/secure-at](https://aka.ms/secure-at) to allow for [Coordinated Vulnerability Disclosure](https://technet.microsoft.com/security/dn467923).
12-
**Only** file an issue, if [MSRC](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue?rtc=1) has confirmed filing an issue is appropriate.
7+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
14+
15+
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
16+
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18+
19+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20+
21+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
* Full paths of source file(s) related to the manifestation of the issue
23+
* The location of the affected source code (tag/branch/commit or direct URL)
24+
* Any special configuration required to reproduce the issue
25+
* Step-by-step instructions to reproduce the issue
26+
* Proof-of-concept or exploit code (if possible)
27+
* Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

docs/reference/schemas/config/functions/int.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Reference for the 'int' DSC configuration document function
3-
ms.date: 04/09/2024
3+
ms.date: 06/13/2024
44
ms.topic: reference
55
title: int
66
---
@@ -9,7 +9,7 @@ title: int
99

1010
## Synopsis
1111

12-
Returns an integer from an input string or non-integer number.
12+
Returns an integer from an input string or integer.
1313

1414
## Syntax
1515

@@ -19,8 +19,9 @@ int(<inputValue>)
1919

2020
## Description
2121

22-
The `int()` function returns an integer, converting an input string or non-integer number into an
23-
integer. It truncates the fractional part of the input number, it doesn't round up.
22+
The `int()` function returns an integer, converting an input string into an integer. If you pass an
23+
integer, it returns the integer. If you pass any other value, including a non-integer number, the
24+
function raises an invalid input error.
2425

2526
## Examples
2627

@@ -57,17 +58,12 @@ hadErrors: false
5758
5859
### inputValue
5960
60-
The `int()` function expects input as either a string or a number. If the value is a string that
61-
can't be parsed as a number, DSC returns an error for the function.
62-
63-
> [!NOTE]
64-
> There is an open bug (see [GitHub issue #390][#390]) for this function when operating on numbers.
65-
> The function correctly returns the expected value for string representations of numbers with
66-
> fractional parts, but returns the fractional part instead of the integer for actual numbers.
67-
> Specify the input value for this function as a string instead of a number.
61+
The `int()` function expects input as either a string or an integer. If the value is a string that
62+
can't be parsed as a number DSC returns an error for the function. If the value isn't a string or
63+
integer, DSC returns an invalid input error for the function.
6864

6965
```yaml
70-
Type: [String, Number]
66+
Type: [String, Integer]
7167
Required: true
7268
MinimumCount: 1
7369
MaximumCount: 1
@@ -84,4 +80,3 @@ Type: integer
8480
```
8581

8682
<!-- Link reference definitions -->
87-
[#390]: https://github.com/PowerShell/DSC/issues/390

docs/reference/schemas/outputs/resource/list.md

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ optional and depend on the resource.
8585

8686
The following list describes the available capabilities for a resource:
8787

88-
- <a id="capability-get" /> `Get` - The resource supports retrieving the current state of an
88+
- <a id="capability-get" ></a> `Get` - The resource supports retrieving the current state of an
8989
instance. All DSC Resources must have this capability. A resource has this capability when it
9090
defines the mandatory [get][07] property in its resource manifest.
91-
- <a id="capability-set" /> `Set` - The resource supports enforcing the desired state of an
91+
- <a id="capability-set" ></a> `Set` - The resource supports enforcing the desired state of an
9292
instance. A resource has this capability when it defines the [set][08] property in its resource
9393
manifest. Resources without this capability can't be used with the [dsc resource set][09] or
9494
[dsc config set][10] commands unless they're in a [Microsoft.DSC/Assertion][11] group as a nested
9595
instance.
96-
- <a id="capability-sethandlesexist" /> `SetHandlesExist` - The resource supports the
96+
- <a id="capability-sethandlesexist" ></a> `SetHandlesExist` - The resource supports the
9797
[_exist property][12] directly. A resource has this capability when it defines the
9898
[handlesExist][13] property as `true` in the definition of the [set][08] command property in its
9999
resource manifest.
@@ -106,28 +106,43 @@ The following list describes the available capabilities for a resource:
106106

107107
If the resource doesn't have this capability or the `Delete` capability, DSC raises an error when
108108
an instance defines `_exist` as `false`.
109-
- <a id="capability-test" /> `Test` - The resource supports validating the desired state of an
109+
- <a id="capability-whatif" ></a> `WhatIf` - The resource supports returning explicit information
110+
about how it will modify state when a user calls [dsc config set][10] with the [--what-if][15]
111+
option. A resource has this capability when it defines the [What-if method][16] in its resource
112+
manifest.
113+
114+
When a resource has this capability, DSC calls the defined command with its arguments when a
115+
user executes the `dsc config set` command with the `--what-if` option.
116+
117+
When a resource doesn't have this capability, DSC synthesizes how the resource will change and
118+
instance by converting the `Test` result for the instance into a `Set` result. The synthetic
119+
operation can't indicate potential issues or changes that can't be determined by comparing the
120+
result of the `Test` operation against the resource's desired state. For example, the credentials
121+
used to test a resource might be valid for that operation, but not have permissions to actually
122+
modify the system state. Only a resource with this capability can fully report whether and how
123+
the resource will change system state.
124+
- <a id="capability-test" ></a> `Test` - The resource supports validating the desired state of an
110125
instance against the current state of the instance. A resource has this capability when it
111-
defines the [test][15] property in its resource manifest.
126+
defines the [test][17] property in its resource manifest.
112127

113128
If a resource doesn't have the `Test` capability, DSC uses a synthetic test for instances of the
114129
resource. The synthetic test compares each property for the desired state of an instance against
115130
the actual state. The synthetic test uses strict, case-sensitive equivalence. If the desired
116131
state for a property and the actual state aren't the same, DSC marks the property as out of the
117132
desired state.
118-
- <a id="capability-delete" /> `Delete` - The resource supports removing an instance. A resource
133+
- <a id="capability-delete" ></a> `Delete` - The resource supports removing an instance. A resource
119134
has this capability when it defines the [delete][14] property in its resource manifest. This
120135
capability isn't mutually exclusive with the `SetHandlesExist` property. A resource can handle
121-
the `_exist` property in set operations and be called directly with [dsc resource delete][16] to
136+
the `_exist` property in set operations and be called directly with [dsc resource delete][18] to
122137
remove an instance.
123-
- <a id="capability-export" /> `Export` - The resource supports enumerating every instance of the
124-
resource. A resource has this capability when it defines the [export][17] property in its resource
125-
manifest. Only resources with this capability are usable with the [dsc resource export][18] and
126-
[dsc config export][19] commands.
127-
- <a id="capability-resolve" /> `Resolve` - The resource supports resolving nested resource
138+
- <a id="capability-export" ></a> `Export` - The resource supports enumerating every instance of
139+
the resource. A resource has this capability when it defines the [export][19] property in its
140+
resource manifest. Only resources with this capability are usable with the
141+
[dsc resource export][20] and [dsc config export][21] commands.
142+
- <a id="capability-resolve" ></a> `Resolve` - The resource supports resolving nested resource
128143
instances from an external source. A resource has this capability when it defines the
129-
[resolve][20] property in its resource manifest. This functionality is primarily used by
130-
[importer resources][21].
144+
[resolve][22] property in its resource manifest. This functionality is primarily used by
145+
[importer resources][23].
131146

132147
```yaml
133148
Type: array
@@ -215,7 +230,7 @@ Required: true
215230

216231
Represents the values defined in the resource's manifest. This value is `null` for resources that
217232
aren't command-based. For more information on the value for this property, see
218-
[Command-based DSC Resource manifest schema reference][22].
233+
[Command-based DSC Resource manifest schema reference][24].
219234

220235
```yaml
221236
Type: [object, 'null']
@@ -237,11 +252,13 @@ Required: true
237252
[12]: ../../resource/properties/exist.md
238253
[13]: ../../resource/manifest/set.md#handlesexist
239254
[14]: ../../resource/manifest/delete.md
240-
[15]: ../../resource/manifest/test.md
241-
[16]: ../../../cli/resource/delete.md
242-
[17]: ../../resource/manifest/export.md
243-
[18]: ../../../cli/resource/export.md
244-
[19]: ../../../cli/config/export.md
245-
[20]: ../../resource/manifest/resolve.md
246-
[21]: ../../definitions/resourceKind.md#importer-resources
247-
[22]: ../../resource/manifest/root.md
255+
[15]: ../../../cli/config/set.md#-w---what-if
256+
[16]: ../../resource/manifest/whatif.md
257+
[17]: ../../resource/manifest/test.md
258+
[18]: ../../../cli/resource/delete.md
259+
[19]: ../../resource/manifest/export.md
260+
[20]: ../../../cli/resource/export.md
261+
[21]: ../../../cli/config/export.md
262+
[22]: ../../resource/manifest/resolve.md
263+
[23]: ../../definitions/resourceKind.md#importer-resources
264+
[24]: ../../resource/manifest/root.md

0 commit comments

Comments
 (0)