Skip to content

fix(dashboard): preserve macOS temp project paths - #14880

Merged
bolichen97 merged 2 commits into
mainfrom
fix/macos-temp-path-inrepo
Sep 29, 2026
Merged

bolichen97 merged 2 commits into
mainfrom
fix/macos-temp-path-inrepo

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A project rooted under macOS's per-user temp directory shows its real path in the dashboard's Git/Files panels instead of [REDACTED: credential].

On macOS, a project directory such as /private/var/folders/<2>/<30>/T/... is echoed to the dashboard through the project-git and project-tree endpoints. The generic bare-secret detector's character class includes /, so the whole temp path reads as one long high-entropy token and the credential gate collapses it to [REDACTED: credential]. The activity panel then shows the project as a redacted string even though both variable components of that prefix are OS-owned and fixed-width. Prior work (#5366) only moved pytest's temp base; the production egress path was never fixed.

Why it matters

Every macOS user whose project lives under the OS temp root sees a redacted, unusable path label in the dashboard Git and Files panels — the panels' one job (showing where the project is and what changed) is defeated for a whole platform, with no security benefit, since the redacted bytes are OS-generated and caller-fixed.

Not a goal

  • Does not change redaction on any non-macOS platform: off Darwin the canonical redactor decides alone.
  • Does not widen the exemption beyond the single fixed-shape /private/var/folders/<2>/<30>/T prefix.
  • Does not touch the branch label or repo-relative file-path redaction, which carry no OS-owned prefix.

What changed (motivation → approach → change)

  • Symptom: macOS temp-rooted project paths render as [REDACTED: credential] in the dashboard.
  • Root cause: redact()'s slash-including bare-secret regex treats the fixed-width, OS-generated /private/var/folders/<2>/<30>/T prefix as part of one 40+ char high-entropy run, tripping the credential gate.
  • Change: Add a path-aware wrapper _redact_project_path() used at the six absolute-path egress sites in files.py (repoRoot in project-git and project-git/status, echoed path in project-git, root in project-tree). It withholds only the OS-generated id from the credential scan and passes the entire user-controlled suffix through the canonical redact(). The split sits at the END of the variable region (the literal /T is handed to the redactor with the suffix), so every 40-byte window composed of fixed or user-controlled bytes is still scanned — the docstring records the boundary argument and the one measured residual (a slash-dense key, which the canonical redactor loses everywhere in the product anyway). The exemption is gated on platform_compat.IS_MACOS: off Darwin those bytes name nothing the OS owns, so a caller who can pick the project directory could otherwise place a credential in the one region never scanned.

Backwards compatibility

Compatible: on non-macOS platforms the wrapper is byte-identical to redact(). On macOS it only narrows a false positive (preserving an OS-owned prefix); it never widens what reaches the dashboard beyond what the canonical redactor would already pass on an ordinary path.

Tests

  • test/test_project_git.py: TestMacosPrefixBoundary pins the split boundary (a caller segment merely starting with T, e.g. /Tevil/project, is still redacted; the too-wide id is not preserved), the Darwin-only guard (off Darwin the helper equals redact() byte-for-byte and a self-flagged id is redacted), and test_a_slash_dense_key_is_treated_as_on_any_other_path (the residual slash-dense key gets the same treatment it gets on /srv/<key>, /tmp/<key>, /<key>). Restores the two deleted happy-path tests.
  • test/test_project_git_status_log.py: the status route's repoRoot and the tree route's root label the same path identically.
  • test/test_project_tree.py: the tree root takes the same macOS exemption; repo-relative paths do not.

Manual verification

N/A — unit coverage sufficient. The change is a pure egress-string transform with deterministic tests over both the Darwin and off-Darwin arms.

Screenshots / video

N/A — the diff touches only the backend egress redaction of a path string; no rendered frontend surface changes.

Related Issues

Supersedes #6905.

Pattern harvest

