1. Purpose
Зафиксировать факт реализации единого reusable URL/security boundary перед любым network action.
TASK-002 должен доказать, что crawler не может обращаться к localhost/private/link-local/metadata/internal targets,
не может обойти guard через redirects или DNS tricks и не смешивает security policy с crawl scope policy.
Этот документ сам по себе не является security proof. Нужны реальные tests и evidence из runtime/repo.
2. Entry gate
| Requirement | Expected | Actual | Evidence |
| TASK-001 result | VERIFIED | REAL_VALUE | REAL_REF |
| Domain contracts available | YES | REAL_VALUE | REAL_REF |
| Real repo/runtime known | YES | REAL_VALUE | REAL_REF |
| Approved networking/client assumptions known | YES | REAL_VALUE | REAL_REF |
Если TASK-001 ≠ VERIFIED, TASK-002 execution result остаётся BLOCKED.
3. Execution identity
| Field | Value |
| Project | Autonomous Site Research Pipeline / Statiya_poluchatel_1 |
| Window | AW-01 |
| Task | TASK-002 |
| Specification | EXEC-27 — URL Normalization + Public-Web Security Guard |
| Evidence document | EXEC-41 |
| Result | UNFILLED / BLOCKED UNTIL TASK-001 VERIFIED |
| Executed by | REAL_VALUE |
| Started / completed | REAL_VALUE |
4. Environment facts
REPO_ROOT=REAL_VALUE
BRANCH=REAL_VALUE
REVISION_BEFORE=REAL_VALUE
REVISION_AFTER=REAL_VALUE
LANGUAGE_RUNTIME=REAL_VALUE
URL_LIBRARY=REAL_VALUE
IP_LIBRARY=REAL_VALUE
DNS_RESOLVER=REAL_VALUE
HTTP_CLIENT=REAL_VALUE
TEST_RUNNER=REAL_VALUE
TASK_001_EVIDENCE_REF=REAL_VALUE
START_PROJECT_REF=REAL_VALUE
PROJECT_STATE_REF=REAL_VALUE
5. Reuse-before-build review
| Capability | Existing? | Action | Ref |
| URL parser | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| URL normalizer | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| IP classification helper | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| DNS resolver wrapper | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| Redirect policy hook | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
| Scope matcher | REAL_VALUE | REUSE / EXTEND / CREATE | REAL_REF |
6. Changed files
[
{
"path": "REAL_PATH",
"change_type": "ADDED | MODIFIED | DELETED",
"purpose": "REAL_DESCRIPTION"
}
]
Bounded scope
- URL parse/normalize;
- scheme validation;
- host/IDNA handling;
- IP safety;
- DNS validation;
- redirect target validation;
- scope decision primitive;
- reason codes/tests.
Must not appear
- crawler worker;
- queue;
- HTML parser;
- classifier;
- renderer;
- deploy logic.
7. Security surface implemented
| Component | Status | Ref | Notes |
| NormalizedUrl | REAL_VALUE | REAL_REF | REAL_VALUE |
| SecurityDecision | REAL_VALUE | REAL_REF | REAL_VALUE |
| ScopeDecision | REAL_VALUE | REAL_REF | REAL_VALUE |
| IP safety classifier | REAL_VALUE | REAL_REF | REAL_VALUE |
| DNS result validator | REAL_VALUE | REAL_REF | REAL_VALUE |
| Redirect validator | REAL_VALUE | REAL_REF | REAL_VALUE |
| Scope matcher | REAL_VALUE | REAL_REF | REAL_VALUE |
8. URL normalization evidence
Expected behavior
- lowercase scheme/host;
- IDNA canonical host representation;
- remove fragment;
- default port normalization;
- preserve meaningful query;
- reject userinfo;
- reject malformed/empty host;
- conservative path normalization;
- no SEO canonicalization in security layer.
{
"normalization_tests": {
"case_normalization": "PASS | FAIL",
"default_ports": "PASS | FAIL",
"fragment_removal": "PASS | FAIL",
"query_preservation": "PASS | FAIL",
"userinfo_reject": "PASS | FAIL",
"idna": "PASS | FAIL",
"malformed_url": "PASS | FAIL"
},
"evidence_refs": []
}
9. Scheme / host / IP safety
Allowed schemes
http
https
Required rejects
file:
data:
javascript:
ftp:
ftps:
gopher:
ws:
wss:
mailto:
tel:
blob:
about:
chrome:
Required unsafe target classes
- localhost;
- 127.0.0.0/8;
- ::1;
- RFC1918 private IPv4;
- link-local;
- unspecified;
- multicast;
- reserved/special-use;
- metadata targets;
- IPv4-mapped IPv6 resolving to unsafe IPv4;
- IPv6 zone-local forms.
10. DNS / rebinding evidence
Required proof
- all resolved A/AAAA addresses are checked;
- mixed public/private result fails closed;
- DNS failure is explicit;
- request-time revalidation contract exists;
- validated target cannot silently be replaced by independent unsafe re-resolution.
Critical review field
DNS_CONNECT_TOCTOU_MITIGATION:
IMPLEMENTED | BLOCKED | NOT_PROVEN
METHOD:
REAL_VALUE
EVIDENCE:
REAL_REF
Если DNS-check и фактический connect не связаны безопасным transport mechanism,
TASK-002 нельзя считать полностью VERIFIED.
11. Redirect handling evidence
Каждый redirect target должен пройти полный guard заново.
Tests
- public → public valid redirect;
- public → localhost reject;
- public → private IP reject;
- public → metadata target reject;
- redirect to unsupported scheme reject;
- redirect loop detect;
- redirect limit enforce;
- scope escape reject where policy requires.
{
"redirect_tests": {
"safe_redirect": "PASS | FAIL",
"private_target": "PASS | FAIL",
"unsupported_scheme": "PASS | FAIL",
"loop": "PASS | FAIL",
"limit": "PASS | FAIL",
"scope_escape": "PASS | FAIL"
}
}
12. Security vs crawl scope
Evidence должно показать, что две проверки разделены:
SecurityDecision:
Is this target safe/public-web?
ScopeDecision:
Is this safe target allowed by this CrawlPlan?
Required scenarios
- public same-origin → security ALLOW + scope IN_SCOPE;
- public external domain → security ALLOW + scope OUT_OF_SCOPE;
- private target → security REJECT, scope irrelevant;
- allowed subdomain behavior follows explicit policy;
- suffix matching respects DNS labels.
13. Tests executed
| Test group | Command | Result | Evidence |
| URL normalization | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Scheme allowlist | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Host/IDNA | REAL_COMMAND | PASS / FAIL | REAL_REF |
| IPv4 safety | REAL_COMMAND | PASS / FAIL | REAL_REF |
| IPv6 safety | REAL_COMMAND | PASS / FAIL | REAL_REF |
| DNS all-address validation | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Mixed public/private DNS | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Redirect chain | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Scope matcher | REAL_COMMAND | PASS / FAIL | REAL_REF |
| Regression suite | REAL_COMMAND | PASS / FAIL | REAL_REF |
14. Negative / attack-case matrix
| Input / attack | Expected | Actual |
| http://127.0.0.1/ | REJECT_LOOPBACK_IP | REAL_VALUE |
| http://[::1]/ | REJECT_LOOPBACK_IP | REAL_VALUE |
| http://10.0.0.1/ | REJECT_PRIVATE_IP | REAL_VALUE |
| http://169.254.169.254/ | REJECT_METADATA_TARGET / link-local reject | REAL_VALUE |
| file:///etc/passwd | REJECT_UNSUPPORTED_SCHEME | REAL_VALUE |
| http://user:pass@example.com/ | REJECT_USERINFO | REAL_VALUE |
| DNS → private IP | REJECT_DNS_PRIVATE_RESULT | REAL_VALUE |
| DNS mixed public/private | REJECT_DNS_MIXED_UNSAFE_RESULT | REAL_VALUE |
| redirect → private | REJECT before connect | REAL_VALUE |
| IPv4-mapped IPv6 private | REJECT | REAL_VALUE |
15. Acceptance checklist
| Acceptance item | Result | Evidence |
| Only HTTP/HTTPS allowed | PASS / FAIL | REAL_REF |
| Local/private/link-local/metadata blocked | PASS / FAIL | REAL_REF |
| IPv6 special cases covered | PASS / FAIL | REAL_REF |
| All DNS addresses validated | PASS / FAIL | REAL_REF |
| Mixed DNS results fail closed | PASS / FAIL | REAL_REF |
| DNS/connect TOCTOU mitigation proven | PASS / FAIL | REAL_REF |
| Every redirect revalidated | PASS / FAIL | REAL_REF |
| Redirect loops/limits handled | PASS / FAIL | REAL_REF |
| Security and scope separated | PASS / FAIL | REAL_REF |
| Stable reason codes preserved | PASS / FAIL | REAL_REF |
| No unrelated subsystem added | PASS / FAIL | REAL_REF |
| Regression tests pass | PASS / FAIL | REAL_REF |
16. Gaps / blockers
{
"security_blockers": [],
"known_gaps": [],
"unproven_assumptions": [],
"blocks_TASK_003": true
}
Automatic blockers
- private target reachable;
- redirect validation bypass;
- DNS/connect TOCTOU unmitigated;
- unsafe scheme accepted;
- userinfo accepted;
- mixed public/private DNS accepted;
- scope security conflated in a way that lets unsafe targets pass.
17. Final result
VERIFIED
PARTIAL
FAILED
BLOCKED
| Result | Meaning |
| VERIFIED | All critical security acceptance tests PASS; no blocker remains. |
| PARTIAL | Most functionality works, but one bounded non-critical requirement/evidence item remains. |
| FAILED | Security invariant/test fails. |
| BLOCKED | Cannot prove/implement required transport/runtime behavior. |
Для security boundary сомнение по критичному пункту трактуется как BLOCKED/FAILED, а не как «вероятно работает».
18. Project state update
If VERIFIED
{
"active_window_id": "AW-01",
"last_verified_task": "TASK-002",
"completed_tasks": ["TASK-001", "TASK-002"],
"current_task_id": "TASK-003",
"last_evidence_ref": "EXEC-41_FILLED_REAL_REF",
"repo_revision": "REAL_REVISION_AFTER",
"open_blockers": [],
"state_version": "INCREMENT_REAL_VALUE"
}
If not VERIFIED
{
"current_task_id": "TASK-002",
"last_task_result": "PARTIAL | FAILED | BLOCKED",
"open_blockers": ["..."],
"next_action": "TASK_002_REPAIR_OR_TRANSPORT_REVIEW"
}
19. Canonical machine-readable result
{
"schema": "STATIYA_TASK_EXECUTION_EVIDENCE",
"schema_version": "1.0",
"project_id": "autonomous-site-research-pipeline",
"active_window_id": "AW-01",
"task_id": "TASK-002",
"packet_ref": "EXEC-27",
"evidence_document_ref": "EXEC-41",
"result": "BLOCKED_UNTIL_TASK_001_VERIFIED",
"task_001_evidence_ref": "REAL_VALUE",
"repo": {
"root": "REAL_VALUE",
"revision_before": "REAL_VALUE",
"revision_after": "REAL_VALUE"
},
"changed_files": [],
"reused_components": [],
"created_components": [],
"tests": [],
"acceptance_checks": [],
"security_blockers": [],
"known_gaps": [],
"next_task_allowed": false,
"next_task_id_if_verified": "TASK-003",
"next_packet_if_verified": "EXEC-28",
"created_at": "REAL_VALUE"
}
20. Next exact action
Этот template можно заполнить только после реального TASK-001 = VERIFIED и исполнения EXEC-27.
If TASK-002 = VERIFIED
Следующий execution step:
TASK-003 / EXEC-28 — Persistent Job State + Transition Guard.
If TASK-002 ≠ VERIFIED
Создать bounded security repair/transport review и не переходить к TASK-003.