Councils warned over spying laws