-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementations that produce `YAML-1.2` in compatible mode still can end up producing YAML that will be icnorrectly parsed by CloudFormation. For example, literal strings containing only numbers and starting with a `0` do not get quoted, which results in a `YAML-1.1` parser interpreting those as a number. This can lead to invalid principals being generated where the account ID form is used (for example, in Lambda permissions objects). Switching to `yaml@1.0.0` addresses this as it can be configured to emit `YAML-1.1` explicitly.
- Loading branch information
1 parent
ae03ddb
commit 0b132b5
Showing
7 changed files
with
53 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Test } from 'nodeunit'; | ||
import YAML = require('yaml'); | ||
|
||
export = { | ||
'validate that our YAML quotes the word "ON"'(test: Test) { | ||
// tslint:disable-next-line:no-console | ||
const output = YAML.stringify({ | ||
notABoolean: "ON" | ||
}, { schema: 'yaml-1.1' }); | ||
|
||
test.equals(output.trim(), 'notABoolean: "ON"'); | ||
|
||
test.done(); | ||
}, | ||
|
||
'validate that our YAML correctly quotes strings with a leading zero'(test: Test) { | ||
const output = YAML.stringify({ | ||
leadingZero: "0123456789" | ||
} , { schema: 'yaml-1.1' }); | ||
|
||
test.equals(output.trim(), 'leadingZero: "0123456789"'); | ||
|
||
test.done(); | ||
}, | ||
|
||
'validate that our YAML correctly parses strings with a leading zero'(test: Test) { | ||
const output = YAML.parse('leadingZero: "0123456789"', { schema: 'yaml-1.1' }); | ||
|
||
test.deepEqual(output, { leadingZero: '0123456789' }); | ||
|
||
test.done(); | ||
}, | ||
}; |