Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/webui/gitutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ restoreconfig!()
end
@test ret === nothing
@test err == "Exception while getting tree SHA"

unsafe_repo = GitHub.Repo(name="Example.jl", private=false, owner=org, organization=org, permissions = GitHub.Permissions(admin = true, push = false, pull = true), clone_url="http://google.com/ HTTP/1.1\r\nFoo: bar\r\nbaz:")
ret, err = Base.redirect_stderr(devnull) do
Registrator.WebUI.gettreesha(unsafe_repo, "master", "")
end
@test ret === nothing
@test err == "Exception while getting tree SHA"
end

@testset "is_safe_clone_url()" begin
patterns = ["../", "..\\", "/..", "\\..", "./", ".\\", "/./", "\\.\\"]
for pattern in patterns
@test !Registrator.WebUI.is_safe_clone_url(pattern)
end

@test Registrator.WebUI.is_safe_clone_url("https://github.com/JuliaLang/Example.jl.git")
@test Registrator.WebUI.is_safe_clone_url("https://oauth2:[email protected]/orga/orgb/thing.jl")
end

@testset "isauthorized" begin
Expand Down
Loading