It happens, because then we check permission for task, we check group VIEW permission. For restricted projects anonymous (and non-project members) has permission to VIEW project/group, but hasn't permission to VIEW other pages (inluding tasks).
I think it may be fixed togethwe with general project permissions tool (then we will able to control for restricted project which pages are visible or not)