Black rectangles in menu bar that randomly appear I recently purchased a MacBook Air M1 and it runs the latest OS version. I noticed that sometimes there is a black rectangle in the menu bar. I have attached two screen shots. I am now worried if this is a known software bug or if my device has a defect. I have not been able to find the problem on the internet. Should I replace my device? The size of the rectangle is changing in size.
To start with I would boot your Mac into Safe Mode and determine if the rectangles still appear.
Booting into Safe Mode on an M1 Mac
Follow these steps to boot your Mac into Safe Mode:

Fully shut down your Mac
Press the power button to start your Mac, but continue holding it down as your Mac starts up until you see the startup options window:



Select your startup disk, press and hold the shift key and click the Continue in Safe option
Let go of the shift key
Log into your Mac (Note: you may need to do this twice)
Take a note of what happens (i.e. do the rectangles still appear while in Safe Mode?)
Exit Safe Mode by restarting your Mac as normal
Test again to see if the rectangles still appear when booted normally

Once you've followed the above steps, let me know how you went and we'll go from there.