Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more secure methods #3291

Merged
merged 2 commits into from
Mar 12, 2021
Merged

Use more secure methods #3291

merged 2 commits into from
Mar 12, 2021

Commits on Mar 12, 2021

  1. storage_local: Use File.open instead of Kernel.open

    * https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Security/Open
    
    ```
    `Kernel#open` and `URI.open` enable not only file access but also process invocation
    by prefixing a pipe symbol (e.g., `open(“| ls”)`).
    So, it may lead to a serious security risk by using variable input
    to the argument of `Kernel#open` and `URI.open`.
    It would be better to use `File.open`, `IO.popen` or `URI.parse#open` explicitly.
    ```
    
    Signed-off-by: Hiroshi Hatake <hatake@clear-code.com>
    cosmo0920 committed Mar 12, 2021
    Configuration menu
    Copy the full SHA
    66d4af4 View commit details
    Browse the repository at this point in the history
  2. config: types: Use JSON.parse instead of JSON.load

    * https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Security/JSONLoad
    
    ```
    Autocorrect is disabled by default because it's potentially dangerous.
    If using a stream, like `JSON.load(open('file'))`, it will need to call `#read` manually,
    like `JSON.parse(open('file').read)`.
    If reading single values (rather than proper JSON objects), like `JSON.load('false')`,
    it will need to pass the `quirks_mode: true` option, like `JSON.parse('false', quirks_mode: true)`.
    Other similar issues may apply.
    ```
    
    Signed-off-by: Hiroshi Hatake <hatake@clear-code.com>
    cosmo0920 committed Mar 12, 2021
    Configuration menu
    Copy the full SHA
    77d79e9 View commit details
    Browse the repository at this point in the history