codeimprint 0.5.0a31__tar.gz → 0.5.0a32__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.
Files changed (26) hide show
  1. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/CHANGELOG.md +16 -0
  2. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/PKG-INFO +5 -3
  3. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/README.pypi.md +4 -2
  4. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/pyproject.toml +1 -1
  5. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/__init__.py +1 -1
  6. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/api.py +11 -5
  7. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/cli.py +18 -2
  8. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/.gitignore +0 -0
  9. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/LICENSE +0 -0
  10. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/NOTICE +0 -0
  11. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint/__init__.py +0 -0
  12. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint/__main__.py +0 -0
  13. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/__main__.py +0 -0
  14. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/chainseal.py +0 -0
  15. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/config.py +0 -0
  16. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/gitrepo.py +0 -0
  17. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/imprint_file.py +0 -0
  18. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/linecount.py +0 -0
  19. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/ownership.py +0 -0
  20. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/project.py +0 -0
  21. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/receipt.py +0 -0
  22. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/records.py +0 -0
  23. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/timestamp.py +0 -0
  24. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/transparency.py +0 -0
  25. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/trust.py +0 -0
  26. {codeimprint-0.5.0a31 → codeimprint-0.5.0a32}/src/codeimprint_cli/tsa_roots.py +0 -0
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0a32 — Signed organisation requests [CIM-BE-48-v1]
4
+
5
+ For engine 0.7.0a38, which needs them (audit 42f-01, 42f-03).
6
+
7
+ - **Changed: `imprint org domain` and `imprint org disclose` sign their request** with the
8
+ organisation's admin key: canonical JSON `{type, org, domain, at}` with
9
+ `codeimprint.org-domain-request.v1` or `codeimprint.org-disclosure-request.v1` and the
10
+ current UTC time. The disclosure document is now asked for with a POST. Older clients get
11
+ "No such organisation" from engine 0.7.0a38. With an engine before 0.7.0a38, `imprint org
12
+ domain` still works (the signature is ignored), but `imprint org disclose` gets 405 (those
13
+ engines serve the document only by GET): use 0.5.0a31 for it until the engine is updated.
14
+ - Docs: the README and the PyPI page say what a Git seal sends besides file contents (paths,
15
+ Git IDs, commit and repository IDs, kept as keyed hashes), and that only a seal signed
16
+ with your developer key cannot be forged by the operator (42e-07, 42e-08).
17
+ - Tests: `tests/test_org_commands.py`.
18
+
3
19
  ## 0.5.0a31 — Newer formats, expired identities, INT1 v2 [CIM-BE-45-v1]
4
20
 
5
21
  For engine 0.7.0a36.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codeimprint
3
- Version: 0.5.0a31
3
+ Version: 0.5.0a32
4
4
  Summary: CodeImprint: seal your code with a CodeImprint server (tamper-evident, logged and timestamped) and verify seals offline.
5
5
  Project-URL: Homepage, https://codeimprint.ai
6
6
  Project-URL: Hub, https://app.codeimprint.ai
@@ -94,8 +94,10 @@ evidence, not proof), `imprint chain`, `imprint hook install`, `imprint identity
94
94
 
95
95
  ## What leaves your machine
96
96
 
97
- `imprint seal` and `imprint check` upload the project's files to the CodeImprint server you
98
- signed in to, which fingerprints them and deletes them at once; only the Imprint is kept.
97
+ `imprint seal` and `imprint check` upload the project's Python files to the CodeImprint
98
+ server you signed in to, which deletes them as soon as it has sealed or checked them. A Git
99
+ seal also sends the paths and Git IDs of tracked files and the commit and repository IDs;
100
+ the server keeps those only as keyed hashes, with the seal.
99
101
  Your developer key never leaves your machine: only its public half is sent.
100
102
 
101
103
  ## Licence
@@ -60,8 +60,10 @@ evidence, not proof), `imprint chain`, `imprint hook install`, `imprint identity
60
60
 
61
61
  ## What leaves your machine
62
62
 
63
- `imprint seal` and `imprint check` upload the project's files to the CodeImprint server you
64
- signed in to, which fingerprints them and deletes them at once; only the Imprint is kept.
63
+ `imprint seal` and `imprint check` upload the project's Python files to the CodeImprint
64
+ server you signed in to, which deletes them as soon as it has sealed or checked them. A Git
65
+ seal also sends the paths and Git IDs of tracked files and the commit and repository IDs;
66
+ the server keeps those only as keyed hashes, with the seal.
65
67
  Your developer key never leaves your machine: only its public half is sent.
66
68
 
67
69
  ## Licence
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
  # Published on PyPI as `codeimprint`. The import package stays `codeimprint_cli` and the
7
7
  # command `imprint`.
8
8
  name = "codeimprint"
9
- version = "0.5.0a31"
9
+ version = "0.5.0a32"
10
10
  description = "CodeImprint: seal your code with a CodeImprint server (tamper-evident, logged and timestamped) and verify seals offline."
