Can heterocyclic aromatic ring form N-nitrosamine impurity?
Yes, under the right conditions it can be formed.
Do you mean a pyrrole-type nitrogen, c1cccn1N=O ? These can definitely nitrosate but are not expected to undergo the a-hydroxylation mechanism that leads to concern, since cleavage of the aromatic ring to form the diazonium is very unlikely.
There is an alternative mechanism of mutagenicity/carcinogenicity, reduction via nitroreductases to form the hydroxylamine and thence a nitrenium ion - and comparable adducts to aromatic amines - but I would not expect them to be CoC.
Nitrosated heteroaromatic amines, e.g. c1nccnc1N(C)N=O, are expected to behave similarly to nitrosomethylaniline, and thus need to be treated as CoC.
Here you can find some examples of Nitrosamine drug substance-related impurities (NDSRIs) or other impurities where the tetrazole ring contains a N-nitroso group:
Valsartan Tetrazole nitrosamine impurity
Also in this case, there is any alfa-hydrogen, so they are not expected to undergo the alfa-hydroxylation mechanism. However, we should consider that the tautomerism of tetrazoles may complicate the framework.
Phenothiazine and diphenylamine
Phenothiazine
SMILES: c1ccc2c(c1)Nc3ccccc3S2
Diphenylamine
SMILES: c1ccc(cc1)Nc2ccccc2
Nitrosoirbesartan is free from nitrosation in ordinary.