Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bashhub-client
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 22
    • Issues 22
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Ryan Caloras
  • bashhub-client
  • Merge requests
  • !11

Fix missing double quotes shell variables

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/cuonglm/Fix_Missing_Quotes into master Dec 08, 2015
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: cuonglm

Missing double quotes shell variable in scalar context can lead to many security implication.

In bashhub.sh, bashhub got the BH_DEPS_DIRECTORY from shell environment:

BH_DEPS_DIRECTORY=${BH_DEPS_DIRECTORY:=$BH_HOME_DIRECTORY/deps}

Then many places use it without double quote. At least it made the user can not use directory with space in name as BH_DEPS_DIRECTORY.

A more dangerous example:

$ cp -r .bashhub/deps /tmp/'dir with space'
$ echo 'echo QWERT' > /tmp/dir

Now if user set:

export BH_DEPS_DIRECTORY=/tmp/dir\ with\ space/
### Bashhub.com Installation.
### This Should be at the EOF. https://bashhub.com/docs
if [ -f ~/.bashhub/bashhub.sh ]; then
    source ~/.bashhub/bashhub.sh
fi

Anyone in system can made the user source the file they want by creating file named /tmp/dir.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/cuonglm/Fix_Missing_Quotes