The vulnerability is a classic path traversal issue within the Gogs application. The root cause is the lack of input sanitization on the ':name' parameter in the URL for editing Git hooks. The functions SettingsGitHooksEdit (for reading hooks via GET) and SettingsGitHooksEditPost (for writing hooks via POST) in the file internal/route/repo/setting.go both used this user-controlled parameter directly when constructing a file path. As shown in the patch commit 4894629903f9508fe85567c44f68804f008f1655, the fix was to introduce a validation function, isValidHookName, which strictly checks if the provided hook name is a valid, expected value before it is used in any file operations. Before this fix, an attacker could supply URL-encoded path traversal sequences (e.g., ..%2f) in the :name parameter to read from or write to arbitrary files on the server, constrained only by the file system permissions of the Gogs process.