Skip to content

Commit

Permalink
database is attached to the container identity
Browse files Browse the repository at this point in the history
  • Loading branch information
frankcorneliusmartin committed Nov 16, 2022
1 parent 1046f4f commit e16192e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vantage6-server/vantage6/server/model/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Task(Base):
A task can assigned in the Result for multiple organizations. The input
of the task is different for each organization (due to the encryption).
Therefore the input for the task is encrypted for each organization
seperately. The task originates from an organization to which the results
separately. The task originates from an organization to which the results
need to be encrypted, therefore the originating organization is also logged
"""

Expand Down
8 changes: 5 additions & 3 deletions vantage6-server/vantage6/server/resource/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def post(self):

task_id = data.get("task_id")
claim_image = data.get("image")

db_task = db.Task.get(task_id)
if not db_task:
log.warning(f"Node {g.node.id} attempts to generate key for task "
Expand All @@ -260,7 +261,7 @@ def post(self):
# verify that task the token is requested for exists
if claim_image != db_task.image:
log.warning(
f"Node {g.node.id} attemts to generate key for image "
f"Node {g.node.id} attempts to generate key for image "
f"{claim_image} that does not belong to task {task_id}."
)
return {"msg": "Image and task do no match"}, \
Expand All @@ -270,7 +271,7 @@ def post(self):
# enlisted
if g.node.collaboration_id != db_task.collaboration_id:
log.warning(
f"Node {g.node.id} attemts to generate key for task {task_id} "
f"Node {g.node.id} attempts to generate key for task {task_id} "
f"which is outside its collaboration "
f"({g.node.collaboration_id}/{db_task.collaboration_id})."
)
Expand All @@ -291,7 +292,8 @@ def post(self):
"organization_id": g.node.organization_id,
"collaboration_id": g.node.collaboration_id,
"task_id": task_id,
"image": claim_image
"image": claim_image,
"database": db_task.database
}
token = create_access_token(container, expires_delta=False)

Expand Down

0 comments on commit e16192e

Please sign in to comment.