A new rule gives California lawyers ethical cover to advise cannabis clients, which engage in activities that are legal in California but conflict with federal law.

But new Rule 1.2.1, which the state supreme court approved Sept. 26, isn’t a shield against federal law enforcement, attorneys who work on cannabis issues told Bloomberg Law.

The “nightmare is that the Department of Justice assistant U.S. attorneys bring charges against a lawyer as a co-conspirator in the production, distribution, processing of...