Skip to content

sync: mirror from thyn-ai/codna@64b0c1336370e4f575b0ffa1a70a11b1478fa4a1 - #41

Closed
0xamlab wants to merge 1 commit into
mainfrom
sync/64b0c1336370e4f575b0ffa1a70a11b1478fa4a1
Closed

0xamlab wants to merge 1 commit into
mainfrom
sync/64b0c1336370e4f575b0ffa1a70a11b1478fa4a1

Conversation

@0xamlab

@0xamlab 0xamlab commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Automated mirror of cli/ (flattened), the root allowlist (server.json, glama.json, LICENSE, .gitleaks.toml) and the public-root/ community tree from thyn-ai/codna at 64b0c1336370e4f575b0ffa1a70a11b1478fa4a1. Merges itself via auto-merge once the mirror's required checks (codna review, Analyze (python)) pass and the codna-ai review approves; if a later sync lands first, this PR is closed as superseded -- every sync PR is a full snapshot of the exported surface.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks for opening your first pull request in the Codna CLI! Please make sure the checks are green and that the change follows CONTRIBUTING.md. A maintainer will review it shortly.

@codna-ai codna-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codna review — 2 finding(s): 2 inline, 0 in summary.

Reply @codna fix on a finding to have Codna open a verified, test-green, risk-gated fix PR.

⏸ Not approved: 1 medium/high finding(s) in this review.

digest = hashlib.sha256(canonical.encode()).hexdigest()
episodes = _run_dir(active.runs_root, request.context.run_id) / "episodes"
episodes.mkdir(parents=True, exist_ok=True)
path = episodes / f"{request.context.task_id}.json"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM · security — Path traversal: task_id used unsanitized as filename in remember_episode

Line 841 constructs the episode file path as episodes / f"{request.context.task_id}.json". The task_id field is validated only by require_ref (checks non-empty, length ≤ 512, strips whitespace) which does NOT reject path-unsafe characters such as ../ or /. A task_id like ../../evil would cause the episode file to be written outside the intended <run>/episodes/ directory. While task_id comes from Temporal workflow history, it originates from CLI input that is only lightly validated via require_ref, not by a path-safety check.

Suggested change
path = episodes / f"{request.context.task_id}.json"
Replace `path = episodes / f"{request.context.task_id}.json"` with a check that the resolved path remains inside `episodes`, or strip path separators from `task_id` before constructing the filename: e.g., `safe = request.context.task_id.replace('/', '_').replace('..', '_')` and then use `episodes / f"{safe}.json"`. Alternatively, validate `task_id` against a stricter pattern (alphanumeric, hyphens, underscores only) in `require_ref` or at the `TaskSpec` boundary.

Reply @codna fix and Codna opens a verified, test-green, risk-gated fix PR.

Comment thread codna/durable/__init__.py
Comment on lines +102 to +106
DURABLE_RANGES: Final[dict[str, str]] = {
"temporalio": ">=1.34,<2",
"langgraph": ">=1,<2",
"langchain-core": ">=1,<2",
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ LOW · correctness — DURABLE_RANGES missing entry for langgraph-checkpoint

DURABLE_PINS defines four requirements including langgraph-checkpoint (minimum=(4,), maximum=(5,)), but DURABLE_RANGES only defines three entries and omits langgraph-checkpoint. When require_durable() finds an out-of-range langgraph-checkpoint version and constructs the error details (line 254: DURABLE_RANGES.get(requirement.distribution, "")), it reports range: "" instead of the actual range ">=4,<5". This makes the actionable error message less informative for operators trying to diagnose a version incompatibility.

Suggested change
DURABLE_RANGES: Final[dict[str, str]] = {
"temporalio": ">=1.34,<2",
"langgraph": ">=1,<2",
"langchain-core": ">=1,<2",
}
Add `"langgraph-checkpoint": ">=4,<5"` to the DURABLE_RANGES dict.

Reply @codna fix and Codna opens a verified, test-green, risk-gated fix PR.

@0xamlab

0xamlab commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #42 (a later thyn-ai/codna commit). Every sync PR is a full snapshot of the exported surface, so this one carries nothing #42 does not. Closing.

@0xamlab 0xamlab closed this Nov 5, 2026
auto-merge was automatically disabled November 5, 2026 05:49

Pull request was closed

@0xamlab
0xamlab deleted the sync/64b0c1336370e4f575b0ffa1a70a11b1478fa4a1 branch November 5, 2026 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant