For a group $G$, let $\operatorname{Aut}(G)$ denote the group of all automorphisms of $G$ and $\operatorname{Inn}(G)$ denote the subgroup of all autmorphisms which is of the form $f_h(g)=hgh^{-1}, \forall g\in G$, where $h\in G$ . Now if $G_1$ is a group containing $G$ as a subgroup then every $f_h \in \operatorname{Inn}(G)$ extends to an inner automorphism of $G'$ as $f_h(x)=hxh^{-1},\forall x\in G_1$, so in other words, for every $f\in \operatorname{Inn} (G)$ and every group $G_1$ containing $G$ as a subgroup, $\exists \bar f\in \operatorname{Inn}(G_1) \subseteq \operatorname{Aut} (G_1)$ such that $\bar f|_G =f$.
Now my question is : Let $f \in \operatorname{Aut} (G)$ be such that for every group $G_1$ containing $G$ as a subgroup, $\exists \bar f\in \operatorname{Aut}(G_1)$ such that $\bar f|_G =f$. Then is it necessarily true that $f \in \operatorname{Inn}(G)$ ? If this is not true in general, then does some extra condition on $G$ makes it true (like $G$ being finite, or simple)?