Coder Social home page Coder Social logo

Comments (7)

erikdubbelboer avatar erikdubbelboer commented on June 11, 2024

Can you make a pull request including a test that fails before and passes after your change?

from fasthttp.

egovorukhin avatar egovorukhin commented on June 11, 2024

#1698 - created pull request.

How do you think about changing the function (normalizePath) more? Please check the changes

from fasthttp.

gaby avatar gaby commented on June 11, 2024

@egovorukhin @erikdubbelboer This was supposed to be reported using the process here: https://github.com/valyala/fasthttp/security

This could qualify for a CVE, and it was reported improperly.

from fasthttp.

erikdubbelboer avatar erikdubbelboer commented on June 11, 2024

I think we should just disable FS on windows. It's not safe, it's not properly tested and nobody should be using it in production.

from fasthttp.

egovorukhin avatar egovorukhin commented on June 11, 2024

Let's replace backslash with slash when used in windows, then a check for "path traversal" will occur. What do you think about this?

file - uri.go
func - normalizePath

if filepath.Separator == '\\' {
	dst = replaceSlashes(dst)
}

https://github.com/egovorukhin/fasthttp/blob/4d48887eb813b0f1caac0217751888897f601d50/uri.go#L579

file - uri_windows.go

func replaceSlashes(dst []byte) []byte {
	for i := range dst {
		if dst[i] == '\\' {
			dst[i] = '/'
		}
	}
	return dst
}

https://github.com/egovorukhin/fasthttp/blob/4d48887eb813b0f1caac0217751888897f601d50/uri_windows.go#L13

from fasthttp.

erikdubbelboer avatar erikdubbelboer commented on June 11, 2024

I don't think that will fix it. How about we just reject all requests with .. on windows?

from fasthttp.

egovorukhin avatar egovorukhin commented on June 11, 2024

Ok, let's do this. Do you have a solution?

from fasthttp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.