Skip to content

Using YAML.load for the FileDataSource #139

@julik

Description

@julik

Describe the bug

FileDataSource uses YAML.load to load the feature flags file. YAML is quite elaborate, and it can demarshal arbitrary Ruby objects. If the data source is used in production/development, and the feature flag store is compromised, demarshaling of arbitrary objects can be achieved.

To reproduce

Take a look at https://gist.github.com/niklasb/df9dba3097df536820888aeb4de3284 and similar YAML-vector based exploits. Then a YAML file can be crafted that causes arbitrary Ruby objects to get initialised during feature flag loading from the FileDataSource.

Expected behavior
Since JSON is already used in the library source I would also expect it to be used for loading the stored flag data.

SDK version
master from this GH repository.

Language version, developer tools
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.

OS/platform
MRI any

Additional context
Using a richer marshaling format than strictly necessary might not be the best idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions