Skip to content

Commit 4a0f9b8

Browse files
committed
first commit
0 parents  commit 4a0f9b8

28 files changed

+849
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: Bug report
3+
about: Report a problem
4+
title: "[Bug] "
5+
labels: bug
6+
---
7+
8+
**Describe the bug**
9+
**Repro steps**
10+
**Expected behavior**
11+
**Additional context**
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Feature request
3+
about: Propose an enhancement
4+
title: "[Feat] "
5+
labels: enhancement
6+
---
7+
8+
**Problem**
9+
**Proposed solution**
10+
**Security patterns applied**

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Summary
2+
-
3+
4+
## Patterns used
5+
- [ ] action-selector
6+
- [ ] plan-then-execute
7+
- [ ] dual-llm
8+
- [ ] map-reduce
9+
- [ ] code-then-execute
10+
- [ ] context-minimization
11+
12+
## Trust boundaries & tool scopes
13+
-
14+
15+
## Tests
16+
- [ ] Injection / exfiltration
17+
- [ ] Tool misuse
18+
- [ ] DoS
19+
20+
## Notes
21+
- Add `security-approved` label if CI/infra/lockfiles are changed.

.github/copilot-instructions.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copilot Operating Instructions — Building Secure LLM Agents (Node/TS)
2+
3+
You are a coding assistant inside this repository. Help build task-specific LLM agents that resist prompt injection and unsafe tool use. Follow exactly:
4+
5+
## Principles
6+
- Constrain by design; clear trust boundaries.
7+
- Treat free text as untrusted.
8+
- Separate planning from execution and untrusted text from tool use.
9+
- Least privilege & sandboxing.
10+
11+
## Workflow (Plan → Patch)
12+
- Always produce a PLAN (YAML) before code.
13+
- Then produce a PATCH (unified diff) matching the PLAN.
14+
15+
## Untrusted Data Handling
16+
- Quarantined Reader: convert raw text ➜ strict JSON schema (no free text pass-through, no tools).
17+
- Reducer/Orchestrator: aggregate sanitized outputs; only this layer may use tools.
18+
- Context minimization between steps.
19+
20+
## Output Contracts
21+
- PLAN YAML, PATCH diff, API summary JSON as documented in /schemas.

.github/docker/ci.Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:20-alpine
2+
3+
RUN apk add --no-cache python3 py3-pip bash git && ln -sf python3 /usr/bin/python
4+
WORKDIR /work
5+
6+
# Copy manifests first for caching
7+
COPY package.json package-lock.json* /work/
8+
RUN if [ -f package-lock.json ]; then npm ci --ignore-scripts; else npm install --ignore-scripts; fi
9+
10+
# Python tooling for validators
11+
COPY requirements.txt* /tmp/ 2>/dev/null || true
12+
RUN if [ -f /tmp/requirements.txt ]; then pip install --no-cache-dir -r /tmp/requirements.txt; fi
13+
RUN pip install --no-cache-dir pytest jsonschema pyyaml
14+
15+
CMD ["bash"]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Secure LLM Agents CI (Node/TS)
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, labeled]
6+
push:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
13+
jobs:
14+
validate-changed-paths:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with: { fetch-depth: 0 }
19+
- uses: actions/setup-python@v5
20+
with: { python-version: '3.11' }
21+
- run: python -m pip install --upgrade pip pyyaml
22+
- name: Validate changed paths
23+
env:
24+
GITHUB_EVENT_PATH: ${{ github.event_path }}
25+
run: python scripts/validate_changed_paths.py
26+
27+
schema-checks:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-python@v5
32+
with: { python-version: '3.11' }
33+
- run: python -m pip install --upgrade pip jsonschema pyyaml
34+
- name: Validate schemas
35+
run: python scripts/validate_schemas.py
36+
37+
tests:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Build CI image
42+
run: docker build -f .github/docker/ci.Dockerfile -t secure-agents-ci .
43+
- name: Run tests (network=none)
44+
run: docker run --rm --network=none -v "$PWD":/work -w /work secure-agents-ci bash -lc "./scripts/ci_test_runner.sh"

.gitignore

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Node dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
pnpm-debug.log*
7+
package-lock.json
8+
yarn.lock
9+
pnpm-lock.yaml
10+
11+
# Build output
12+
dist/
13+
coverage/
14+
.nyc_output/
15+
.vitest/
16+
*.tsbuildinfo
17+
18+
# Logs
19+
logs/
20+
*.log
21+
*.log.*
22+
*.out
23+
*.err
24+
25+
# Runtime data
26+
pids
27+
*.pid
28+
*.seed
29+
*.pid.lock
30+
31+
# Environment files
32+
.env
33+
.env.*.local
34+
.env.local
35+
.env.test.local
36+
.env.production.local
37+
38+
# OS / Editor cruft
39+
.DS_Store
40+
Thumbs.db
41+
.idea/
42+
.vscode/*
43+
!.vscode/settings.json
44+
!.vscode/tasks.json
45+
!.vscode/extensions.json
46+
47+
# Docker
48+
docker-compose.override.yml
49+
.docker/
50+
*.tar
51+
52+
# CI cache / artifacts
53+
.cache/
54+
tmp/
55+
*.swp
56+
57+
# Python tooling (validators)
58+
__pycache__/
59+
*.pyc
60+
.venv/
61+
pip-wheel-metadata/
62+
63+
# Test snapshots
64+
*.snap
65+
66+
# Prettier/ESLint cache
67+
.eslintcache
68+
.prettier-cache/
69+
70+
# Misc
71+
*.tgz

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fund=false
2+
audit=true
3+
prefer-online=false

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-merge-conflict
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
- repo: local
10+
hooks:
11+
- id: schema-validate
12+
name: Schema validate (plans & api summaries)
13+
entry: python scripts/validate_schemas.py
14+
language: system
15+
pass_filenames: false
16+
- id: path-validate
17+
name: Path restrictions (no sensitive edits)
18+
entry: python scripts/validate_changed_paths.py
19+
language: system
20+
pass_filenames: false

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"semi": true,
4+
"printWidth": 100
5+
}

0 commit comments

Comments
 (0)