Commit e30ef54
Fix bypass Datastore access in uworker for job definition (#5293)
### Problem
The function `get_value_from_job_definition` in data_handler.py can
cause crashes when executed within a UWORKER (untrusted worker)
environment.
The function originally executed a query against Google Cloud Datastore:
`job = data_types.Job.query(data_types.Job.name == job_type).get()`
Because the UWORKER Docker container uses a restricted IAM Service
Account ( untrusted-worker@... ), it has zero permissions to read from
Datastore. This caused a fatal 403 PermissionDenied exception, crashing
processes like the log upload.
### Fix
When a task runs as a UWORKER, the Trusted Worker (TWORKER) that
scheduled the task has already queried Datastore, extracted all the
Job's environment variables, and injected them directly into the
UWORKER's local environment. Therefore, querying Datastore from the
UWORKER is both forbidden and redundant.
---------
Co-authored-by: Diego Jardon <jardondiego@google.com>1 parent 2a60dd6 commit e30ef54
2 files changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1262 | 1262 | | |
1263 | 1263 | | |
1264 | 1264 | | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
1265 | 1270 | | |
1266 | 1271 | | |
1267 | 1272 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
0 commit comments