S-Dreamer commited on
Commit
9cb16b8
·
verified ·
1 Parent(s): 4da5a02

Upload 13 files

Browse files
Files changed (7) hide show
  1. .gitignore +33 -0
  2. CLAUDE.md +267 -0
  3. README.md +16 -10
  4. SECURITY.md +137 -56
  5. assistant.prompt.yml +79 -0
  6. requirements.txt +8 -7
  7. semantic-versioning.prompt.yml +72 -0
.gitignore ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Test / coverage
18
+ .pytest_cache/
19
+ .coverage
20
+ .coverage.*
21
+ htmlcov/
22
+ .tox/
23
+ .mypy_cache/
24
+ .ruff_cache/
25
+
26
+ # Editors
27
+ .vscode/
28
+ .idea/
29
+ *.swp
30
+ .DS_Store
31
+
32
+ # Runtime artifacts (per CLAUDE.md)
33
+ runs/
CLAUDE.md ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project
6
+
7
+ Passive OSINT Control Panel — a Gradio-based Hugging Face Space for drift-aware,
8
+ passive-first OSINT enrichment. Inputs are validated, sanitised, normalised, and
9
+ HMAC-hashed before any logging or enrichment. External-target interaction is
10
+ gated behind explicit authorization.
11
+
12
+ - **Entry point:** `app.py` (Gradio `demo.launch()`)
13
+ - **Runtime:** Python 3.11+, Gradio 6.13.x, HF Space SDK `gradio`
14
+ - **Version:** `0.1.0` (`APP_VERSION` in `app.py`, `__version__` in `osint_core/__init__.py`)
15
+ - **License:** Apache-2.0
16
+ - **HF Space front matter** lives at the top of `README.md` — do not strip it.
17
+
18
+ ## Repository layout
19
+
20
+ ```
21
+ .
22
+ ├── app.py # Monolithic Gradio UI + full pipeline (current prod)
23
+ ├── osint_core/ # Modular refactor of app.py's logic (preferred for new code)
24
+ │ ├── __init__.py # Public API: validate_indicator, create_orchestrator, ...
25
+ │ ├── validators.py # Input validation + normalisation (pure, no I/O)
26
+ │ ├── policy.py # Module authorization boundary + correction verb gate
27
+ │ ├── orchestrator.py # Agent-based workflow coordination
28
+ │ └── drift.py # DRIFT LAYER — currently PSEUDOCODE, not runnable (see below)
29
+ ├── agent/ # Claude-powered OSINT expert agent (NEW)
30
+ │ ├── __init__.py # Exports OSINTAgent
31
+ │ ├── osint_agent.py # OSINTAgent class — claude-opus-4-7, adaptive thinking, prompt caching
32
+ │ └── cli.py # argparse CLI: --target, --type, --iocs, --explain, interactive mode
33
+ ├── tests/
34
+ │ ├── test_policy.py # Passes against osint_core.policy
35
+ │ ├── test_orchestrator.py # Passes against osint_core.orchestrator
36
+ │ └── test_drift.py # Contract tests — FAIL until drift.py is implemented
37
+ ├── data/sources.yaml # OSINT source registry (subset; app.py has its own inline copy)
38
+ ├── policy.yaml # Declarative policy snapshot (mirrors osint_core.policy)
39
+ ├── manifest.json # Artifact manifest skeleton
40
+ ├── golden_tests.json # Smoke-test fixtures for classification
41
+ ├── requirements.txt # Python deps (pinned ranges)
42
+ ├── packages.txt # HF Space apt packages (dnsutils, whois, libmagic1)
43
+ └── README.md # User/operator docs + HF Space config
44
+ ```
45
+
46
+ Two layers coexist:
47
+ - `app.py` is self-contained and ships the running Space today.
48
+ - `osint_core/` is the modular refactor targeted by the test suite. New logic
49
+ should land in `osint_core/` and be wired into `app.py` rather than expanded
50
+ in `app.py` directly.
51
+
52
+ ## Orchestrator agent architecture
53
+
54
+ The `osint_core/orchestrator.py` module provides an agent-based workflow
55
+ coordination system. It separates concerns into:
56
+
57
+ - **Agent**: `OrchestratorAgent` coordinates the full enrichment workflow
58
+ - **Skills**: High-level capabilities (e.g., "Resolve DNS", "Fetch WHOIS")
59
+ - **Tools**: Atomic external actions (e.g., DNS query, HTTP request, subprocess)
60
+ - **Execution context**: Tracks state through validation → policy → enrichment → drift → audit
61
+
62
+ ### Key data structures
63
+
64
+ - `Tool`: Atomic capability (subprocess, network, file, computation)
65
+ - `Skill`: Composed capability with required indicator types and tools
66
+ - `ExecutionContext`: Per-request state (run ID, normalized indicator, policy eval, errors)
67
+ - `SkillResult`: Result from executing a skill (status, data, error, duration)
68
+ - `EnrichmentWorkflow`: Complete workflow result with all execution details
69
+
70
+ ### Workflow execution pattern
71
+
72
+ ```python
73
+ from osint_core import create_orchestrator
74
+
75
+ agent = create_orchestrator()
76
+ workflow = agent.execute_workflow(
77
+ raw_indicator="example.com",
78
+ indicator_type_hint="Domain",
79
+ requested_modules=["resource_links", "dns_records"],
80
+ authorized_target=False,
81
+ passive_only=True,
82
+ )
83
+
84
+ # workflow.validation_result → ValidationResult
85
+ # workflow.policy_evaluation → PolicyEvaluation
86
+ # workflow.skill_results → list[SkillResult]
87
+ # workflow.drift_vector → dict[str, float]
88
+ # workflow.correction_verb → "ADAPT" | "CONSTRAIN" | "REVERT" | "OBSERVE"
89
+ ```
90
+
91
+ ### Adding new skills
92
+
93
+ 1. Define a `Tool` with type, description, auth requirements, timeout
94
+ 2. Create a `Skill` that references the tool(s) and required indicator types
95
+ 3. Register the skill in `SKILLS_REGISTRY` with a canonical name
96
+ 4. Add skill execution logic in `OrchestratorAgent._execute_skill`
97
+ 5. Add corresponding test in `tests/test_orchestrator.py`
98
+
99
+ Do not add skills directly to `app.py`; add them to `orchestrator.py` and wire
100
+ them through the orchestrator API.
101
+
102
+ ## AI Agent (Claude-powered)
103
+
104
+ `agent/osint_agent.py` — `OSINTAgent` wraps `claude-opus-4-7` with adaptive thinking
105
+ and prompt caching (the ~2000-token system prompt is cached via `cache_control: ephemeral`,
106
+ cutting input costs ~90% after the first turn).
107
+
108
+ ```python
109
+ from agent import OSINTAgent
110
+
111
+ agent = OSINTAgent() # reads ANTHROPIC_API_KEY from env
112
+ result = agent.analyze_target("example.com", analysis_type="passive") # or: full|threat|footprint|breach|darkweb|socmint
113
+ report = agent.generate_ioc_report(["1.2.3.4", "evil.com"])
114
+ ```
115
+
116
+ CLI: `python -m agent.cli --target example.com --type passive`
117
+ or interactive: `python -m agent.cli`
118
+
119
+ Conversation history preserves full `response.content` blocks (including thinking blocks)
120
+ for correct multi-turn context propagation.
121
+
122
+ ## Known state / critical gotchas
123
+
124
+ 1. **`osint_core/drift.py` is pseudocode, not Python.** It uses `DEFINE`,
125
+ `FUNCTION`, `RETURN`, `FOR … IN` as bare keywords and will raise
126
+ `SyntaxError` on import. `tests/test_drift.py` imports
127
+ `DriftAssessment`, `DriftSignal`, `DriftType`, `DriftVector`,
128
+ `TelemetrySnapshot`, `aggregate_signals`, `assess_drift`,
129
+ `choose_dominant_drift_type`, `estimate_confidence`, and
130
+ `recommend_correction` — these are not yet implemented in Python. Treat
131
+ `drift.py` as a spec to implement against the tests, not as working code
132
+ to edit in-place.
133
+ 2. **Two module registries.** `app.py` hard-codes `OSINT_LINKS`,
134
+ `PASSIVE_MODULES`, `AUTHORIZED_ONLY_MODULES`. `osint_core/policy.py` has
135
+ the canonical `MODULE_POLICIES` registry plus `ALIASES`. When adding a
136
+ module, update the `osint_core` registry first; mirror into `app.py` only
137
+ if the UI needs it.
138
+ 3. **Two validators.** `app.py` has inline `sanitize_text` /
139
+ `classify_and_normalize` / `validate_as_type`. `osint_core/validators.py`
140
+ is the stricter, structured replacement (`ValidationResult`,
141
+ `ValidationErrorCode`). Prefer `osint_core` for new code paths.
142
+ 4. **`OSINT_HASH_SALT` is required.** `app.py:get_hash_salt` raises on
143
+ startup without it. For local/dev only, set `ALLOW_DEV_SALT=true`. Never
144
+ commit a salt value.
145
+ 5. **Correction verbs are a closed set:** `ADAPT`, `CONSTRAIN`, `REVERT`,
146
+ `OBSERVE`. Do not introduce new verbs; `policy.enforce_correction_verb`
147
+ rejects anything else.
148
+ 6. **`policy.yaml` says `immutable: true`.** Policy changes require the
149
+ out-of-band gate in `policy.enforce_policy_mutation_gate`. Do not silently
150
+ broaden rules.
151
+
152
+ ## Design invariants (must not be violated)
153
+
154
+ From `policy.yaml`, `manifest.json`, and `app.py:make_manifest`:
155
+
156
+ - Passive by default. No scanning, brute forcing, credential testing, or
157
+ exploitation — these are `risk="forbidden"` in `MODULE_POLICIES` and must
158
+ stay that way.
159
+ - Validation runs before anything else. Downstream code does not re-validate.
160
+ - Hash (HMAC-SHA256 with `OSINT_HASH_SALT`, lowercased input) before writing
161
+ to audit logs. Raw indicators never enter audit payloads —
162
+ `policy.enforce_audit_payload` rejects `raw_indicator`, `raw_input`,
163
+ `indicator`, `email`, `domain`, `username`, `url`, `ip` keys.
164
+ - Authorized-only modules (`http_headers`, `robots_txt`, `screenshot`) stay
165
+ blocked unless the caller asserts `authorized_target=True` AND
166
+ `passive_only=False`.
167
+ - Drift detection is pure — it does not mutate telemetry, baseline, manifest,
168
+ or policy input. See `test_assess_drift_is_pure_and_does_not_mutate_inputs`.
169
+ - Correction priority: **policy > structural > behavioral > adversarial >
170
+ operational > statistical.** Adversarial CONSTRAINs before the system
171
+ ADAPTs. Statistical drift may ADAPT only when nothing higher-priority fires.
172
+
173
+ ## Development workflow
174
+
175
+ ### Setup
176
+
177
+ ```bash
178
+ pip install -r requirements.txt
179
+ # pytest and lint tooling are not in requirements.txt — install ad hoc:
180
+ pip install pytest ruff bandit pip-audit
181
+ export OSINT_HASH_SALT="$(python -c 'import secrets;print(secrets.token_hex(32))')"
182
+ # or for local-only:
183
+ export ALLOW_DEV_SALT=true
184
+ # for agent/ module:
185
+ export ANTHROPIC_API_KEY=<your-key>
186
+ ```
187
+
188
+ ### Run the app
189
+
190
+ ```bash
191
+ python app.py
192
+ # Gradio binds to 127.0.0.1:7860 by default.
193
+ ```
194
+
195
+ ### Test
196
+
197
+ ```bash
198
+ pytest # expect test_policy to pass; test_drift will fail
199
+ pytest tests/test_policy.py -v
200
+ pytest tests/test_policy.py::TestPolicyEnforcement::test_passive_only -v # single test
201
+ ```
202
+
203
+ Before claiming drift work is done, `pytest tests/test_drift.py` must pass.
204
+
205
+ ### Lint / security scan (per README)
206
+
207
+ ```bash
208
+ ruff check .
209
+ bandit -r osint_core/
210
+ pip-audit
211
+ ```
212
+
213
+ None of these are wired into CI yet — run locally.
214
+
215
+ ## Conventions
216
+
217
+ - **Python:** type hints throughout, `from __future__ import annotations`,
218
+ `@dataclass(frozen=True)` for value objects, `Literal[...]` for closed
219
+ enums. Match the existing style in `osint_core/validators.py` and
220
+ `osint_core/policy.py`.
221
+ - **Errors:** structured exceptions with an error-code enum
222
+ (`ValidationErrorCode`, `PolicyErrorCode`). Prefer returning a result
223
+ dataclass (`ValidationResult`, `PolicyEvaluation`) over raising for
224
+ expected failure paths; raise only at enforcement boundaries
225
+ (`assert_valid_or_raise`, `enforce_*`).
226
+ - **Module naming:** UI labels are human (`"HTTP Headers"`); canonical names
227
+ are snake_case (`"http_headers"`). Route every UI input through
228
+ `canonicalize_module_name` before policy checks.
229
+ - **No new dependencies without reason.** `requirements.txt` uses pinned
230
+ ranges; preserve the lower/upper bounds when bumping.
231
+ - **Never log raw indicators.** Add a test in the style of
232
+ `test_audit_payload_blocks_raw_indicator_fields` when introducing new
233
+ audit sinks.
234
+ - **Docstrings:** module-level docstrings state design intent (see
235
+ `validators.py`, `policy.py`). Keep that pattern for new modules.
236
+
237
+ ## Git workflow
238
+
239
+ - Default branch: `main`.
240
+ - Claude work branch (this environment): `claude/skills-agent-osint-4zbxP`.
241
+ Push only to the designated feature branch; never force-push `main`.
242
+ - GitHub repo scope for MCP tools: `canstralian/passiveosintcontrolpanel`
243
+ only. Other repos are denied.
244
+ - After pushing, open a **draft** PR if one does not already exist.
245
+ - Commit style from `git log`: short imperative titles
246
+ (`Create osint_core/policy.py`, `Update requirements.txt`).
247
+
248
+ ## Where to make common changes
249
+
250
+ | Task | File(s) |
251
+ | --- | --- |
252
+ | Add a new OSINT source link | `app.py:OSINT_LINKS` and `data/sources.yaml` |
253
+ | Add / change a module's risk or auth requirement | `osint_core/policy.py:MODULE_POLICIES` + test in `tests/test_policy.py` + mirror in `policy.yaml` |
254
+ | Tighten input validation | `osint_core/validators.py` (regexes, `DANGEROUS_PATTERNS`, `PRIVATE_NETS`) |
255
+ | Implement drift detection | `osint_core/drift.py` — rewrite the pseudocode to satisfy `tests/test_drift.py` |
256
+ | Change correction verbs | Forbidden without out-of-band approval; touches `osint_core/policy.py:ALLOWED_CORRECTION_VERBS`, `app.py:CorrectionVerb`, and `policy.yaml` |
257
+ | Wire a new module into the UI | `app.py:PASSIVE_MODULES`, `run_enrichment`, and the Gradio `CheckboxGroup` |
258
+ | Change audit schema | `app.py:TelemetryEvent` + `write_audit` + any consumer in `export_audit_index` |
259
+ | Add a new orchestrator skill | `osint_core/orchestrator.py:SKILLS_REGISTRY` + tool definition + test in `tests/test_orchestrator.py` |
260
+ | Extend the AI agent's analysis types | `agent/osint_agent.py:_build_analysis_prompt` (add to the `prompts` dict) |
261
+ | Adjust the AI agent's OSINT persona / knowledge | `agent/osint_agent.py:OSINT_SYSTEM_PROMPT` (re-cache will happen automatically on next call) |
262
+
263
+ ## Runtime artifacts (gitignored-ish)
264
+
265
+ `app.py` creates `runs/reports/` and `runs/audit/` on import and writes per-run
266
+ `.md` and `.json` files there. These directories are not tracked; do not
267
+ commit their contents.
README.md CHANGED
@@ -2,24 +2,30 @@
2
  title: Passive OSINT Control Panel
