GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Codemod: path-traversal-join Semgrep · Issue #685 · pixee/codemodder-python

Codemod: path-traversal-join Semgrep #685

New issue
Copy link
New issue
Copy link
Open
Open
Codemod: path-traversal-join Semgrep#685
Copy link
Labels
new-codemodDescription for a new codemodDescription for a new codemodsemgrep

Description

@clavedeluna
clavedeluna
opened on Jul 1, 2024
Issue body actions

running semgrep on pygoat

 ❯❱ python.django.security.injection.path-traversal.path-traversal-join.path-traversal-join
          Data from request is passed to os.path.join() and to open(). This is a path traversal vulnerability,
          which can lead to sensitive data being leaked. To mitigate, consider using os.path.abspath or       
          os.path.realpath or Path library.                                                                   
          Details: https://sg.run/Dovo                                                                        
                                                                                                              
          916┆ file=request.POST["blog"]
          917┆ try :
          918┆     dirname = os.path.dirname(__file__)
          919┆     filename = os.path.join(dirname, file)
          920┆     file = open(filename,"r")
          921┆     data = file.read()
          922┆     return render(request,"Lab/ssrf/ssrf_lab.html",{"blog":data})
          923┆ except:
          924┆     return render(request, "Lab/ssrf/ssrf_lab.html", {"blog": "No blog found"})
   

I don't believe we currently have a codemod for this pattern, but we could use deterministically try to implement the suggestion semgrep is giving us.

Activity

  1. clavedeluna
    added
    new-codemodDescription for a new codemodDescription for a new codemod
    semgrep
    on Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    new-codemodDescription for a new codemodDescription for a new codemodsemgrep

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.