Welding, pinned and welded or silver soldered are the three authorized methods for attachment. I recently looked this up and there was a thread on it I think on this board or on the Rifle, Uppers, Lowers. Or just drill down through the BATF website, that's where I found it it some pamplet they publish, and IIRC it was in chapter 2.
From ATF Pub 5320-8:
The ATF procedure for measuring barrel length is to measure from the closed bolt (or breech-face) to
the furthermost end of the barrel or permanently attached muzzle device. Permanent methods of
attachment include full-fusion gas or electric steel-seam welding, high-temperature (1100°F) silver
soldering, or blind pinning with the pin head welded over. Barrels are measured by inserting a dowel rod
into the barrel until the rod stops against the bolt or breech-face. The rod is then marked at the
furthermost end of the barrel or permanently attached muzzle device, withdrawn from the barrel, and