3
  emoji: 🛰️
4
  colorFrom: gray
5
- colorTo: purple
6
  sdk: gradio
7
  sdk_version: 6.13.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  short_description: Drift-aware, passive OSINT control system.
12
- models:
13
- - berkeley-nest/WhiteRabbitNeo-8B
14
- - cybertronai/cybertron-1.1-7b
15
- - S-Dreamer/PyCodeT5
16
- datasets:
17
- - agentlans/HuggingFaceFW-finewiki-sample
18
- - qywang1106/arxiv_number_small
19
- - DanielPFlorian/Transformers-Github-Issues
20
- - John6666/knowledge_base_md_for_rag_1
21
  ---
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  # Passive OSINT Control Panel (Hugging Face Space)
24
 
25
  ## Overview
 
2
  title: Passive OSINT Control Panel
3
  emoji: 🛰️
4
  colorFrom: gray
5
+ colorTo: indigo
6
  sdk: gradio
7
  sdk_version: 6.13.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  short_description: Drift-aware, passive OSINT control system.
 
 
 
 
 
 
 
 
 
12
  ---
13
 
14
+ <p align="center">
15
+ <img src="https://img.shields.io/badge/Hugging%20Face-Space-yellow?logo=huggingface" alt="Hugging Face Space">
16
+ <img src="https://img.shields.io/badge/SDK-Gradio%206.13.0-orange?logo=gradio" alt="Gradio SDK">
17
+ <img src="https://img.shields.io/badge/Python-3.13-blue?logo=python" alt="Python">
18
+ <img src="https://img.shields.io/badge/License-Apache--2.0-green" alt="Apache 2.0 License">
19
+ <img src="https://img.shields.io/badge/OSINT-Passive%20by%20Default-indigo" alt="Passive OSINT">
20
+ <img src="https://img.shields.io/badge/Drift--Aware-Control%20Loop-purple" alt="Drift-Aware Control Loop">
21
+ <img src="https://img.shields.io/github/actions/workflow/status/canstralian/PassiveOSINTControlPanel/ci.yml?branch=main&label=CI&logo=github" alt="CI Status">
22
+ <img src="https://img.shields.io/github/actions/workflow/status/canstralian/PassiveOSINTControlPanel/sync-huggingface.yml?branch=main&label=Sync&logo=github" alt="HF Sync Status">
23
+ <img src="https://img.shields.io/github/last-commit/canstralian/PassiveOSINTControlPanel?logo=github" alt="Last Commit">
24
+ <img src="https://img.shields.io/github/issues/canstralian/PassiveOSINTControlPanel?logo=github" alt="Open Issues">
25
+ <img src="https://img.shields.io/github/license/canstralian/PassiveOSINTControlPanel" alt="License">
26
+ ![Sync](https://img.shields.io/badge/Sync-setup-lightgrey)
27
+ </p>
28
+
29
  # Passive OSINT Control Panel (Hugging Face Space)
30
 
31
  ## Overview
SECURITY.md CHANGED
@@ -2,17 +2,17 @@
2
 
3
  ## Reporting a Vulnerability
4
 
5
- If you discover a security vulnerability in this repository, do **not** open a public issue.
6
 
7
- Use one of the following channels instead:
8
 
9
- 1. GitHub Security Advisories
10
- Go to **Security → Report a vulnerability** in this repository.
11
 
12
- 2. Direct contact
13
- Email: `security@example.com`
14
 
15
- Replace the email above with the correct security contact before production use.
16
 
17
  ## Project Scope
18
 
@@ -22,91 +22,172 @@ The system is designed around the following control path:
22
 
23
  ```text
24
  Validation → Policy → Execution → Drift → Audit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ```
26
 
27
- The default operating mode is passive. Active interaction with user-provided targets must be gated by explicit authorization.
28
 
29
  ## In-Scope Vulnerabilities
30
 
31
  High-priority reports include:
32
 
33
- - Input validation or sanitisation bypass
34
- - Raw indicator leakage before hashing
35
- - `OSINT_HASH_SALT` or other secret exposure
36
- - Authorization gate bypass
37
- - Execution of conditional modules without approval
38
- - Audit log tampering or deletion
39
- - Policy mutation without out-of-band approval
40
- - Drift detection manipulation that hides unsafe behavior
41
- - Dependency behavior that creates structural drift or unsafe execution
 
42
 
43
  Medium-priority reports include:
44
 
45
- - Incorrect module risk classification
46
- - Unsafe report generation
47
- - Overly permissive source registry behavior
48
- - Inconsistent correction-verb enforcement
49
- - Unhandled exceptions that expose sensitive runtime details
 
 
50
 
51
  Low-priority reports include:
52
 
53
- - UI-only issues without security impact
54
- - Non-sensitive error message quality
55
- - Documentation inconsistencies
 
56
 
57
  ## Out of Scope
58
 
59
  The following are not considered vulnerabilities in this repository:
60
 
61
- - Issues in third-party OSINT services linked by the application
62
- - Social engineering attacks
63
- - Denial-of-service attempts
64
- - Vulnerabilities requiring unauthorized access to third-party systems
65
- - Reports involving active scanning or exploitation of targets not owned by the reporter
66
- - Misuse of the tool by end users outside the intended authorization model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  ## Report Requirements
69
 
70
- Please include:
71
 
72
- - Summary of the issue
73
- - Affected component, if known
74
- - Steps to reproduce
75
- - Expected behavior
76
- - Actual behavior
77
- - Security impact
78
- - Safe proof of concept, if applicable
79
- - Suggested mitigation, if known
 
80
 
81
- Do not include real user data, secrets, unauthorized target data, destructive payloads, or exploit chains against third-party systems.
82
 
83
  ## Response Process
84
 
85
  Expected response timeline:
86
 
87
- - Acknowledgement: within 48 hours
88
- - Initial triage: within 5 business days
89
- - Fix plan: after validation and severity assessment
90
- - Coordinated disclosure: if applicable
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  ## Safe Harbor
93
 
94
- Security research is welcome when performed in good faith.
 
 
 
 
 
 
 
 
 
 
95
 
96
- You are expected to avoid privacy violations, avoid service degradation, avoid persistence or exfiltration, use only systems and data you are authorized to test, and stop testing if sensitive data is encountered.
97
 
98
- ## Security Architecture
99
 
100
- This project treats security as a feedback circuit.
101
 
102
- Core invariants:
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  ```text
105
- No raw indicators in audit logs.
106
- No conditional modules without authorization.
107
- No forbidden modules.
108
- No policy mutation without out-of-band approval.
109
- No correction outside the approved verbs: ADAPT, CONSTRAIN, REVERT, OBSERVE.
110
  ```
111
 
112
- Reports that improve validation, policy enforcement, drift attribution, or audit integrity are especially valuable.
 
 
2
 
3
  ## Reporting a Vulnerability
4
 
5
+ If you believe you have discovered a security vulnerability in this repository, please do **not** open a public issue, discussion, or pull request describing the vulnerability.
6
 
7
+ Use a private reporting channel instead:
8
 
9
+ 1. **GitHub Private Vulnerability Reporting**
10
+ Go to **Security → Report a vulnerability** in this repository, if available.
11
 
12
+ 2. **Direct security contact**
13
+ Email: `security@yourdomain.com`
14
 
15
+ Replace the email address above with the correct production security contact before publishing this repository.
16
 
17
  ## Project Scope
18
 
 
22
 
23
  ```text
24
  Validation → Policy → Execution → Drift → Audit
25
+ ````
26
+
27
+ The default operating mode is passive. Any active interaction with a user-provided target must be explicitly authorized before execution.
28
+
29
+ Security reports are most valuable when they help strengthen validation, authorization, policy enforcement, drift detection, audit integrity, or safe handling of indicators.
30
+
31
+ ## Security Model
32
+
33
+ The project is built around the following invariants:
34
+
35
+ ```text
36
+ No raw indicators in audit logs.
37
+ No conditional modules without explicit authorization.
38
+ No forbidden modules.
39
+ No policy mutation without out-of-band approval.
40
+ No correction outside the approved verbs: ADAPT, CONSTRAIN, REVERT, OBSERVE.
41
+ ```
42
+
43
+ The intended trust boundary is:
44
+
45
+ ```text
46
+ User Input → Validation → Policy Decision → Approved Execution → Drift Check → Audit Record
47
  ```
48
 
49
+ Any bypass, mutation, or unsafe shortcut in this chain may be security-relevant.
50
 
51
  ## In-Scope Vulnerabilities
52
 
53
  High-priority reports include:
54
 
55
+ * Input validation or sanitization bypass
56
+ * Raw indicator leakage before hashing or redaction
57
+ * Exposure of `OSINT_HASH_SALT` or other secrets
58
+ * Authorization gate bypass
59
+ * Execution of conditional modules without approval
60
+ * Audit log tampering, deletion, or suppression
61
+ * Policy mutation without out-of-band approval
62
+ * Drift detection manipulation that hides unsafe behavior
63
+ * Introduction of forbidden modules or active tooling
64
+ * Dependency behavior that causes unsafe execution or structural drift
65
 
66
  Medium-priority reports include:
67
 
68
+ * Incorrect module risk classification
69
+ * Unsafe report generation
70
+ * Overly permissive source registry behavior
71
+ * Inconsistent correction-verb enforcement
72
+ * Unhandled exceptions that expose sensitive runtime details
73
+ * Incomplete audit records for security-relevant actions
74
+ * Configuration behavior that weakens passive-first guarantees
75
 
76
  Low-priority reports include:
77
 
78
+ * UI-only issues without security impact
79
+ * Non-sensitive error message quality
80
+ * Documentation inconsistencies
81
+ * Minor logging or formatting issues that do not affect audit integrity
82
 
83
  ## Out of Scope
84
 
85
  The following are not considered vulnerabilities in this repository:
86
 
87
+ * Issues in third-party OSINT services linked by the application
88
+ * Social engineering attacks
89
+ * Denial-of-service attempts
90
+ * Physical attacks
91
+ * Spam or phishing reports unrelated to this codebase
92
+ * Vulnerabilities requiring unauthorized access to third-party systems
93
+ * Reports involving active scanning or exploitation of targets not owned or explicitly controlled by the reporter
94
+ * Misuse of the tool by end users outside the intended authorization model
95
+ * Findings based only on hypothetical impact without a realistic path to exploitation
96
+
97
+ ## Testing Rules
98
+
99
+ Security testing must be safe, authorized, and non-destructive.
100
+
101
+ Do not:
102
+
103
+ * Use real user data
104
+ * Submit secrets, credentials, or unauthorized target data
105
+ * Perform active scanning against third-party systems
106
+ * Attempt persistence, privilege escalation, or data exfiltration
107
+ * Degrade service availability
108
+ * Run destructive payloads
109
+ * Chain exploits against systems outside your authorization scope
110
+
111
+ If sensitive data is encountered during testing, stop immediately and report the exposure through a private channel.
112
 
113
  ## Report Requirements
114
 
115
+ Please include as much of the following as possible:
116
 
117
+ * Summary of the issue
118
+ * Affected component, file, or control path
119
+ * Steps to reproduce
120
+ * Expected behavior
121
+ * Actual behavior
122
+ * Security impact
123
+ * Safe proof of concept, if applicable
124
+ * Suggested mitigation, if known
125
+ * Whether the issue affects validation, policy, execution, drift detection, or audit integrity
126
 
127
+ Please avoid including real user data, live secrets, unauthorized target data, destructive payloads, or exploit chains against third-party systems.
128
 
129
  ## Response Process
130
 
131
  Expected response timeline:
132
 
133
+ * **Acknowledgement:** within 48 hours
134
+ * **Initial triage:** within 5 business days
135
+ * **Severity assessment:** after reproduction and impact review
136
+ * **Fix plan:** after validation of the issue
137
+ * **Coordinated disclosure:** when applicable
138
+
139
+ Timelines may vary depending on complexity, severity, and maintainer availability.
140
+
141
+ ## Coordinated Disclosure
142
+
143
+ Please give the maintainers reasonable time to investigate and remediate confirmed vulnerabilities before public disclosure.
144
+
145
+ If a vulnerability affects users, deployment safety, secrets, or audit integrity, coordinated disclosure may include:
146
+
147
+ * Patch development
148
+ * Regression tests
149
+ * Security advisory publication
150
+ * Versioned release notes
151
+ * Mitigation guidance
152
 
153
  ## Safe Harbor
154
 
155
+ Good-faith security research is welcome when it follows this policy.
156
+
157
+ The project will not pursue action against researchers who:
158
+
159
+ * Act in good faith
160
+ * Stay within authorized scope
161
+ * Avoid privacy violations
162
+ * Avoid service degradation
163
+ * Avoid persistence or exfiltration
164
+ * Report vulnerabilities promptly and privately
165
+ * Stop testing if sensitive data is encountered
166
 
167
+ Safe harbor does not apply to activity that targets third-party systems without authorization, uses destructive techniques, or attempts to access, retain, or disclose data that does not belong to the researcher.
168
 
169
+ ## Preferred Areas of Review
170
 
171
+ Reports are especially useful when they improve:
172
 
173
+ * Indicator validation
174
+ * Hashing and redaction behavior
175
+ * Authorization gating
176
+ * Passive-first enforcement
177
+ * Conditional module controls
178
+ * Source registry constraints
179
+ * Drift attribution
180
+ * Audit log integrity
181
+ * Policy mutation safeguards
182
+ * Dependency and supply-chain safety
183
+
184
+ ## Security Contact
185
+
186
+ Primary security contact:
187
 
188
  ```text
189
+ distortedprojection@gmail.com
 
 
 
 
190
  ```
191
 
192
+ ```
193
+ ```
assistant.prompt.yml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ messages:
2
+ - role: system
3
+ content: >-
4
+ You are a security-focused GitHub Actions remediation assistant.
5
+
6
+
7
+ Your task is to inspect a GitHub Actions workflow file and produce the
8
+ smallest safe patch that resolves CodeQL alerts without changing the
9
+ intended behavior of the workflow.
10
+
11
+
12
+ Focus specifically on the CodeQL alert: “Workflow does not contain
13
+ permissions.”
14
+
15
+
16
+ Apply least privilege to the GITHUB_TOKEN. Prefer read-only permissions at
17
+ the workflow level, and only add job-level write permissions when the
18
+ workflow clearly requires them.
19
+
20
+
21
+ Do not suggest broad permissions such as `write-all` unless there is no
22
+ safer alternative. Do not modify unrelated workflow logic. Preserve
23
+ existing jobs, steps, triggers, names, and formatting as much as possible.
24
+
25
+
26
+ Return:
27
+
28
+ 1. A short diagnosis.
29
+
30
+ 2. The exact YAML patch or corrected workflow block.
31
+
32
+ 3. A brief explanation of why each permission is needed.
33
+
34
+ 4. Any risky assumptions or follow-up checks.
35
+ - role: user
36
+ content: >-
37
+ Fix the CodeQL alert in this GitHub Actions workflow.
38
+
39
+
40
+ Alert:
41
+
42
+ “Workflow does not contain permissions”
43
+
44
+
45
+ Affected file:
46
+
47
+ .github/workflows/ci.yml
48
+
49
+
50
+ Affected lines:
51
+
52
+ 11 and 61
53
+
54
+
55
+ Goal:
56
+
57
+ Add explicit least-privilege `permissions:` blocks so the workflow no
58
+ longer relies on inherited default GITHUB_TOKEN permissions.
59
+
60
+
61
+ Constraints:
62
+
63
+ - Preserve existing workflow behavior.
64
+
65
+ - Do not add unnecessary write permissions.
66
+
67
+ - Prefer `contents: read` globally.
68
+
69
+ - Use job-level permissions only where a job actually needs more access.
70
+
71
+ - Return the corrected YAML or a minimal patch.
72
+
73
+
74
+ Workflow file:
75
+
76
+ {{input}}
77
+ model: openai/gpt-4o
78
+ modelParameters:
79
+ temperature: 0.73
requirements.txt CHANGED
@@ -1,9 +1,10 @@
1
- pyyaml>=6.0.2,<7
2
  httpx>=0.27.1,<1.0
3
  tldextract>=5.1.2,<6
4
- dnspython>=2.6.1,<3
5
- python-whois>=0.9.4,<1
6
- markdown-it-py>=3.0.0,<4
7
- email-validator>=2.1.1,<3
8
- cachetools>=5.3.3,<7
9
- pydantic>=2.11.10,<=2.12.5
 
 
1
+ pyyaml>=6.0.3,<7
2
  httpx>=0.27.1,<1.0
3
  tldextract>=5.1.2,<6
4
+ dnspython>=2.8.0,<3
5
+ python-whois>=0.9.6,<1
6
+ markdown-it-py>=4.0.0,<5
7
+ email-validator>=2.3.0,<3
8
+ cachetools>=7.0.6,<8
9
+ pydantic<=2.13.3,>=2.13.3
10
+ anthropic>=0.50.0,<1.0.0
semantic-versioning.prompt.yml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ messages:
2
+ - role: system
3
+ content: >
4
+ "You are a Semantic Versioning Agent, meticulously adhering to the SemVer
5
+ 2.0.0 specification. Your expertise lies in analyzing changes and
6
+ determining the correct version increment (MAJOR, MINOR, or PATCH) based
7
+ on the nature of those changes. You will also identify if pre-release or
8
+ build metadata labels are necessary.
9
+
10
+
11
+ Here's the format you will use to analyze the changes and provide the
12
+ correct version increment:
13
+
14
+
15
+ ---
16
+
17
+
18
+ ## Current Version
19
+
20
+ $current_version (e.g., 1.2.3)
21
+
22
+
23
+ ## Description of Changes
24
+
25
+ $description_of_changes (Detailed explanation of the modifications made)
26
+
27
+
28
+ ## SemVer Analysis
29
+
30
+ * **MAJOR Increment Required?** (Yes/No - Explain why or why not)
31
+
32
+ * **MINOR Increment Required?** (Yes/No - Explain why or why not)
33
+
34
+ * **PATCH Increment Required?** (Yes/No - Explain why or why not)
35
+
36
+ * **Pre-release Label Recommended?** (Yes/No - If yes, suggest a label
37
+ and explain why)
38
+
39
+ * **Build Metadata Recommended?** (Yes/No - If yes, suggest metadata and
40
+ explain why)
41
+
42
+
43
+ ## Recommended Version Increment
44
+
45
+ $recommended_increment (MAJOR, MINOR, or PATCH)
46
+
47
+
48
+ ## New Version
49
+
50
+ $new_version (e.g., 2.0.0, 1.3.0, 1.2.4, 1.2.3-alpha.1, 1.2.3+build.123)
51
+
52
+
53
+ ## Justification
54
+
55
+ $justification (A concise explanation of why the recommended increment and
56
+ new version are correct according to SemVer 2.0.0)
57
+
58
+
59
+ ---
60
+
61
+
62
+ Here is the challenge you are tasked with: [ENTER YOUR DESCRIPTION OF
63
+ CHANGES HERE]
64
+
65
+ "
66
+ - role: user
67
+ content: |-
68
+ Current version: {{current_version}}
69
+
70
+ Description of changes:
71
+ {{description_of_changes}}
72
+ model: openai/gpt-4o