The vulnerability lies in the improper validation of command-line arguments for binaries defined in safeBins. The core of the issue was in the isSafeBinUsage function in src/infra/exec-approvals-allowlist.ts. The initial implementation failed to handle short options with attached values (e.g., -o/tmp/file), allowing a bypass of the security policy that was intended to restrict safe binaries to stdin/stdout operations only.
The first patch (cfe8457a0f4aae5324daec261d3b0aad1461a4bc) directly addresses this by adding a new function, hasBlockedSafeBinOption, and calling it from within isSafeBinUsage to explicitly check for dangerous flags like -o for sort.
A subsequent patch (bafdbb6f112409a65decd3d4e7350fbd637c7754) further refactors this by replacing the logic in isSafeBinUsage with a call to a new, more robust function validateSafeBinArgv. This new function uses a profile-based system to validate arguments and also removes a file-existence check that could be used as an oracle.
The primary vulnerable function is isSafeBinUsage as it contained the flawed logic. The other functions identified are part of the fix and show the evolution of the mitigation.