Skip to content

Forum

AI Assistant
Notifications
Clear all

Check out what I made: a plugin that whitelists allowed commands for Goose (Block)

3 Posts
3 Users
0 Reactions
3 Views
(@sec_ops_dave)
Eminent Member
Joined: 1 week ago
Posts: 19
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#967]

Been running Goose in my homelab for a few months now and really like it, but one thing kept nagging at me: the command execution. By default, it can run pretty much anything the underlying host can. That's fine for a toy, but for anything serious—especially if you're thinking about using agent runtimes in a corporate environment—you need a way to lock it down.

I built a simple plugin for Goose that does just that: command whitelisting. It sits between the agent's intent and the actual execution, checking every requested command against a defined list of allowed commands and arguments. If it's not on the list, the command gets blocked.

Here's the core of it—a `policy.yaml` file that defines what's allowed:

```yaml
allowed_commands:
- command: git
allowed_args:
- clone
- pull
- status
- log
- command: docker
allowed_args:
- ps
- logs
- --tail
- command: npm
allowed_args:
- install
- run
strict_args: true
```

The plugin loads this policy. The `strict_args: true` for `npm` means it *only* allows `npm install` and `npm run` with no additional flags, which is useful for tightening down further.

The integration point is simple. You just modify the Goose config to pipe commands through the plugin's checker before they hit the shell. It logs blocked attempts with the full context, which is great for auditing.

I've found this approach gives me the flexibility to let Goose do useful tasks—like managing containers or pulling repo updates—without sweating that it'll decide to `rm -rf` something or curl a strange script from the internet. It's a step towards making these tools viable for more secure setups.

The code's still rough around the edges, but it's working. If anyone's interested in testing it or has ideas for more granular policies (maybe user-based or environment-based rules), let me know. I'm thinking of adding regex patterns for arguments next.

-- Dave


Segregate or die.


   
Quote
(@newbie_jen)
Active Member
Joined: 1 week ago
Posts: 12
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Oh this is really neat. That strict_args flag is a clever way to tighten things up even more.

I've been meaning to try Goose but that exact permission thing was holding me back. A plugin like this makes it feel way safer to experiment with.

So, does it just block the command silently or does it tell the agent "hey, that's not allowed"?



   
ReplyQuote
(@supply_chain_grace)
Eminent Member
Joined: 1 week ago
Posts: 21
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Interesting approach. The policy-as-YAML is a clean abstraction. Have you considered signing the policy file itself? In a runtime environment, an attacker who can modify that YAML has effectively bypassed your control layer.

You could use something like Sigstore's `cosign` to sign the artifact, with the plugin verifying the signature against a public key baked into its image. This adds a step, but it closes the loop on policy integrity.

Also, does the plugin generate any form of attestation or SBOM for the commands it *does* allow? That would be valuable for later audit.


trust but verify the hash


   
ReplyQuote