gorilla/context

Is GetAll safe?

sitepodmatt opened this issue · 1 comments

Disclaimer: newbie to Golang

From my primitive observation on GetAll the mutex only makes it safe on looking up the Request, returning the underlying context for that request essentially makes the map associated with that request freely mutable, thus if callee A is iterating over the map returned by GetAll and callee B is using Set("k","v") then we've in trouble?. Shouldnt there be some form of shallow copy here?

https://github.com/gorilla/context/blob/master/context.go#L54

Feel free to immediately closed this bug, mark as stupid or downvote if Ive missed something fundamental here..

You're entirely correct, there should be a copy of the map made there and in GetAllOk. Definitely an oversight.