Filtering out non-mesh attached bones in code

So if I open up a skeleton, I can see that it has bones that are not attached to the mesh (see photo)

When iterating through the bones on the skeleton in code, I would like to ignore these bones, but I cannot see a way to differentiate between them.

In the editor I noticed they have a scale of zero, but when I iterate through all bones, they all have a scale of one so that’s no use.

Is there a way to differentiate?