Urgent.News

What's breaking now, across thousands of outlets.

Tech

Put the Workspace Check Inside the Database Write

A record can belong to workspace Alpha when you check it and workspace Beta when you update it. If the UPDATE filters only by record ID, the earlier check no longer protects the write. In the comments on the previous MCP permissions example , arun pointed out this database boundary . That example used an in-memory map. Moving the handler to a database needs one more decision: which rows is the…

SQLite offers a way to enforce workspace boundaries in database operations. When a record can belong to different workspaces, checking the workspace at the time of update is crucial to prevent unintended writes. The provided example demonstrates this using SQLite and Python.

A sequence of steps shows a record being transferred from one workspace to another, then updated. The update statement lacks a condition to check the workspace, leading to the update of the record in the new workspace. By adding a workspace_id condition to the UPDATE statement, the code ensures that only rows from the correct workspace are updated.

The provided code defines a function to safely update the interval of automations, taking into account the principal's workspace_id and the validation of the interval. The function uses SQLite's RETURNING clause to fetch the updated row and checks if a row was actually updated. The tests confirm that the workspace is correctly enforced in the mutation.

This approach allows for a more secure and accurate database operation, ensuring that updates are made only to the correct workspace's records.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

GhostGuard — The Ghost That Stands Between Your Agent and Its Actions

Final submission for the Hacktoberfest Open-Source AI Challenge: Ghost in the Machine. This challenge ended on Día de los Muertos, the days when the living set candles for the dead and ask them for…

  • GhostGuard is an open-source AI project
  • Protects users from AI agents' harmful actions
  • Inspired by fake-recruiter security breach

Too big, it explodes. Too small, it crawls.

The learning rate, step by step: why one number decides whether training works at all. Backpropagation tells every weight which way to move: its gradient. It doesn't say how far.

  • Learning rate determines step size in gradient descent
  • Practitioner sets learning rate as first hyperparameter
  • Optimal learning rate 0.5 for given example loss function

More from Sunday 1 November →