The one knockbox that I think is perfect in this regard (the rubber bar not bouncing or slipping out) is the Sage Knockbox, it has a locking mechanism for the knockout bar, very clever as you’d expect from Sage, but also quite a bit more cash.
Features and Benefits
• Small footprint of 12cm across, 12.5cm tall
• Rubber bar, won’t damage your portafilter
• Bar is very easy to remove to clean
• Non-slip base slightly reduces overall volume
• Decent capacity for such a small knockbox
Overall I think if you’re looking for a small, robust & cheap knockout box that will do the job and won’t cost the earth, this is one of the best options.