The risk comes from claims by contract workers that this is proof they are part of the staff of the principal employer (PE) and that there is no distinction between them and direct permanent employees.
However, that cannot be the main argument in a court or investigation. If there is no other evidence, then just a Diwali gift with a name and logo is not evidence of a direct relationship between PE and contract workers. However, it can be 'collaborative' evidence if there is other evidence of such a direct relationship.
Further, I do not think that the boxes are given only to workers. So, keep evidence that it is distributed to all: employees, clients, customers, support services, vendors, security staff, etc. That will be a good idea.