Not generalizable: this is a targeted, platform-specific false positive of the bare-secret detector against one fixed-shape OS temp prefix; the fix withholds only OS-generated bytes and is inherently scoped to that one prefix on one platform.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested a review from a team as a code owner September 29, 2026 00:17
@iamwhatever iamwhatever self-assigned this Sep 29, 2026
@iamwhatever iamwhatever added the drive-to-green PR claimed by drive-to-green pipeline label Sep 29, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 98625bf5b5f36cc52af649901bda26c62ed6794b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

No test ever feeds a real Darwin temp path through the fix — the regex's id shape is asserted only against hand-written fixtures.

Watch

The description grants "Manual verification: N/A" while the exemption's entire value is Darwin-only and, per its own words, "#5366 only moved pytest's temp base" — so on a real mac, tmp_path no longer lives under /var/folders and nothing anywhere exercises _MACOS_TEMP_PROJECT_PREFIX_RE against an OS-generated id. If Apple's real id width or alphabet differs from the fixture's {2}/{30} guess, the wrapper never matches, the panel keeps showing [REDACTED: credential], and every boundary test stays green.
Clears when: one run on a real mac shows /api/project/git returning the unredacted temp-rooted repoRoot, or a Darwin-only test asserts the regex matches os.path.realpath(tempfile.gettempdir()).

Suggestions

  • Add the self-verifying pin above (Darwin-only: regex fullmatch on realpath'd tempfile.gettempdir()); it converts the shape assumption into ground truth on every future mac test run at zero runtime cost.

[DESIGN-REVIEWED] 98625bf

Description read

[DESCRIPTION-READ] 64c4eda3bf660eee5d91db73c63671d4828e78b0a6ba62663db5d3a629ac0316

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 98625bf5b5f36cc52af649901bda26c62ed6794b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Confirm the restored happy-path tests ran on a real macOS machine: every exemption test flips IS_MACOS artificially, so only Darwin itself proves the id regex matches a genuine temp path.

What this change ships

Inventory (6 items) — 6 justified

Intent: FIX — a macOS temp-rooted project shows its real path in the dashboard's Git/Files panels instead of [REDACTED: credential].

  1. Git panel's repo root shows the real macOS temp path — justified
  2. Status route's repo root gets the identical treatment — justified
  3. Files tab's tree root (both arms, including not-a-directory) shows the real path — justified
  4. Project-git's echoed path (success and error arm) shows the real path — justified
  5. Two deleted happy-path tests (branch label, repo-root walk-up) restored — justified
  6. Spec sections for project-git/tree updated in the same commit — justified

The deleted base comment is fulfilled, not reversed: it prescribed exactly "a path-specific sanitizer at the call site", and the description declares the restoration. Sibling count: grepped redact\((slot|project|base|root|path|dir) across src/kiro_crew/dashboard — every absolute-path hit is in files.py and all six are converted; slot_projection.py ships project unredacted and api_browse_files never redacted, so 0 unfixed siblings. redact_path_segments is not an equivalent mechanism: it falls back to the whole-string result exactly where this false positive fires. _redact_project_path has 6 real consumers.

[FIRST-PRINCIPLES-REVIEWED] 98625bf

Description read

[DESCRIPTION-READ] 32ec3059c7d5d6cf56a20089394c2d815900c8bf0436ffc796c4948f2d6486ea

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ human override accepted

Human judgment by @iamwhatever overrides the GPT 5.6 finding for 98625bf5b5f36cc52af649901bda26c62ed6794b; the recorded reason is authoritative for this commit.

[GPT-OVERRIDE] 98625bf

This comment is updated in place on each push.

The model was not re-run because an authorized human decision supersedes it.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 98625bf5b5f36cc52af649901bda26c62ed6794b: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 98625bf5b5f36cc52af649901bda26c62ed6794b — this comment is updated in place on each push.

Review details

No blocking findings.

FINDING — src/kiro_crew/dashboard/handlers/files.py:6616 — prefix[:-2] + redact(prefix[-2:] + path[match.end():]) returns the [a-z0-9]{2}/[a-z0-9_]{30} id with no redaction pass over it at all, not just with the bare-secret scan withheld, so a fixed-pattern _CREDENTIAL_PATTERNS token that fits the 30-char slot (sk_live_/rk_test_ + 22 alnum, or npm_ + 26 — all inside [a-z0-9_]) is echoed verbatim where redact() masks it; the docstring's terminating argument ("the OS generates it and no caller can choose it") does not hold on the not_a_dir arms at :6739 and :8507, because _known_project_dirs re-validates nothing it reads from recent_projects.json (that file is on neither _SENSITIVE_HOME_DIRS nor _WRITE_PROTECTED_HOME_PATHS, so the agent's own edit tool may write it) and os.path.realpath on a path that does not exist is a no-op, so the withheld bytes reach the helper caller-chosen → Fix: scan the preserved head too rather than trusting its shape — head = prefix[:-2]; if redact(head) != head: return redact(path) — so the exemption can only ever suppress a bare-secret false positive, never a pattern match.

[OPUS-REVIEWED] 98625bf

Verdict parsed from the review's SHA-scoped output markers for commit 98625bf5b5f36cc52af649901bda26c62ed6794b.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 98625bf5b5f36cc52af649901bda26c62ed6794b: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 29, 2026
A project rooted under Darwin's per-user temp dir renders as
`[REDACTED: credential]` in the dashboard. The generic bare-secret
detector's character class includes `/`, so
`/private/var/folders/<2>/<30>/T/...` reads as one long high-entropy
token even though both variable components are OS-owned and fixed-width.

Give the six absolute-path egress sites in this file a path-aware
wrapper that withholds only the OS-generated id from the scan. Off
Darwin it is byte-identical to `redact`.

BOUNDARY. The split sits at the END of the variable region: the prefix
regex ends in the literal `/T`, and that literal is handed to the
canonical redactor along with the suffix. An AWS secret key may itself
contain `/`, so a window is a real credential candidate whenever every
byte in it is fixed or user-controlled -- `/T/` plus 37 user-controlled
characters is a well-formed 40-byte key. Scanning `/T` + suffix covers
every such window, so there is no further byte to concede: anything
reaching further left necessarily contains OS-generated id bytes that no
caller can choose.

Measured over ordinary project names, pytest temp-dir names, truncated
sha-256 digests and uuid hex (300 samples each, under both a
self-flagged and a non-self-flagged prefix): the boundary costs zero
additional redactions. The only names it newly redacts are
uniformly-random 37-38 character base64 runs, which the canonical
redactor already redacts on this path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@iamwhatever
iamwhatever force-pushed the fix/macos-temp-path-inrepo branch from 8975df9 to f9be88a Compare September 29, 2026 01:13
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 29, 2026
Review round on the rebased head raised one blocking finding and one
test-strength finding. Both are taken.

BLOCKING -- the exemption regex carried no platform guard, so the helper
withheld its two-component region from the credential scan on every OS.
Off Darwin `/private/var/folders/<id>/T` names nothing the OS owns: a
caller who can choose a project directory can choose those bytes
outright and put a credential-shaped run in the one region the helper
never scans. Gate the exemption on `platform_compat.IS_MACOS` so the
canonical redactor decides alone everywhere else. This also keeps the
exemption exactly as wide as the false positive it was measured against.

The Darwin-arm tests now flip `platform_compat.IS_MACOS` through an
`as_darwin` fixture rather than asserting a branch that only runs on one
runner, and two new cases pin the off-Darwin arm: the helper is the
canonical redactor byte for byte, and the self-flagged id is redacted
there instead of preserved. Both fail with the guard removed.

FINDING -- deleting the prefix regex's `(?=/|\Z)` lookahead left every
added case green, so the boundary was unproven: a caller-chosen segment
merely STARTING with `T` would have been exempted. The similar-path test
is now parametrized over `/Tevil/project` and `/Tevil` alongside the
too-wide id, and both new cases fail with the lookahead deleted.

DOCSTRING ACCURACY -- re-measuring the boundary contract found one claim
in it too strong. It said the two rejected splits each produced a class
where `redact(path) != path` while the helper returned `path` unchanged,
implying the shipped split produces none. It produces one, at roughly 3
in 1000 sampled caller layouts: a 40-char key carrying more than
`_SECRET_MAX_SLASHES` separators. Standalone such a key is masked,
because a 40-char run is the token somebody wrote and the separator
ceiling is deliberately not applied to it; prepending `/T` makes the
scanned run longer than one whole key, which is the condition that
switches the ceiling on, and every window is then declined.

That residual is not a weakening, and the control says why: the same key
also survives the canonical redactor on an ordinary deep path with no
exemption anywhere near it -- 387/400 sampled keys on `/srv/<key>`,
400/400 on `/<key>`. The separator ceiling loses slash-dense keys
everywhere in the product, so the helper is no weaker than the treatment
the same key already gets elsewhere. Canonical's hit on the full temp-root
path comes from an id-straddling window clearing the ceiling -- it masks
the key via the very false positive this exemption removes, not by
recognising it.

The docstring now states that residual and its control, and a new test
pins the property as an EQUIVALENCE against the ordinary-path behaviour
rather than blessing an outcome, so it fails if either side moves. It
fails with the exemption removed.

No behaviour change on macOS, and no change to the split.
@iamwhatever
iamwhatever force-pushed the fix/macos-temp-path-inrepo branch from f9be88a to 98625bf Compare September 29, 2026 02:16
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 29, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 98625bf: Reaching it needs macOS, a credential the agent already holds re-encoded as a 4+-level nested directory tree under the OS-generated temp root, registered as an allow-listed project and a git root; the decline comes from the canonical redactor's own fragment ceiling (redaction.py:859), which loses the same key on any deep path (control pinned at test/test_project_git.py:808-810), so the helper is at exact parity with the product and the proposed fix would add a stricter-than-canonical policy in this one helper without closing the class.

@github-actions

Copy link
Copy Markdown
Contributor

AI-review override not recorded: keep the reason to 500 characters or fewer.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 98625bf: Reaching it needs macOS, a credential the agent already holds re-encoded as a 4+-level nested directory tree under the OS-generated temp root, registered as an allow-listed project and a git root; the decline comes from the canonical redactor's own fragment ceiling (redaction.py:859), which loses the same key on any deep path (control pinned at test/test_project_git.py:808-810), so the helper is at exact parity with the product and the proposed fix would add a stricter-than-canonical policy in this one helper without closing the class.

@github-actions

Copy link
Copy Markdown
Contributor

AI-review override not recorded: keep the reason to 500 characters or fewer.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 98625bf: macOS-only exemption gated on IS_MACOS. Reaching it needs macOS, a credential the agent already holds re-encoded as a 4+-level nested dir tree under the OS temp root, and that tree registered as an allow-listed git project. Opus 5 adjudged exposure nil: the decline is the canonical redaction fragment ceiling, which loses the same key on any deep path. Same finding was overridden on fork #6905.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 98625bf5b5f36cc52af649901bda26c62ed6794b.

macOS-only exemption gated on IS_MACOS. Reaching it needs macOS, a credential the agent already holds re-encoded as a 4+-level nested dir tree under the OS temp root, and that tree registered as an allow-listed git project. Opus 5 adjudged exposure nil: the decline is the canonical redaction fragment ceiling, which loses the same key on any deep path. Same finding was overridden on fork #6905.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 29, 2026
@github-actions github-actions Bot added the readiness: passed Eligible automated validation passed for the current revision label Sep 29, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed on behalf of the maintainers (readiness sweep 2026-09-29, round 7): readiness passed, required check green on the current head, no live CHANGES_REQUESTED, no open blocking review threads, security posture reviewed. Approving and merging (squash).

@bolichen97
bolichen97 merged commit 6a20cf4 into main Sep 29, 2026
142 of 144 checks passed
@bolichen97
bolichen97 deleted the fix/macos-temp-path-inrepo branch September 29, 2026 07:31
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 29, 2026
@chenmingwei23 chenmingwei23 removed the drive-to-green PR claimed by drive-to-green pipeline label Sep 29, 2026
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.

4 participants