I don't doubt that our current body of legislation and judicial precedents make this practice legal, but I honestly can't see this policy actually doing anything.
The classic case of illegal electronic information would be child pornography - but who would be stupid enough to bring it with them to the border for consumption or for trafficking, when the Internet exists? If they were to bring it to the border, what's to stop them from encrypting it not divulging the key?
Beyond C.P., I can imagine certain trade secrets being illegal, like Samuel Slater back in the day. But that was to the benefit of America, and the British were right to suspect him due to his position giving him the capability to leak information that was held secret by state laws. American analogues obviously enforce the unwanted disclosure of state secrets and such based on identities and institutions prior to crossing the border - which makes what the CBP are doing redundant at best.
Terrorists do not need anything outside of this country to operate. We've seen domestic and foreign terrorists alike build their bombs with legal sources of information and material.
IMO, what happened was a power hungry busy body official in the CBP spearheaded this policy. Just another case of crappy people in crappy politics, making crappy solutions to nonexistent problems. It is fortunate that the rest of humanity will be reasonable enough to revert such egregious and useless wastes of resources.