why Cache-tags is different if i am logged? I try to understand how drupal core cache tags is add :

this is my tags on my home when i am logged : 

node:121 node:158 node:23945 node:23946 node:43328 node:491 node:514 node:59139


It's good, this relate my node on my home.

But if i check my home in anonymous, this is what i get :

node:115 node:121 node:153 node:158 node:172 node:18240 node:18244 node:18256 node:23945 node:23946 node:307 node:43328 node:45 node:491 node:514 node:59139 node:59143 node:59144 node:59145 node:59146 node:59147 node:59148 node:59149 node:59193 node:59197 node:59239 node:59269 node:59283 node:59289 node:59293 node:59522 node:59770 node:60375 node:60390 node:60415 node:60418 node:60480 node:60542 node:60606 node:60616 node:60727 node:60785 node:60793 node:60819 node:60824 node:60827 node:60873 node:66011 node:66019 node:66026 node:66028 node:66030 node:66036 node:66039 node:8555 node:8561


And most of this tag is wrong for the home page, how drupal find them ?

I know there is a cache context, but its the core who add this tags

EDIT

After some debug i got some answer :

Context : my menu is render by core block menu in region.

For anonymous user, drupal add the tag node:id for every item in my menu.

if i remove the block, all node:id tag is removed.

So i have 2 solutions :


For all user who hasn't bypass node access permission drupal add every tag from the menu block render.


So i can try to fix the access check on the menu


Remove the drupal core block menu from region and build my own block programmatically and load my menu inside with menu_tree service.


i have try the second point and since its not drupal who render my custom block, tags is not add.

But for me the best way is to find a way for fix the check access.

i can't clear all the node in the cache when someone edit a node in the menu.

For that i want use the tag menu_link_item but not the node:id...
You don't need to render a node to bubble up its cache tag. There are other reasons, for example access checks, which heavily depend on the current user. A negative access check still could bubble up the node cache tag when the result depends on field values. So the tags of not rendered nodes could be unpublished nodes in views or menus. When you publish one of those nodes you want that the page gets refreshed to include the now published node.



Edit

You can replace the core menu block with a custom menu block, see 


  Rendering menus
  
  Once you have created menus (that contain menu links),
  you want to render them. Drupal provides a block
  (Drupal\system\Plugin\Block\SystemMenuBlock) to do so.
  
  However, perhaps you have more advanced needs and you're not satisfied
  with what the menu blocks offer you. If that's the case, you'll want
  to:
  
  ...


https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21menu.api.php/group/menu/8.8.x

By doing so you have the options to not use access checks at all, add your own version of an access check tree manipulator or use the core one and remove the cache tags from the tree access objects afterwards with AccessResult::resetCacheTags