Narrow a source to the calls it needs

A source that shows Writes are allowed on every path lets any of its keys create, change, and delete anything the upstream account can. This guide replaces that with the calls your integrations and agents make, without breaking them along the way.

You need to be an owner or admin. The reference is Policy.

1. Start from what callers already do

  1. Open Sources → your source → Access and scroll to Policy.
  2. Click Suggest from traffic. swarmvia reads the last 7 days of logs and lists the calls it saw: reads as one rule, and each path that was written to as its own.
  3. Uncheck anything you do not recognize or do not want.
  4. Click Replace the list with these.

Numbers and long IDs show as *. If a path has a short ID that was not caught, edit the rule and replace that segment with * yourself.

2. Add what the log could not see

The log only holds what ran in the last 7 days. Add a rule for anything that runs less often: a month-end job, a yearly export, a manual fix.

3. Move writes to the people who need them

Every key on the source gets what is in the default source policy. For each write rule, ask whether every caller needs it.

  1. If only some do, click Edit on the Access tab, add a group policy for their group under Group policies, and move the rule there.
  2. Remove the rule from the default policy.

Aim for a default of GET HEAD OPTIONS /**, with each write held by the group that uses it. An integration or an agent can then be limited further, to chosen calls, when you create its API token or connect it.

4. Save in small steps

A policy applies as soon as you save it: a call that is not on the list returns 403 before it reaches your origin.

{
  "error": "forbidden",
  "message": "this source's policy does not allow DELETE /v1/orders/42"
}

So narrow one step at a time, at a time you can watch. For example, save the suggested rules with their writes still in the default first, and move each write to its group in a later save. Do it on a quiet day, not just before a month-end run.

5. Read what was denied

Click See refused calls under the policy on the Access tab, which opens Logs filtered to Denied by policy.

For each one, decide:

  • It is legitimate. Add a rule for it, to the group that makes the call or to the default if every caller does. Keys already issued pick it up within about a minute.
  • It should not happen. Leave it off. The Key column shows which key made the call, so you can find the caller.

Check it again after your scheduled jobs have run, and now and then after that. A new entry is either a caller that needs a rule or one doing something it should not.

Related