Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
fix delete other file bug when container id is .. #1883
Signed-off-by: Lifubang firstname.lastname@example.org
There is a big bug which can delete files not belonging to the container when use runc delete --force.
/opt/runc/runcroot is ruc's root dir.
While dbback dir have very important db backup files.
run two container:
backup a state.json to /opt/runc
When I want to delete ..0, but I typed a wrong word: ..0 -> .. lost a 0
Everything is deleted, include my dbback dir.
This is because there is no strict id validate method in Container Load function in "libcontainer/factory_linux.go", especially when delete.
Please check it, thanks.
Jesus. Yeah, that's a very bad bug.
I'm not a fan of this patch (it looks a bit overly complicated --
However there are more places that this needs to be fixed -- most of
@cyphar Thanks for your reply.
Because utils.CleanPath(".") = "."
So, I said:
@cyphar There are 3 filepath.join in libcontainer/factory_linux.go
You could fix that by doing
My reason for wanting to do it this way is that it makes it clearer that we are making sure that the name doesn't contain any special lexical path tokens. However, since container IDs must match a regular expression that doesn't include
But we do know what type of issue they would be caused by -- having filesystem lexical characters in the name. Another possible attack is having a symlink in the state directory (in which case we'd need to use