Flour has a pretty long shelf life as long as you store the flour in a dry place where it won't get too much moisture.
If you store the flour in a sealed container the flour can last for 10 years or longer.
When my grandma died she had flour that was 20 years old and in sealed containers and it was still very safe to use.
She marked the date on when she stored the flour and it had been in a sealed container at the back of her pantry where she forgot about it.
I took it home to use and although it was not very fresh it was perfectly okay to use the 20 year old flour in some baked goods.
I didn't even notice any difference in taste.
If you leave the flour out in the bags then it may pick up moisture or even bugs and go bad that way.
But flour can last a long time before it does go bad.
I usually use flour within a year or two years at least so I never keep flour for 10 years or longer but flour is usually still good for many years.