The ruling legitimizes agreements, widely used by tech companies, that prevent workers from filing lawsuits and are blamed for perpetuating sexual harassment.