have something under one’s hat—(coll.) have knowledge of smth.:
- He had something under his hat; a tip-off straight from headquarters, news of high international importance.
keep something under one’s hat—(coll.) keep smth. a secret; keep smth. to oneself:
- “Nothing about that in the papers, is there?” “Not yet. Keep it under your hat.”
See also: pick something out of a hat / pull something out of a hat.