File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -156,9 +156,14 @@ async def github_webhook(request: web.Request):
156
156
delivery , ref , expected_branch )
157
157
return web .Response (status = 200 )
158
158
159
- checkout = Path (os .environ .get ('SITE_DIR' , 'sites' ), repository )
159
+ site_dir = Path (os .environ .get ('SITE_DIR' , 'sites' ))
160
+ checkout = (site_dir / repository ).resolve ()
161
+ if not checkout .is_relative_to (site_dir ):
162
+ raise web .HTTPBadRequest (
163
+ reason = (f'{ delivery } : Checkout for { organization } /{ repository } '
164
+ 'does not exist' ))
160
165
if not (checkout / '.git' ).is_dir ():
161
- raise web .HTTPInternalServerError (
166
+ raise web .HTTPBadRequest (
162
167
reason = (f'{ delivery } : Checkout for { organization } /{ repository } '
163
168
'does not exist' ))
164
169
task = asyncio .create_task (
You can’t perform that action at this time.
0 commit comments