Skip to content

Commit 0dec4a0

Browse files
authored
Merge pull request #1829 from felixfontein/remove-reserved-check-in-store
Remove reserved keyword check from YAML store's `LoadPlainFile()`
2 parents 9797277 + 6d4c218 commit 0dec4a0

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

stores/yaml/store.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,6 @@ func (store *Store) LoadPlainFile(in []byte) (sops.TreeBranches, error) {
329329
if err != nil {
330330
return nil, fmt.Errorf("Error unmarshaling input YAML: %s", err)
331331
}
332-
// Prevent use of reserved keywords
333-
for _, item := range branch {
334-
if item.Key == stores.SopsMetadataKey {
335-
return nil, fmt.Errorf("YAML doc used reserved word '%v'", item.Key)
336-
}
337-
}
338332
branches = append(branches, branch)
339333
}
340334
return branches, nil

stores/yaml/store_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,3 @@ rootunique:
418418
assert.Equal(t, `yaml: unmarshal errors:
419419
line 3: mapping key "hello" already defined at line 2`, err.Error())
420420
}
421-
422-
func TestReservedAttributes(t *testing.T) {
423-
data := `
424-
hello: Sops config file
425-
sops: The attribute 'sops' must be rejected, otherwise the file cannot be opened later on
426-
`
427-
s := new(Store)
428-
_, err := s.LoadPlainFile([]byte(data))
429-
assert.NotNil(t, err)
430-
assert.Equal(t, `YAML doc used reserved word 'sops'`, err.Error())
431-
}

0 commit comments

Comments
 (0)