11
11
  readme = "README.pypi.md"
12
12
  license = "Apache-2.0"
@@ -5,4 +5,4 @@ A thin client for a CodeImprint server: it zips a project, asks the server to se
5
5
  it, and verifies Imprint files offline. All analysis happens on the server.
6
6
  """
7
7
 
8
- __version__ = "0.5.0a31"
8
+ __version__ = "0.5.0a32"
@@ -447,17 +447,23 @@ class Client:
447
447
  return self._json("POST", "/api/v1/orgs", {"public_key": public_key,
448
448
  "signature": signature})
449
449
 
450
- def org_domain_challenge(self, org: str, domain: str, public_key: str) -> dict:
450
+ def org_domain_challenge(self, org: str, domain: str, public_key: str, at: str,
451
+ signature: str) -> dict:
452
+ """The admin's signed request (engine 0.7.0a38+)."""
451
453
  return self._json("POST", f"/api/v1/orgs/{quote(org)}/domains",
452
- {"domain": domain, "public_key": public_key})
454
+ {"domain": domain, "public_key": public_key, "at": at,
455
+ "signature": signature})
453
456
 
454
457
  def org_domain_verify(self, org: str, domain: str, signature: str) -> dict:
455
458
  return self._json("POST", f"/api/v1/orgs/{quote(org)}/domains/verify",
456
459
  {"domain": domain, "signature": signature})
457
460
 
458
- def org_disclosure_document(self, org: str, domain: str) -> dict:
459
- return self._json("GET", f"/api/v1/orgs/{quote(org)}/disclosures/document?domain="
460
- f"{quote(domain)}")
461
+ def org_disclosure_document(self, org: str, domain: str, public_key: str, at: str,
462
+ signature: str) -> dict:
463
+ """The admin's signed request (engine 0.7.0a38+; a GET before)."""
464
+ return self._json("POST", f"/api/v1/orgs/{quote(org)}/disclosures/document",
465
+ {"domain": domain, "public_key": public_key, "at": at,
466
+ "signature": signature})
461
467
 
462
468
  def org_disclose(self, org: str, domain: str, public_key: str, signature: str) -> dict:
463
469
  return self._json("POST", f"/api/v1/orgs/{quote(org)}/disclosures",
@@ -1111,6 +1111,18 @@ def _now_iso() -> str:
1111
1111
  return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
1112
1112
 
1113
1113
 
1114
+ # The organisation admin's signed requests (engine 0.7.0a38): only the admin key's fresh
1115
+ # signature over {type, org, domain, at} gets a domain challenge or a disclosure document.
1116
+ ORG_DOMAIN_REQUEST = "codeimprint.org-domain-request.v1"
1117
+ ORG_DISCLOSURE_REQUEST = "codeimprint.org-disclosure-request.v1"
1118
+
1119
+
1120
+ def _org_request(key, kind: str, org: str, domain: str) -> tuple[str, str]:
1121
+ """(at, signature) for the admin's request; ``at`` is now, UTC."""
1122
+ at = _now_iso()
1123
+ return at, chainseal.sign(key, {"type": kind, "org": org, "domain": domain, "at": at})
1124
+
1125
+
1114
1126
  def _session_client(args) -> Client:
1115
1127
  settings = config.resolve(getattr(args, "url", None))
1116
1128
  if not settings.url:
@@ -1618,7 +1630,9 @@ def cmd_org(args) -> int:
1618
1630
  raise Abort(f"{args.action}: name the domain")
1619
1631
  try:
1620
1632
  if args.action == "domain":
1621
- ch = client.org_domain_challenge(org, args.target, pub)
1633
+ ch = client.org_domain_challenge(org, args.target, pub,
1634
+ *_org_request(key, ORG_DOMAIN_REQUEST, org,
1635
+ args.target))
1622
1636
  path = _challenge_path(org, _ascii_domain(ch["domain"]))
1623
1637
  path.parent.mkdir(parents=True, exist_ok=True)
1624
1638
  path.write_text(json.dumps(ch, indent=1) + "\n", encoding="utf-8")
@@ -1647,7 +1661,9 @@ def cmd_org(args) -> int:
1647
1661
  f"imprint org disclose {org} {ch['domain']}")
1648
1662
  return 0
1649
1663
  if args.action == "disclose":
1650
- doc = client.org_disclosure_document(org, args.target)
1664
+ doc = client.org_disclosure_document(org, args.target, pub,
1665
+ *_org_request(key, ORG_DISCLOSURE_REQUEST,
1666
+ org, args.target))
1651
1667
  _checked_digest(doc["document"], doc["digest"], doc["statement"])
1652
1668
  _say(f"Disclose {doc['document']['value']} for organisation {org}: from now on it "
1653
1669
  "is public, and the organisation is shown as \"verified domain "
File without changes
File without changes