You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(java,csharp): personal access token name is not escaped in the HTTP delete path #4672
Expected: any valid token name goes out as one path segment, so the DELETE removes the token with that name.
Actual: the URL library normalizes the path, so some names hit another URL:
name
request sent
../users/42
DELETE /users/42
a/b
DELETE /personal-access-tokens/a/b (not found)
a?b=c
DELETE /personal-access-tokens/a?b=c, which deletes token a
The caller acts as themselves, so this is not a privilege problem. It deletes the wrong token or hits the wrong endpoint.
The Rust SDK had the same bug and is fixed in #4628 (encode_segment). The C++ and Python SDKs wrap the Rust SDK, so they get that fix. Java and C# have their own HTTP code and need their own.
. and .. need extra care. An encoded %2E%2E is still resolved as a dot segment by the URL parser (checked with Rust's url crate: .. sends DELETE /), so they should be rejected before sending. The server only checks the name length, so a token named .. can be created over TCP but not deleted over HTTP.
Call deletePersonalAccessToken / DeletePersonalAccessTokenAsync with ../users/42.
The request goes to DELETE /users/42 instead of the token route.
Checked so far: Rust (url crate) and C# (System.Uri) give the table above. For Java I only checked java.net.URI.normalize(), not the real HTTP client. I have not run a live delete against a server.
Contribution
I'm willing to submit a pull request to fix this bug
Activity