Skip to content

Commit 1c6fd6a

Browse files
authored
fix: Restrict YAML 1.1 boolean strings to their explicit capitalization (#530)
1 parent 4aa56d3 commit 1c6fd6a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: src/schema/yaml-1.1/bool.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const falseTag: ScalarTag & { test: RegExp } = {
2121
identify: value => value === false,
2222
default: true,
2323
tag: 'tag:yaml.org,2002:bool',
24-
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
24+
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
2525
resolve: () => new Scalar(false),
2626
stringify: boolStringify
2727
}

Diff for: tests/doc/stringify.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ describe('scalar styles', () => {
633633

634634
test('bool Scalar styles on YAML1.1', () => {
635635
const doc = YAML.parseDocument(
636-
'[ n, N, NO, no, No, False, false, FALSE, Off, off, OFF, y, Y, Yes, yes, YES, true, True, TRUE, ON, on, On ]',
636+
'[ n, N, NO, no, No, False, false, FALSE, FALse, Off, off, OFF, OfF, y, Y, Yes, yes, YES, true, True, TRUE, ON, on, On ]',
637637
{ schema: 'yaml-1.1' }
638638
)
639639
const str = `[
@@ -645,9 +645,11 @@ describe('scalar styles', () => {
645645
False,
646646
false,
647647
FALSE,
648+
FALse,
648649
Off,
649650
off,
650651
OFF,
652+
OfF,
651653
y,
652654
Y,
653655
Yes,
@@ -670,9 +672,11 @@ describe('scalar styles', () => {
670672
false,
671673
false,
672674
false,
675+
'FALse',
673676
false,
674677
false,
675678
false,
679+
'OfF',
676680
true,
677681
true,
678682
true,

0 commit comments

Comments
 (0)