I feel like Ted has offered you a legalistic answer. In philosophy, we should look to the ethics, to conscience.
See this post for a selection of discussions about philosophy of work: References regarding pragmatic views of philosophy of worklife
Fundamentally, it depends on your own ethical framework, what behaviour will be consistent with your other beliefs. What is it? What moral guidance, principles, or teachings do you look to, to guide your behaviour?
Aristotle looked to eudaimonia, best translated I think as 'human flourishing'. His picture is that each organism is working towards a state of achieving it's telos, it's inner goal-directed purposes. That means for a human, using your capabilities, serving your community, and probably reproducing if you can and feel you would be a good parent. More here: When is happiness enough? I feel Aristole has a deeper perspective than Darwin, because he is not only considering whether replicators can replicate, but whether they want to, whether they are flourishing - that replication is a natural response to that, which we should seek, and if flourishing is not achieved or achievable, perhaps we would not want to inflict our condition on future people.
Buddhist thought focuses on 'Right Livelihood', as one of the branches of The Eightfold Path, which together are the Fourth Noble Truth, at the core of Buddhist practice. So, the Buddhist concern would be about what companies you work for, and their impacts on the world, in relation to alleviating or causing suffering.
Sartre would focus on whether you are acting in bad faith, on behalf of self-deception and ressentiment. The core of this is whether you are denying your intrinsic freedom to act, and of conscience. If you are truly choosing this work situation, fine. But if you are in it because you feel you have to be, or circumstances pushed you there or forced you to stay, that is denying the ability you have to act in tune with your conscience, and in true knowledge of who you are. Existentialism Is A Humanism is a short very readable work, in which a character considers whether he should go and be a freedom fighter. I highly recommend it in regard to your quandary.
Camus is relevant, especially his work L'Etranger, 'the outsider'. In it he considers as I see it, how the qualities of someone truly liberated to act in alignment with their conscience are not manifested by the acts, but by their willingness to face the consequences of them whatever they are, and however unforeseen. When we truly act in alignment with our conscience, our understanding of who we are, we minimise regret.
It is important I think to consider wisdom, and the wise course of action. Discussed here: Wisdom and John Vervaeke's awakening from the meaning crises? The TLDR of my view is, that wisdom is the strategy of avoiding short-term and contradictory behaviours, and 'about how we apply knowledge, and avoid compulsive behaviour of all kinds, through actions which come from the integrated centre of our concerns', a place we can only come to understand through an active dynamic practice of reflection and renewal of self knowledge. So, what is the wise thing to do, for you?
In The Dhammapada, an ancient collection of sayings of the Buddha at the centre of Buddhist thought, this is verse 6 of the opening section:
"There are those who do not realize that one day we all must die. But
those who do realize this settle their quarrels."
I would advocate considering this in regard to your situation. Life is short. Don't wait until your final moments to recognise that you had deep wishes, or authentic goals, which you did not achieve. You don't have to be just a 'super cog' in someone else's machine, because that's lucrative. You have a remarkable opportunity, income security, and free time. What those humans lucky enough to have that do with the luxury, has defined the past and will define the future of our species. What could you learn? What could you build? How might you improve the lot of the humans that matter to you? Go deep, look inward, Know thyself. And the answer will well up in you, as clear as spring water.