Skip to content

Commit

Permalink
Add check to protect against accidental version downgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Nov 14, 2018
1 parent 5dedb79 commit 27f008b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vault/logical_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func systemBackendMemDBSchema() *memdb.DBSchema {
return systemSchema
}

// NewSystemBackend makes a new sys backend
func NewSystemBackend(core *Core, logger log.Logger) *SystemBackend {
db, _ := memdb.NewMemDB(systemBackendMemDBSchema())

Expand Down Expand Up @@ -1342,6 +1343,16 @@ func (b *SystemBackend) handleTuneWriteCommon(ctx context.Context, path string,
resp = &logical.Response{}
resp.AddWarning(fmt.Sprintf("Upgrading mount from version %d to version %d. This mount will be unavailable for a brief period and will resume service shortly.", meVersion, optVersion))
}
} else {
// if version is not included in the
// options, and is present in the current
// mountEntry's options, copy it's value
// to the new options map to protect
// against accidental version downgrades
if vers, ok := mountEntry.Options["version"]; ok {
options["version"] = vers
numBuiltIn++
}
}
if options != nil {
// For anything we don't recognize and provide special handling,
Expand Down

0 comments on commit 27f008b

Please sign in to comment.