@dzhechkov/skills-idea2prd 0.1.0 → 0.1.2

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.
@@ -3,7 +3,7 @@
3
3
  GOAP Research Planner with Ed25519 Verification
4
4
 
5
5
  Enhanced Goal-Oriented Action Planning for research tasks with
6
- cryptographic verification support for anti-hallucination protection.
6
+ cryptographic provenance and tamper-evidence support.
7
7
 
8
8
  Features:
9
9
  - A* search for optimal research paths
@@ -383,8 +383,8 @@ def find_research_plan(
383
383
  if goal_state.issubset(current_state):
384
384
  # Check if verification requirements are met
385
385
  if require_verification and current.unsigned_claims > 0:
386
- # In strict/paranoid mode, penalize but don't reject
387
- pass
386
+ # In strict/paranoid mode, unsigned or invalid claims are rejected.
387
+ continue
388
388
 
389
389
  # Reconstruct state progression
390
390
  states = [initial_state]
@@ -396,7 +396,7 @@ def find_research_plan(
396
396
 
397
397
  # Calculate confidence based on verification
398
398
  base_confidence = 1.0 - (current.unsigned_claims * 0.1)
399
- estimated_confidence = max(0.5, min(1.0, base_confidence))
399
+ estimated_confidence = min(1.0, base_confidence)
400
400
 
401
401
  return ResearchPlan(
402
402
  actions=current.actions,
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env python3
2
+ """Load-bearing security tests for ed25519_verifier.py."""
3
+
4
+ import copy
5
+ import unittest
6
+
7
+ import ed25519_verifier as ev
8
+
9
+
10
+ @unittest.skipIf(ev.CRYPTO_BACKEND is None, "No Ed25519 backend installed")
11
+ class Ed25519VerifierSecurityTests(unittest.TestCase):
12
+ def make_pinned_pair(self):
13
+ signer = ev.Ed25519Verifier(auto_generate_keypair=True)
14
+ verifier = ev.Ed25519Verifier(
15
+ trusted_issuers={
16
+ "nature.com": {
17
+ "pubkey_b64": signer.get_public_key_b64(),
18
+ "status": "active",
19
+ }
20
+ }
21
+ )
22
+ return signer, verifier
23
+
24
+ def test_attacker_self_signed_trusted_string_rejected(self):
25
+ _, verifier = self.make_pinned_pair()
26
+ attacker = ev.Ed25519Verifier(auto_generate_keypair=True)
27
+
28
+ fact = attacker.create_issuer_signed_fact(
29
+ claim="Fabricated result was published",
30
+ source_url="https://nature.com/articles/example",
31
+ source_content="attacker-controlled content",
32
+ issuer="nature.com",
33
+ )
34
+
35
+ result = verifier.verify_fact(fact)
36
+
37
+ self.assertFalse(result.verified)
38
+ self.assertEqual(result.confidence, 0.0)
39
+ self.assertNotEqual(result.confidence, 0.95)
40
+
41
+ def test_fact_signed_by_pinned_trusted_key_verifies(self):
42
+ signer, verifier = self.make_pinned_pair()
43
+
44
+ fact = signer.create_issuer_signed_fact(
45
+ claim="Pinned-key fact",
46
+ source_url="https://nature.com/articles/example",
47
+ source_content="source content",
48
+ issuer="nature.com",
49
+ )
50
+
51
+ result = verifier.verify_fact(fact)
52
+
53
+ self.assertTrue(result.verified)
54
+ self.assertEqual(result.trust_class, ev.TRUST_CLASS_ISSUER_SIGNED)
55
+ self.assertEqual(result.confidence, 0.95)
56
+
57
+ def test_relabelled_or_moved_fact_fails(self):
58
+ signer, verifier = self.make_pinned_pair()
59
+ fact = signer.create_issuer_signed_fact(
60
+ claim="Pinned-key fact",
61
+ source_url="https://nature.com/articles/example",
62
+ source_content="source content",
63
+ issuer="nature.com",
64
+ )
65
+
66
+ relabelled = copy.deepcopy(fact)
67
+ relabelled.issuer = "science.org"
68
+ relabelled_result = verifier.verify_fact(relabelled)
69
+
70
+ moved = copy.deepcopy(fact)
71
+ moved.source_url = "https://nature.com/articles/other"
72
+ moved_result = verifier.verify_fact(moved)
73
+
74
+ self.assertFalse(relabelled_result.verified)
75
+ self.assertEqual(relabelled_result.confidence, 0.0)
76
+ self.assertFalse(moved_result.verified)
77
+ self.assertEqual(moved_result.confidence, 0.0)
78
+
79
+ def test_reordered_citation_chain_fails(self):
80
+ signer, verifier = self.make_pinned_pair()
81
+ chain = ev.CitationChain(chain_id="test-chain")
82
+
83
+ for index in range(3):
84
+ chain.add_fact(
85
+ signer.create_issuer_signed_fact(
86
+ claim=f"Claim {index}",
87
+ source_url=f"https://nature.com/articles/{index}",
88
+ source_content=f"source content {index}",
89
+ issuer="nature.com",
90
+ )
91
+ )
92
+
93
+ signer.sign_chain(chain)
94
+ ok, _, error = verifier.verify_citation_chain(chain, signer.get_public_key_b64())
95
+ self.assertTrue(ok, error)
96
+
97
+ reordered = ev.CitationChain(
98
+ chain_id=chain.chain_id,
99
+ facts=[chain.facts[1], chain.facts[0], chain.facts[2]],
100
+ chain_signature=chain.chain_signature,
101
+ )
102
+ reordered_ok, _, reordered_error = verifier.verify_citation_chain(
103
+ reordered,
104
+ signer.get_public_key_b64(),
105
+ )
106
+
107
+ self.assertFalse(reordered_ok)
108
+ self.assertIn("Invalid", reordered_error)
109
+
110
+
111
+ if __name__ == "__main__":
112
+ unittest.main()