@@ -203,7 +203,8 @@ def get_image_layer(image_id, headers):
203
203
bytes_range = _parse_bytes_range ()
204
204
repository = toolkit .get_repository ()
205
205
if repository and store .is_private (* repository ):
206
- return toolkit .api_error ('Image not found' , 404 )
206
+ if not toolkit .validate_parent_access (image_id ):
207
+ return toolkit .api_error ('Image not found' , 404 )
207
208
# If no auth token found, either standalone registry or privileged
208
209
# access. In both cases, access is always "public".
209
210
return _get_image_layer (image_id , headers , bytes_range )
@@ -321,7 +322,8 @@ def get_image_json(image_id, headers):
321
322
try :
322
323
repository = toolkit .get_repository ()
323
324
if repository and store .is_private (* repository ):
324
- return toolkit .api_error ('Image not found' , 404 )
325
+ if not toolkit .validate_parent_access (image_id ):
326
+ return toolkit .api_error ('Image not found' , 404 )
325
327
# If no auth token found, either standalone registry or privileged
326
328
# access. In both cases, access is always "public".
327
329
return _get_image_json (image_id , headers )
@@ -448,7 +450,8 @@ def get_image_files(image_id, headers):
448
450
try :
449
451
repository = toolkit .get_repository ()
450
452
if repository and store .is_private (* repository ):
451
- return toolkit .api_error ('Image not found' , 404 )
453
+ if not toolkit .validate_parent_access (image_id ):
454
+ return toolkit .api_error ('Image not found' , 404 )
452
455
# If no auth token found, either standalone registry or privileged
453
456
# access. In both cases, access is always "public".
454
457
data = layers .get_image_files_json (image_id )
@@ -469,7 +472,8 @@ def get_image_diff(image_id, headers):
469
472
return toolkit .api_error ('Diff queue is disabled' , 400 )
470
473
repository = toolkit .get_repository ()
471
474
if repository and store .is_private (* repository ):
472
- return toolkit .api_error ('Image not found' , 404 )
475
+ if not toolkit .validate_parent_access (image_id ):
476
+ return toolkit .api_error ('Image not found' , 404 )
473
477
474
478
# first try the cache
475
479
diff_json = layers .get_image_diff_cache (image_id )
0 commit comments