gitops-by-veera 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .env
12
+ .venv
13
+ venv/
14
+ env/
15
+ ENV/
16
+
17
+ # Testing
18
+ .pytest_cache/
19
+ .coverage
20
+ htmlcov/
21
+ .tox/
22
+
23
+ # Type checking
24
+ .mypy_cache/
25
+ .ruff_cache/
26
+
27
+ # Editors
28
+ .vscode/
29
+ .idea/
30
+ *.swp
31
+ *.swo
32
+
33
+ # OS
34
+ .DS_Store
35
+ Thumbs.db
36
+
37
+ # Logs
38
+ *.log
39
+ ~/.gitpilot_by_veera.log
40
+
41
+ # GitPilot runtime
42
+ .gitpilot.lock
43
+ ~/.gitpilot_by_veera_config.json
44
+ ~/.gitpilot_by_veera.lock
45
+
46
+ # Distribution
47
+ *.tar.gz
48
+ *.whl
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Veerakumar C B
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,269 @@
1
+ Metadata-Version: 2.4
2
+ Name: gitops-by-veera
3
+ Version: 1.0.0
4
+ Summary: Conversational autonomous Git and GitHub operations coordinator using Groq-hosted LLMs.
5
+ Project-URL: Homepage, https://github.com/vkprince6/gitops-by-veera
6
+ Project-URL: Repository, https://github.com/vkprince6/gitops-by-veera
7
+ Project-URL: Bug Tracker, https://github.com/vkprince6/gitops-by-veera/issues
8
+ Author: Veera
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 Veerakumar C B
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: automation,cli,git,github,groq,llm
32
+ Classifier: Development Status :: 5 - Production/Stable
33
+ Classifier: Environment :: Console
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Topic :: Software Development :: Version Control :: Git
42
+ Classifier: Topic :: Utilities
43
+ Requires-Python: >=3.10
44
+ Requires-Dist: click>=8.1.7
45
+ Requires-Dist: pydantic>=2.0.0
46
+ Requires-Dist: requests>=2.31.0
47
+ Requires-Dist: typing-extensions>=4.12.0
48
+ Description-Content-Type: text/markdown
49
+
50
+ # gitops-by-veera
51
+
52
+ A production-ready, security-hardened, conversational autonomous Git and GitHub operations coordinator. Convert natural language into safe, validated local Git commands and GitHub REST API calls — powered by Groq-hosted LLMs.
53
+
54
+ ---
55
+
56
+ ## Features
57
+
58
+ - **Natural language to Git/GitHub actions** — describe what you want, GitOps plans and executes it
59
+ - **Dual-domain operations** — local Git commands and GitHub cloud API calls in a single pipeline
60
+ - **Security-first architecture** — command injection prevention, path traversal blocking, shell injection defense, and prompt injection resistance
61
+ - **Model cascading** — automatic fallback across three Groq-hosted model tiers
62
+ - **Self-healing remediation** — failed operations trigger AI-generated fix suggestions (capped at 2 cycles)
63
+ - **Direct evaluation bypass** — trivial commands (`git status`, `git diff`, `git log`) skip the LLM entirely for speed
64
+ - **Structured JSON contracts** — all LLM output is parsed into strict Pydantic models
65
+ - **Session telemetry** — detailed execution metrics available with `--debug`
66
+ - **Colab/Jupyter compatible** — runs in notebooks, cloud runtimes, and local terminals
67
+
68
+ ---
69
+
70
+ ## Installation
71
+
72
+ ### From PyPI
73
+
74
+ ```bash
75
+ pip install gitops-by-veera
76
+ ```
77
+
78
+ ### From source
79
+
80
+ ```bash
81
+ git clone https://github.com/vkprince6/gitops-by-veera.git
82
+ cd gitops-by-veera
83
+ pip install -e ".[dev]"
84
+ ```
85
+
86
+ ### Google Colab
87
+
88
+ ```python
89
+ !pip install gitops-by-veera
90
+ import subprocess
91
+ subprocess.run(["git-ops", "setup"])
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Credentials & Security
97
+
98
+ GitOps requires two API credentials:
99
+
100
+ | Credential | Environment Variable | Description |
101
+ |---|---|---|
102
+ | Groq API Key | `GROQ_API_KEY` | From [console.groq.com](https://console.groq.com) |
103
+ | GitHub Token | `GITHUB_TOKEN` | Fine-grained PAT with repo read/write scopes |
104
+
105
+ > **IMPORTANT:** Classic admin GitHub tokens are strictly prohibited.
106
+ > You MUST use [fine-grained Personal Access Tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)
107
+ > scoped to specific repositories with only the permissions required for your workflow.
108
+
109
+ Credentials are stored at `~/.gitops_by_veera_config.json` with `chmod 600` permissions. They are **never** logged or printed to the terminal.
110
+
111
+ ---
112
+
113
+ ## Setup
114
+
115
+ ```bash
116
+ git-ops setup
117
+ ```
118
+
119
+ You will be prompted (via `getpass`) for your Groq API key and GitHub token. Alternatively, set environment variables:
120
+
121
+ ```bash
122
+ export GROQ_API_KEY="gsk_..."
123
+ export GITHUB_TOKEN="github_pat_..."
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Usage
129
+
130
+ ### Run a natural language pipeline
131
+
132
+ ```bash
133
+ git-ops run "Stage all files, commit with message 'feat: initial setup', and push to origin main"
134
+ ```
135
+
136
+ ### Dry-run (plan and validate only — no execution)
137
+
138
+ ```bash
139
+ git-ops run "Create a branch called feature-xyz and push it" --dry-run
140
+ ```
141
+
142
+ ### Debug mode with telemetry
143
+
144
+ ```bash
145
+ git-ops run "Open a PR from feature-xyz to main with title 'New Feature'" --debug
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Supported Operations
151
+
152
+ ### Local Git
153
+
154
+ | Operation | Risk Level |
155
+ |---|---|
156
+ | `git status`, `git diff`, `git log` | Safe |
157
+ | `git add`, `git commit`, `git fetch`, `git pull` | Safe |
158
+ | `git push`, `git branch`, `git checkout`, `git switch` | Safe |
159
+ | `git reset --hard`, `git clean -fd`, `git push --force` | Warning — requires confirmation |
160
+ | `git rebase`, `git cherry-pick`, `git stash clear` | Warning — requires confirmation |
161
+ | `git filter-branch`, `git reflog expire`, `git gc --prune=now` | **Blocked** |
162
+
163
+ ### GitHub Cloud (via REST API)
164
+
165
+ - Create repositories (`/user/repos`, `/orgs/{org}/repos`)
166
+ - Manage branches and refs (`/repos/{owner}/{repo}/git/refs`)
167
+ - Open, list, and update Pull Requests (`/repos/{owner}/{repo}/pulls`)
168
+ - Merge Pull Requests (`/repos/{owner}/{repo}/pulls/{number}/merge`)
169
+ - Create and update Issues (`/repos/{owner}/{repo}/issues`)
170
+ - Trigger GitHub Actions workflows (`/repos/{owner}/{repo}/actions/workflows/{id}/dispatches`)
171
+
172
+ > All `DELETE` requests and repository-level destructive endpoints are strictly blocked.
173
+
174
+ ---
175
+
176
+ ## Example Workflows
177
+
178
+ ```bash
179
+ # View repository status (bypasses LLM entirely for speed)
180
+ git-ops run "show status"
181
+
182
+ # Full branch + commit + PR workflow
183
+ git-ops run "Create branch feature-auth, commit staged files with message 'feat: add auth', push, and open a PR to main"
184
+
185
+ # Create a GitHub issue
186
+ git-ops run "Create an issue titled 'Bug: login fails on mobile' with a description"
187
+
188
+ # Trigger a workflow dispatch
189
+ git-ops run "Trigger the deploy.yml workflow on the main branch"
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Google Colab Integration
195
+
196
+ ```python
197
+ !pip install gitops-by-veera
198
+
199
+ import os
200
+ os.environ["GROQ_API_KEY"] = "gsk_..." # or use Colab secrets
201
+ os.environ["GITHUB_TOKEN"] = "github_pat_..."
202
+
203
+ import subprocess
204
+ result = subprocess.run(
205
+ ["git-ops", "run", "show git status", "--dry-run"],
206
+ capture_output=True, text=True
207
+ )
208
+ print(result.stdout)
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Architecture
214
+
215
+ ```
216
+ User prompt
217
+
218
+ ├── Direct Evaluation Router (regex bypass for trivial commands)
219
+ │ └── Returns plan immediately, skips LLM
220
+
221
+ └── LLM Cascade (Groq API)
222
+ ├── Tier 1: openai/gpt-oss-120b
223
+ ├── Tier 2: openai/gpt-oss-20b
224
+ └── Tier 3: llama-3.1-8b-instant (also used for remediation)
225
+
226
+ └── Pydantic-validated ExecutionPlan
227
+
228
+ └── Multi-stage Validator
229
+ ├── Binary whitelist enforcement
230
+ ├── Shell injection detection
231
+ ├── Path traversal blocking
232
+ ├── GitHub endpoint whitelist
233
+ └── Payload field sanitization
234
+
235
+ └── Sequential Executor
236
+ ├── Local: subprocess.run (shell=False)
237
+ └── Cloud: requests → GitHub REST API
238
+
239
+ └── Self-Healing Remediation (≤2 cycles)
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Development
245
+
246
+ ```bash
247
+ pip install -e ".[dev]"
248
+
249
+ # Run tests
250
+ pytest --cov=src/gitops_by_veera --cov-report=term-missing
251
+
252
+ # Type checking
253
+ mypy src/
254
+
255
+ # Linting
256
+ ruff check src/ tests/
257
+ ```
258
+
259
+ ---
260
+
261
+ ## License
262
+
263
+ MIT License — see [LICENSE](LICENSE).
264
+
265
+ ---
266
+
267
+ ## Security
268
+
269
+ See [SECURITY.md](SECURITY.md) for the full security architecture and responsible disclosure policy.
@@ -0,0 +1,220 @@
1
+ # gitops-by-veera
2
+
3
+ A production-ready, security-hardened, conversational autonomous Git and GitHub operations coordinator. Convert natural language into safe, validated local Git commands and GitHub REST API calls — powered by Groq-hosted LLMs.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - **Natural language to Git/GitHub actions** — describe what you want, GitOps plans and executes it
10
+ - **Dual-domain operations** — local Git commands and GitHub cloud API calls in a single pipeline
11
+ - **Security-first architecture** — command injection prevention, path traversal blocking, shell injection defense, and prompt injection resistance
12
+ - **Model cascading** — automatic fallback across three Groq-hosted model tiers
13
+ - **Self-healing remediation** — failed operations trigger AI-generated fix suggestions (capped at 2 cycles)
14
+ - **Direct evaluation bypass** — trivial commands (`git status`, `git diff`, `git log`) skip the LLM entirely for speed
15
+ - **Structured JSON contracts** — all LLM output is parsed into strict Pydantic models
16
+ - **Session telemetry** — detailed execution metrics available with `--debug`
17
+ - **Colab/Jupyter compatible** — runs in notebooks, cloud runtimes, and local terminals
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ### From PyPI
24
+
25
+ ```bash
26
+ pip install gitops-by-veera
27
+ ```
28
+
29
+ ### From source
30
+
31
+ ```bash
32
+ git clone https://github.com/vkprince6/gitops-by-veera.git
33
+ cd gitops-by-veera
34
+ pip install -e ".[dev]"
35
+ ```
36
+
37
+ ### Google Colab
38
+
39
+ ```python
40
+ !pip install gitops-by-veera
41
+ import subprocess
42
+ subprocess.run(["git-ops", "setup"])
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Credentials & Security
48
+
49
+ GitOps requires two API credentials:
50
+
51
+ | Credential | Environment Variable | Description |
52
+ |---|---|---|
53
+ | Groq API Key | `GROQ_API_KEY` | From [console.groq.com](https://console.groq.com) |
54
+ | GitHub Token | `GITHUB_TOKEN` | Fine-grained PAT with repo read/write scopes |
55
+
56
+ > **IMPORTANT:** Classic admin GitHub tokens are strictly prohibited.
57
+ > You MUST use [fine-grained Personal Access Tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)
58
+ > scoped to specific repositories with only the permissions required for your workflow.
59
+
60
+ Credentials are stored at `~/.gitops_by_veera_config.json` with `chmod 600` permissions. They are **never** logged or printed to the terminal.
61
+
62
+ ---
63
+
64
+ ## Setup
65
+
66
+ ```bash
67
+ git-ops setup
68
+ ```
69
+
70
+ You will be prompted (via `getpass`) for your Groq API key and GitHub token. Alternatively, set environment variables:
71
+
72
+ ```bash
73
+ export GROQ_API_KEY="gsk_..."
74
+ export GITHUB_TOKEN="github_pat_..."
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Usage
80
+
81
+ ### Run a natural language pipeline
82
+
83
+ ```bash
84
+ git-ops run "Stage all files, commit with message 'feat: initial setup', and push to origin main"
85
+ ```
86
+
87
+ ### Dry-run (plan and validate only — no execution)
88
+
89
+ ```bash
90
+ git-ops run "Create a branch called feature-xyz and push it" --dry-run
91
+ ```
92
+
93
+ ### Debug mode with telemetry
94
+
95
+ ```bash
96
+ git-ops run "Open a PR from feature-xyz to main with title 'New Feature'" --debug
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Supported Operations
102
+
103
+ ### Local Git
104
+
105
+ | Operation | Risk Level |
106
+ |---|---|
107
+ | `git status`, `git diff`, `git log` | Safe |
108
+ | `git add`, `git commit`, `git fetch`, `git pull` | Safe |
109
+ | `git push`, `git branch`, `git checkout`, `git switch` | Safe |
110
+ | `git reset --hard`, `git clean -fd`, `git push --force` | Warning — requires confirmation |
111
+ | `git rebase`, `git cherry-pick`, `git stash clear` | Warning — requires confirmation |
112
+ | `git filter-branch`, `git reflog expire`, `git gc --prune=now` | **Blocked** |
113
+
114
+ ### GitHub Cloud (via REST API)
115
+
116
+ - Create repositories (`/user/repos`, `/orgs/{org}/repos`)
117
+ - Manage branches and refs (`/repos/{owner}/{repo}/git/refs`)
118
+ - Open, list, and update Pull Requests (`/repos/{owner}/{repo}/pulls`)
119
+ - Merge Pull Requests (`/repos/{owner}/{repo}/pulls/{number}/merge`)
120
+ - Create and update Issues (`/repos/{owner}/{repo}/issues`)
121
+ - Trigger GitHub Actions workflows (`/repos/{owner}/{repo}/actions/workflows/{id}/dispatches`)
122
+
123
+ > All `DELETE` requests and repository-level destructive endpoints are strictly blocked.
124
+
125
+ ---
126
+
127
+ ## Example Workflows
128
+
129
+ ```bash
130
+ # View repository status (bypasses LLM entirely for speed)
131
+ git-ops run "show status"
132
+
133
+ # Full branch + commit + PR workflow
134
+ git-ops run "Create branch feature-auth, commit staged files with message 'feat: add auth', push, and open a PR to main"
135
+
136
+ # Create a GitHub issue
137
+ git-ops run "Create an issue titled 'Bug: login fails on mobile' with a description"
138
+
139
+ # Trigger a workflow dispatch
140
+ git-ops run "Trigger the deploy.yml workflow on the main branch"
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Google Colab Integration
146
+
147
+ ```python
148
+ !pip install gitops-by-veera
149
+
150
+ import os
151
+ os.environ["GROQ_API_KEY"] = "gsk_..." # or use Colab secrets
152
+ os.environ["GITHUB_TOKEN"] = "github_pat_..."
153
+
154
+ import subprocess
155
+ result = subprocess.run(
156
+ ["git-ops", "run", "show git status", "--dry-run"],
157
+ capture_output=True, text=True
158
+ )
159
+ print(result.stdout)
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Architecture
165
+
166
+ ```
167
+ User prompt
168
+
169
+ ├── Direct Evaluation Router (regex bypass for trivial commands)
170
+ │ └── Returns plan immediately, skips LLM
171
+
172
+ └── LLM Cascade (Groq API)
173
+ ├── Tier 1: openai/gpt-oss-120b
174
+ ├── Tier 2: openai/gpt-oss-20b
175
+ └── Tier 3: llama-3.1-8b-instant (also used for remediation)
176
+
177
+ └── Pydantic-validated ExecutionPlan
178
+
179
+ └── Multi-stage Validator
180
+ ├── Binary whitelist enforcement
181
+ ├── Shell injection detection
182
+ ├── Path traversal blocking
183
+ ├── GitHub endpoint whitelist
184
+ └── Payload field sanitization
185
+
186
+ └── Sequential Executor
187
+ ├── Local: subprocess.run (shell=False)
188
+ └── Cloud: requests → GitHub REST API
189
+
190
+ └── Self-Healing Remediation (≤2 cycles)
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Development
196
+
197
+ ```bash
198
+ pip install -e ".[dev]"
199
+
200
+ # Run tests
201
+ pytest --cov=src/gitops_by_veera --cov-report=term-missing
202
+
203
+ # Type checking
204
+ mypy src/
205
+
206
+ # Linting
207
+ ruff check src/ tests/
208
+ ```
209
+
210
+ ---
211
+
212
+ ## License
213
+
214
+ MIT License — see [LICENSE](LICENSE).
215
+
216
+ ---
217
+
218
+ ## Security
219
+
220
+ See [SECURITY.md](SECURITY.md) for the full security architecture and responsible disclosure policy.
@@ -0,0 +1,121 @@
1
+ # Security Policy — gitops-by-veera
2
+
3
+ ## Overview
4
+
5
+ GitOps is designed with a security-first architecture at every layer. This document describes the protective mechanisms in place and how to report vulnerabilities responsibly.
6
+
7
+ ---
8
+
9
+ ## Credential Protection
10
+
11
+ ### Storage
12
+ - Credentials are stored in `~/.gitops_by_veera_config.json` with `chmod 600` permissions (owner read/write only).
13
+ - The file contains only `github_token` and `groq_api_key`. No other data is persisted.
14
+
15
+ ### Priority & Environment Variables
16
+ - Credentials are loaded in priority order: environment variables (`GITHUB_TOKEN`, `GROQ_API_KEY`) first, then the config file.
17
+ - Environment variables are never written to disk by GitOps.
18
+
19
+ ### Secret Redaction
20
+ - A `SecretRedactionFilter` is applied to all log handlers. It scrubs:
21
+ - Known token patterns (`ghp_...`, `github_pat_...`, `ghs_...`, `gho_...`, `ghu_...`, `gsk_...`)
22
+ - `Authorization: Bearer ...` header content
23
+ - Exact runtime values of loaded credentials
24
+ - Credentials never appear in log files, stack traces, standard error, or console output.
25
+
26
+ ---
27
+
28
+ ## Command Injection Prevention
29
+
30
+ ### Shell Execution Policy
31
+ - `shell=True` is **never used** in any subprocess call. All commands are executed via `subprocess.run(..., shell=False)` with an explicit argument list.
32
+ - The `cd` shell state mutation is never executed as a process. Directory context is passed exclusively via the `cwd` parameter of `subprocess.run`.
33
+
34
+ ### Binary Whitelist
35
+ Only these executables are permitted: `git`, `pwd`, `mkdir`, `ls`. Any other binary is immediately rejected with a `ForbiddenBinaryError`.
36
+
37
+ ### Prohibited Token Detection
38
+ The following characters and strings are blocked in all arguments:
39
+ ```
40
+ ; && || | > >> < $ ` $( sudo rm chmod chown curl wget python bash sh zsh powershell cmd.exe
41
+ ```
42
+ Any argument containing these tokens raises a `CommandInjectionError` before execution.
43
+
44
+ ### Path Traversal Protection
45
+ All arguments containing `..` are resolved and verified to remain within the detected repository root or current working directory. Escape attempts raise a `PathTraversalError`.
46
+
47
+ ---
48
+
49
+ ## Prompt Injection Defense
50
+
51
+ ### Untrusted Context Separation
52
+ The system prompt explicitly instructs the LLM to treat all local workspace context — repository files, commit messages, issue bodies, README content, CI configuration, branch names — as **untrusted input**.
53
+
54
+ ### Policy Sovereignty
55
+ The system enforces an absolute security boundary. The LLM is instructed to completely reject any directive that conflicts with the established execution policy, regardless of origin. No repository artifact can override the system's security constraints.
56
+
57
+ ### Structured Output Enforcement
58
+ All LLM outputs are parsed into strict Pydantic models. Free-form text responses, markdown-wrapped JSON, and schema-mismatched outputs are rejected immediately, triggering model cascade fallback. No unvalidated loose dictionary parsing is performed.
59
+
60
+ ---
61
+
62
+ ## GitHub API Security
63
+
64
+ ### Endpoint Whitelist
65
+ Only the following GitHub REST API endpoints are permitted:
66
+ - `GET/POST /user/repos`
67
+ - `POST /orgs/{org}/repos`
68
+ - `GET/POST/PATCH /repos/{owner}/{repo}/issues[/{number}]`
69
+ - `GET/POST/PATCH /repos/{owner}/{repo}/pulls[/{number}]`
70
+ - `POST /repos/{owner}/{repo}/pulls/{number}/reviews`
71
+ - `PUT /repos/{owner}/{repo}/pulls/{number}/merge`
72
+ - `POST /repos/{owner}/{repo}/actions/workflows/{id}/dispatches`
73
+ - `GET/POST /repos/{owner}/{repo}/git/refs[/{ref}]`
74
+
75
+ Any endpoint not matching this whitelist raises a `CloudEndpointViolationError`.
76
+
77
+ ### DELETE Method Block
78
+ All `DELETE` HTTP requests are unconditionally rejected with a `SecurityViolationError`. Repository deletion and any other destructive resource removal is impossible.
79
+
80
+ ### Payload Sanitization
81
+ Cloud operation payloads are sanitized against per-endpoint field allowlists. Unknown, suspicious, or excessively nested keys are stripped before transmission. This prevents parameter injection via LLM-generated payloads.
82
+
83
+ ---
84
+
85
+ ## Git History Rewrite Safeguards
86
+
87
+ The following operations are **strictly blocked** and cannot be executed under any circumstances:
88
+ - `git filter-branch`
89
+ - `git reflog expire`
90
+ - `git gc --prune=now`
91
+
92
+ The following operations require **explicit user confirmation** at runtime:
93
+ - `git reset --hard`
94
+ - `git clean -fd`
95
+ - `git branch -D`
96
+ - `git push --force` / `git push -f`
97
+ - `git rebase`
98
+ - `git cherry-pick`
99
+ - `git stash clear`
100
+
101
+ ---
102
+
103
+ ## Concurrency Safety
104
+
105
+ A PID-based lockfile prevents multiple simultaneous GitOps instances from running in the same repository. Stale locks (from crashed processes) are detected via OS-level PID existence checks and cleaned up automatically.
106
+
107
+ ---
108
+
109
+ ## Token Requirements
110
+
111
+ GitOps requires **fine-grained Personal Access Tokens** only. Classic admin tokens are explicitly prohibited in documentation and enforced through user-facing warnings during setup. Fine-grained tokens should be scoped to:
112
+ - Specific repositories (not all repositories)
113
+ - Minimum required permissions (Contents: Read & Write, Pull Requests: Read & Write, Issues: Read & Write, Actions: Read & Write)
114
+
115
+ ---
116
+
117
+ ## Responsible Disclosure
118
+
119
+ If you discover a security vulnerability, please report it privately by opening a [GitHub Security Advisory](https://docs.github.com/en/code-security/security-advisories) on this repository rather than filing a public issue. Do not include proof-of-concept exploit code in the initial report.
120
+
121
+ We will acknowledge receipt within 72 hours and aim to release a patch within 14 days for critical vulnerabilities.