Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • ocrfeeder ocrfeeder
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 76
    • Issues 76
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container 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
  • GNOMEGNOME
  • ocrfeederocrfeeder
  • Merge requests
  • !13

Do not invoke commands through shell.

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged RenWal requested to merge RenWal/ocrfeeder:fix-command-injection into master Mar 13, 2022
  • Overview 1
  • Commits 2
  • Pipelines 0
  • Changes 2

Executing shell commands through mechanisms such as os.system() or subprocess.run(shell=True) with user-controllable input is prone to arbitrary shell command injection. In this particular case, a malicious actor controlling any input name, either in PDF or image form, can force ocrfeeder to execute shell commands embedded in the file name. While a workaround for #20 (closed), mentioning problems opening files with special characters, was introduced in 5286120c, this was not applied to every subprocess invocation. Furthermore, it is good practice to make use of the parameterization of arguments available in the subprocess package instead of relying on character escaping alone, avoiding shell invocation completely. This minimizes the attack surface.

Fixes #82

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix-command-injection