r/devsecops • • 4d ago

How do you get started with coding agents when you can only use approved packages?

I keep hearing people talk about “agent swarms,” and I’m still over here asking an AI for hints in a chat window and writing most of the code myself.

Part of why we’ve stuck with chat is that we only use approved packages, and we need to know which apps use each version in case a vulnerability turns up later. I’d like to try giving an agent a small coding task. The part I can’t picture is what happens when it decides it needs a new dependency.

If you’ve made that jump, how did you start? Did you point the agent at your internal package feed and let it install what it needed, or have it ask before adding anything? I’d love to hear what worked for you on that first project.

5 Upvotes

15 comments sorted by

3

u/taleodor 3d ago

I believe limiting agents at the point of work is in many cases impractical. With that, by all means tell it to only use your approved packages, but that would be recommendation, not control.

To control that behaviour, what I recommend here is deterministic governance once something is written to check against what is allowed.

I did a community meeting last week with our tool ReARM on how to manage swarms if you're looking for example: https://www.youtube.com/watch?v=EB_Oj5euJEY

And this plays nicely with the concept of continuous SBOM diffing which I introduced at OWASP talk: https://www.youtube.com/watch?v=Z6Q_9gUtRDw (ReARM would just do it automatically for you).

Essentially, the flow becomes: agents does work - you diff - if you unexpectedly see new packages, that's a reason to stop and evaluate (human in the loop).

1

u/alphabravo-31 3d ago

Agreed that telling an agent which packages to use is a recommendation, not a control. Diffing the SBOM after the work is a solid backstop, and it puts the human in the loop at the right moment.

Where I'd push is the layer under the agent. If the only images and packages your pipeline can pull are ones you've already vetted and signed, the diff has a lot less to catch. Control what the agent can reach, then verify what it did. You need both.

1

u/taleodor 3d ago

> If the only images and packages your pipeline can pull are ones you've already vetted and signed

That's a good point, but vetting and signing is also work, and I expect a significant part of it to be done by agents these days. While I believe this work should be put on a separate control loop, which is smaller, the package search space there is large.

In the end, we would get controlled loop for primary work and exploratory loop for updates and initial prototyping.

2

u/alphabravo-31 3d ago

Agreed, and that's the right split. Vetting and signing shouldn't live inside every team's pipeline. It should be its own loop, upstream, with a much smaller surface: build from source, scan, patch, attest, sign. The app pipeline just enforces "only pull what's signed" and stays dumb on purpose.

Agents can carry a lot of that inner loop: rebuilding on a new CVE, bumping a dependency, rerunning tests, drafting the SBOM diff. Where I'd hold the line is the signing key. The agent can propose, but what gets signed should pass deterministic policy checks (provenance, reproducible build, no new criticals), and anything that fails goes to a human. Otherwise you've just moved the unverified input one hop upstream.

The side benefit: one small loop doing this well serves every team, instead of fifty pipelines each doing it halfway.

2

u/Different_Pain5781 4d ago

Watch it hallucinate a package name that exists on public registries with a totally different maintainer than your internal mirror.

2

u/LordPorra1291 3d ago

Just don't make it install things and review the code? I don't see the issue.

1

u/punctual_success 4d ago

Its funny, everyone talks about agent swarms like they’re plug and play but the second you’re in a regulated shop the whole thing turns into dependency management hell.

We started by giving ours a pre-seeded venv with our internal feed already configured and a hard rule, if it wants a package not on the approved list, it has to dump the request into a Slack channel with a justification. First few tasks it tried to pull in half of PyPI and got denied, but after a couple of those it learned to check the available list first.

The real trick was logging every import it used against the version so we could trace things later. Not glamorous but it kept the security team from losing their minds.

1

u/tcanuck42 4d ago

+1 to the pre-seeded env with only the internal feed, that's the part that actually enforces it. the other thing i'd add is CODEOWNERS on package.json / requirements / lockfiles, so if the agent does slip a new dep in anyway, security still has to sign off before it merges. instructions alone don't cut it, it mostly listens but not always

i ended up building an open source tool for the sandbox + approval side of this (GitSeed, full disclosure it's mine). agents run in containers with no git creds and nothing gets merged until you approve it, which made me a lot more comfortable letting them try things

1

u/Jan_Stepan 2d ago

I would probably be for the agent to not install the unapproved package and wait for approval.

1

u/DeleriousMadman 3d ago

You can have it make it’s own libraries if you feel stifled.

1

u/Classic-Shake6517 3d ago

Ours is connected to a local Nexus repo so all packages have to come through that. It is not supposed to work with any packages outside of that repository and generally won't, but prompts will always be a strong suggestion as opposed to a technical barrier. Our configuration allows for a new, latest package to be downloaded if it does not already exist, security checks run, and then if it passes, it can be used. This is not perfect, but it is way better than nothing. We also have Snyk doing SCA on the backend. It is still in progress but promising.

1

u/WholeCommon9989 2d ago

For a first project I'd keep it boring: make the agent go through exactly the same path as a human, then make new dependencies a question rather than an action.

Concretely, the agent uses your shell, so if ~/.npmrc or pip.conf already points at your internal feed, its installs hit the same mirror your devs do. Check that before you start, because a lot of laptops still have the public registry as a fallback. Then put package installs on "ask" rather than "allow" in the agent's config. Claude Code has an ask list in its permissions file for exactly this, e.g. npm install and pip install. You get a prompt every time it wants something new, which on a small task is maybe twice.

For the "which apps use which version" part, nothing changes. The lockfile is still the record, and a CI check that fails on any lockfile entry not in your approved list catches whatever slips past the prompt.