fix(security): add config.json and config.local.json to bash write-protect list - #6072
fix(security): add config.json and config.local.json to bash write-protect list#6072aniruddhaadak80 wants to merge 5 commits into
Conversation
Upstream landed the canonical spelling, security.redact_and_truncate (redact the FULL text, then cut), and converted most of the sites this branch originally covered; the rebased delta carries what remains: - cron_script._stderr_tail redacts a bounded span (the last _STDERR_TAIL_REDACT_SPAN bytes) BEFORE tail-slicing, so a key straddling the old seek-to-size-minus-limit window start no longer loses its anchoring prefix, while redaction stays O(span) per call: an adversarial subprocess cannot stall the worker by stuffing its stderr with credential-shaped tokens. Captures beyond _STDERR_FULL_REDACT_MAX are withheld behind a fixed marker instead. Tests pin the behaviors: a straddling key is scrubbed within budget, an oversized capture is withheld behind the marker, and the text handed to redact never exceeds the span regardless of capture size.
…lize helper The complete() helper's >/dev/null 2>&1 hides gh's actual HTTP error when a check-run finalize permanently fails. The ::warning:: line names the check-run but cannot carry the underlying error, leaving operators with no diagnostic. Remove the stderr suppression so the real error reaches the job log. Fixes kirodotdev#5822
…approval rollback When an approval POST fails in CollapsibleToolGroup.submitDecision, the rollback path was silent — it only did console.error and setLocalResolved(null), leaving the row flipped back with zero on-screen explanation and keyboard focus dropped to <body>. Mirror ApprovalCard's existing error/focus pattern: - Track failure state with terminal/message/attempted fields - Render ErrorNotice inline on rollback with the same i18n keys as ApprovalCard - Restore keyboard focus to the button matching the failed decision via useEffect - Reset failure state when permission props change Fixes kirodotdev#5554
_add_job_kwargs was a closed allowlist that omitted timezone, so add_job / add_job_async / add_job_if_absent_async silently dropped it. The job was persisted without a timezone and resolved to UTC at fire time. Thread timezone through _add_job_kwargs and all three create methods. CronService.add_job already accepts and validates the field, so the single locked build+persist invariant holds. Closes kirodotdev#6014
…otect list config.json and config.local.json are in _WRITE_PROTECTED_HOME_PATHS (file-edit tool) but missing from _WRITE_PROTECTED_BASH_LEAVES (shell tool). The comment at line 5179 states 'protected on one path only is not protected', yet these two leaves were absent from the bash gate. An agent can overwrite config.json via shell despite the edit-tool fence, bypassing security-relevant resource ceilings. Fixes kirodotdev#4956
bolichen97
left a comment
There was a problem hiding this comment.
Blocking: the description says this PR only adds config.json and config.local.json to the bash write-protect list in security.py, but the current head contains five commits and also changes a fork review workflow, cron SDK/script behavior and tests, a dashboard approval UI, and other unrelated security logging work. Please split/rebase away the unrelated commits or rewrite the description and evidence to cover the exact current diff.
|
Full-diff/commit-containment audit (current head Please split or retarget this chain: keep the redaction (#5603) and fork-review (#6031) work in their owners; choose one |
|
Thanks for the precise audit, @bolichen97 — re-running through your points on the current main head: Chain absorption (audit confirmed):
On 5a134fd (config/config.local.json bash write-protect): Plan:
If you'd prefer a different split (e.g. keep the bash-config commit and route through _BARE_TOKEN_PROTECTED_LEAVES discussion instead), let me know — happy to retarget. Re-requesting review on the cron-timezone PR after it lands; closing this thread once #6072 is closed. |
|
Closing as stale. The absorbed upstream commits (#5603, #6031, #6065) are already in main. The config-bash-write-protect commit (5a134fd) adds config.json to _WRITE_PROTECTED_BASH_LEAVES, which contradicts upstream design intent (config.json is generic and must never be added to bash leaves — see src/kiro_crew/security.py lines 5399-5403). See the diagnostic comment above. If the CronSDK timezone fix (718dd2c4c) is still needed, please reopen as a fresh PR against current main. |
Pull request was closed
Problem / Motivation
config.jsonandconfig.local.jsonare in_WRITE_PROTECTED_HOME_PATHS(denying the file-EDIT tool) but missing from_WRITE_PROTECTED_BASH_LEAVES(denying shell writes). The comment atsecurity.py:5179explicitly states "protected on one path only is not protected", yet these two leaves were absent from the bash gate. An agent can overwriteconfig.jsonviaecho forged > config.jsondespite the edit-tool fence, bypassing security-relevant resource ceilings.Why it matters
config.jsonholds security-relevant resource ceilings. An agent that can rewrite it via shell can escalate its own limits. The codebase explicitly calls out the pairing requirement in comments but never enforced it for these two leaves.What changed (motivation -> approach -> change)
Added
"config.json"and"config.local.json"to_WRITE_PROTECTED_BASH_LEAVESinsrc/kiro_crew/security.py, alongside the existing entries. This closes the gap between the edit-tool fence and the shell-tool fence, matching the pattern already established byplaywright-cli-config.json.Tests
test_denied_commands_security.pypass (includes config.json path coverage)config.jsonandconfig.local.jsonas protected leavesManual verification
is_sensitive_bash_commandnow rejectsecho > config.json,cp x config.json, andtee config.jsoncat config.json) remain allowedRelated Issues
Fixes #4956
Checklist