up
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled

This commit is contained in:
StellaOps Bot
2025-12-01 21:16:22 +02:00
parent c11d87d252
commit 909d9b6220
208 changed files with 860954 additions and 832 deletions

View File

@@ -0,0 +1,36 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int run_guarded(const char *user_cmd)
{
const char *allow = getenv("ALLOW_CMD");
if (allow == NULL || strcmp(allow, "1") != 0)
{
puts("command blocked (ALLOW_CMD not set)");
return 0;
}
char cmd[256];
snprintf(cmd, sizeof(cmd), "echo START && %s && echo END", user_cmd);
return system(cmd);
}
int main(int argc, char **argv)
{
if (argc < 2)
{
fprintf(stderr, "usage: %s <command>\n", argv[0]);
return 1;
}
int rc = run_guarded(argv[1]);
if (rc != 0)
{
fprintf(stderr, "command failed\n");
return 2;
}
puts("done");
return 0;
}