Remove "Generator" meta tag?
Basing on the patch provided in Remove Generator META tag &amp; X-Generator for Drupal 8 version! this is the code that would achieve that.
/**
 * Implements hook_page_attachments_alter().
 */
function HOOK_page_attachments_alter(array &amp;$attachments) {
  foreach ($attachments['#attached']['html_head'] as $key =&gt; $attachment) {
    if ($attachment[1] == 'system_meta_generator') {
      unset($attachments['#attached']['html_head'][$key]);
    }
  }
}