Skip to content

Handle-Task route protection #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
franzHauptWTD opened this issue Oct 8, 2021 · 1 comment
Closed

Handle-Task route protection #35

franzHauptWTD opened this issue Oct 8, 2021 · 1 comment

Comments

@franzHauptWTD
Copy link

I am wondering why during the IdTokenValidation TaskHandler.php there is no check if the service account listed in the token matches the service account configured via STACKKIT_CLOUD_TASKS_SERVICE_EMAIL.

Without this check it would be possible to invoke the handle service route from a different queue.
Example - Assuming there are 2 cloud run services in 2 different google projects. Service A in project P1 and Service B in project P2.
Service A has the endpoint a-xyz.a.run.app/handle-task
Service B has the endpoint b-xyz.a.run.app/handle-task

Service A configures its STACKKIT_CLOUD_TASKS_HANDLER to point to Service B (b-xyz.a.run.app/handle-task).
Service A has a service account configured via STACKKIT_CLOUD_TASKS_SERVICE_EMAIL which has permission to add the task to its queue.
When the queue wants the task (created by service A) to be executed, the handle-task route from Service B is called. Within Service B the verifyToken will result in a valid google token and therefore the task is executed.

@marickvantuil
Copy link
Member

I'm sorry, but I fail to see if this is a problem. IMO, this can be a valid use case: if the service account can push to another project's queue, then this should be allowed to happen?

Perhaps I misunderstand, in that case let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants