Skip to content

fix(security): keep a quoted newline inside its word on the push path - #15438

Closed
Maqix wants to merge 1 commit into
kirodotdev:mainfrom
Maqix:fix/push-floor-quoted-newline
Closed

Maqix wants to merge 1 commit into
kirodotdev:mainfrom
Maqix:fix/push-floor-quoted-newline

Conversation

@Maqix

@Maqix Maqix commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A literal feature-branch push in the same shell call as a multi-line git commit message is allowed when the call has exactly the shape the reported #12631 commands use: segments cd <dir> or git add/commit/push, flags only commit -m/-q and push -u/-q, and a literal single- or double-quoted message. Every other shape (add -A, commit -am/-s, --set-upstream, cd ~/r, a $ in a double-quoted body, a redirect) is refused as on main, with the "push on its own line" hint where that retry passes; see the event replay under Backwards compatibility.

git commit -m '<subject>⏎⏎<body>'; git push -u fork fix/x is refused with rule=git-publish-target-unverifiable, and the reason says "shell substitution or expansion fuses text into the push target" even though nothing does. I hit this today on current main. @bolichen97 traced the mechanism on #12631: _split_push_command_segments ends a segment at every newline, including one inside quotes. The next segment's quote walk restarts unquoted, so the message's closing quote is read as an opener, and that quote swallows the following && / ;. The push segment becomes one unparseable word and lands on the ungated sentinel.

Why it matters

Multi-line commit messages are the normal way agents write commits. Every such commit chained to a push is refused with a reason that points at a defect the command doesn't have, so the operator or agent can't tell which token to change. The same misreading also hides the real reason for a protected push: git commit -m "a⏎⏎b" && git push origin main is refused as target-unverifiable rather than push-protected-branch-name.

Not a goal

This allowlist is the base those follow-ups extend, not a one-off: #20847's fix (PR #20854, stacked on this one) widens _inert_segment by one prefix and adds its own oracle rows, and any further shape goes the same way, one allowlist entry plus a real-bash oracle row.

These are why the PR uses Refs #12631 rather than a closing keyword.

Backwards compatibility

Reader: argv_floor_git.py:_git_publish_floor_tags is the splitter's only production caller. The splitter change is load-bearing: with only keep_quoted_newlines off, the reporter's command and event 7 are refused (test_the_splitter_keeping_a_quoted_newline_is_what_allows_the_reported_command).

Compatible: the gate moves in the allow direction only, for a literal unprotected push chained after a git commit whose shape fits the allowlist under What changed. An opener inside a plain single quote (git commit -m 'fix `foo` ...') is literal to bash and keeps the trust. Every other shape reads exactly as on main (see Tests).

Still refused, as on main plus the new hint (one retry with the push on its own line): commit -s/--signoff, --no-verify, --amend, --no-edit; cd ~/r or an env prefix; a double-quoted body containing `, $ or \; any $'…' or $"…" body; a heredoc or $(…) message; git tag, echo, printf or gh as the owner; git -c settings; commit --message, --quiet, -a/--all; add -A/--all; push -f/--tags, --force-with-lease, --set-upstream, --quiet. _INERT_FLAGS is not widened without a security-owner review; the real-bash oracle test and the one-oracle-row-per-entry rule (both enforced by tests, security.md) are the bar for any widening.

#12631 events replayed with a multi-line message (issue_events_probe, head vs main):

  • Now pass: the reporter's git commit -m '<ml>'; git push -u fork fix/x, and event 7 (cd /r && git add f && git commit -m '<ml>' or "<ml>" && git push origin docs/…).
  • Still need the own-line retry: event 7 with -s, cd ~/r or $ in a double-quoted body; event 16 (git push -q origin docs/s 2>/dev/null; gh pr create …: the redirect keeps the sentinel; it passes with the push on its own line).
  • Correctly denied: event 5 (pushes main). Events 9 and 10 (env prefix, | tail, no multi-line text) already pass on main.

The one visible change for a protected push is a more accurate rule id (push-protected-branch-name instead of target-unverifiable).

What changed (motivation → approach → change)

  • Symptom: a literal feature push is refused as target-unverifiable.
  • Cause: a quoted newline splits the segment and desynchronises the quote state.
  • Change, in _split_push_command_segments (shell_normalizer_walk.py): a newline that _iter_shell_chars reports as inside quotes (and not escaped) stays in its word and does not end the segment. Unquoted and escaped newlines still split, as on main.
    • Trust is limited to commands the quote walk models. A heredoc, a $(/${/backtick/<(/>( body, a real # comment, or any backslash-newline outside a plain single quote keeps the split at every newline (_QUOTE_WALK_UNMODELLED_RE). The list only narrows allows; no denial depends on it.
    • A merged segment that does not parse as a push is re-read line by line, as on main, so quoted text that only mentions a push reads as before.

Also changed:

  • _git_publish_floor_tags, the per-line backstop and the one deny authority: when the command has a newline, main's per-line reading also runs on every push line. Its ungated sentinel is dropped only where the whole-text walk enters the line inside a quote that closes before the push and ends its word; the code after that close is judged in full.
  • Why the backstop can't rely on the merged segments: they come from the same quote walk a phantom quote fools. In trap 'x⏎git push origin $b #' EXIT git push origin f (Opus 5.5 review) the walk keeps the $b push inside a quoted word, so the merged segments show only the feature push; only the per-line reading sees git push origin $b. That row is in the real-bash oracle corpus. The same row is why the root-cause alternative, carrying the cumulative quote state into each per-line segment instead of restarting it unquoted, was rejected: every reading would then inherit the phantom quote and none would see the $b push.
  • The exemption needs the quoted word to be inert data (shell_normalizer_walk._quoted_word_is_inert), one closed allowlist checked whole:
    • the owner is git commit (no git -c setting), the owner git-publish-* floor refuses literal git push [flags] origin feature-branch #12631 names; echo, printf, git tag and gh read as on main;
    • the word follows a space or tab and doesn't open with -; the word is '…' or "…": a $'…' or $"…" word is decoded or translated by bash and no reported event needs one, so it is never data (First Principles item 5); a double-quoted body holds no $, backtick or \, so no expansion ("$1⏎" with -- -em) reaches bash as an option. Only a literal body is data;
    • with every other quoted word masked, only word characters, spaces, tabs, newlines and . / : = @ % + , - ; & remain, and no masked word is empty or opens with - (bash dequotes '-e' and ''-e);
    • every segment is cd <dir> or git add/commit/push with only allowlisted lowercase flags (commit -m/-q, push -u/-q, no add flag: only the flags the replayed git-publish-* floor refuses literal git push [flags] origin feature-branch #12631 events use, First Principles item 6). Only -m takes a value, a commit must carry its message, and option scanning stops at -- (unless that -- is the value of -m), so no git config, -e/--edit, --amend, --author/--date or pathspec named --no-edit can open an editor on the text;
    • why cd <dir> cannot change which push bash runs (Design review of f9313632): <dir> must be one plain word or a literal quoted word (no $, ~, \, backtick, glob or brace), so bash expands it to literal text and runs nothing; a function or alias named cd would need a definition, which is outside the allowlist; and the push's destination is the literal refspec word the floor judges, the same word main already judges after a single-line cd dir && git push origin feat. A directory's own git config (for example a remote.<name>.push mapping) is the same exposure main has for that single-line form, so the exemption adds none. cd . is the oracle row;
    • anything else (pipe, redirect, expansion, glob, brace, comment, definition, source, trap, eval, ~ path, env prefix) keeps the sentinel, as on main. A new bypass is closed by the allowlist, not a new clause. The allowlist is meant to stay this narrow (Design review of 3eb721db): add -A, commit -s, cd ~/r and a $(cat <<'EOF'…) message stay refused on purpose, and any widening is a maintainer's recorded decision, carrying a real-bash oracle row that a test enforces (security.md).
  • The kiro-cli shell title (GPT 6.1 review of 1b0852fc5): kiro-cli titles a shell call Running: <command>, and the deny tiers judge that title as well as the command (GateFacts.deny_targets), so a proof anchored at offset 0 left the live title refused for an allowed command (fails closed, but the fix missed the real call). _quoted_word_is_inert now reads through ONE exact leading running: (the text is lowercased there), the same rule denied_rules._exception_applies already applies. Its constant _SHELL_TITLE_PREFIX moved to shell_normalizer_walk.py (denied_rules imports it back through shell_normalizer; the walk cannot import denied_rules without a load cycle), so there is still one copy. running: running: …, running:git …, xrunning: …, running … and a prefix after a separator are not stripped and read as a command word.
  • The bar: the whole-text reading keeps every tag main's per-line reading gives a push line, with one exception. The ungated sentinel is the one relaxed deny: it is dropped only on a line the walk enters inside a quote, and only when _quoted_word_is_inert accepts that word. So the safety of that drop rests on _quoted_word_is_inert (with _inert_mask and _inert_segment) modelling bash correctly, which is why every allowlist entry needs a real-bash oracle row (Design review of f66ddd0ec). Each inert check exists because an Opus 5.5, GPT 6.1 or Design review showed such a command; test_every_per_line_deny_survives_the_whole_text_reading pins the bar and test_no_command_real_bash_runs_as_a_protected_push_is_allowed checks it against real bash.
  • Refusal text: a refused multi-line push in which some line starts inside a quote (_quoted_line_entries), and which clears the floor once each git command after an unquoted separator (with any env or assignment prefix) is moved onto its own line, judged over every nested shell payload as the floor judges it (deny_gate._own_line_fix_applies), says "the push shares a line with a multi-line quoted argument, so its destination branch cannot be read before the push runs. Put the push on its own line." in place of the substitution reason, which such a command does not have. Every other unverifiable push keeps the substitution reason: a separator inside the quoted message is message text and is not moved, a bash -c push that stays unverifiable keeps the hint out, and so does a walk that fails. Only the reason text depends on this; no verdict does. The hint alone does not fix git-publish-* floor refuses literal git push [flags] origin feature-branch #12631: git commit -m '<multi-line>' && git push origin feat is the shape agents emit by default, so a hint-only fix costs a retry turn on every commit. The exemption allows exactly that shape.
  • The hint's rewrite matches the unquoted separator first and cuts the blanks before it in Python rather than opening its pattern with [ \t]* (Opus 5.5 review of 7d4e73088: 3.3 s at 20,000 blanks before $b; now 0.3 s, 2.0x per doubling). The rewritten text is the same: 0 differences on 213,519 strings. An assignment value stops at a separator ([^\s;&|]*), as in bash, so a run of ;a= after the push is linear too (Opus 5.5 review of 91f01dccd: 1.2 s at 6,000 repeats, now 0.26 s); that changes the hint only on 73 of 208,415 random strings, all where the old value ran across a separator.
  • The inert-head check masks and judges the rest of the command once (_inert_rest) and reuses that answer for every quoted line: only the judged word differs between lines, and it masks to the same text (Opus 5.5 review of d18879bca: for 1,250 quoted push lines in 19 KB, _inert_quoted_line_heads 3.0 s → 0.04 s and is_denied 6.8 s → 0.9 s, now 2.0x per doubling; 0 differences in _inert_quoted_line_heads on 115,069 multi-line commands).
  • docs/system-specs/modules/security.md: when a quoted newline stays in its word, the per-line backstop as the one deny authority, the construct list as allow-narrowing only, and the oracle-row rule.
  • test/test_security_gate_liveness.py: the package line budget is re-pinned from 33,723 (current main, f45380e92) to 33,919. The per-line inert-head reading lives in shell_normalizer_walk._inert_quoted_line_heads, so the floor's loop stays small, and the argv_floor facade names it in its TYPE_CHECKING import list (test_argv_floor_facade.py checks that list); moving it changed no verdict or floor tag on 17,616 generated multi-line commands.
  • Rebased onto 518b36d1, which splits the security facade and the shell reader under the 2,000-line cap: the splitter change and the quoted-newline helpers (_QUOTE_WALK_UNMODELLED_RE, _INERT_FLAGS, _quoted_line_entries, _quoted_word_is_inert, _inert_quoted_line_heads, _inert_mask, _inert_segment) moved with _split_push_command_segments into shell_normalizer_walk.py (1,510 lines), which shell_normalizer.py re-imports for argv_floor.py and deny_gate.py; _own_line_fix_applies and the hint moved with is_denied into deny_gate.py, exported on the facade like its neighbours. The tests that patch the construct list or _opens_comment patch shell_normalizer_walk, where their readers are. No code changed: is_denied and _git_publish_floor_tags give the same result as 12dc6bed3 on all 17,617 commands of the move probe corpus (0 differing).
  • Rebased onto 2798d6b3, which splits argv_floor.py into owner modules behind a facade: the per-line loop and the kept-newline re-split moved unchanged into argv_floor_git._git_publish_floor_tags (1,136 lines). Same move probe against 01f2d721: 17,617 commands, 0 differing.

Tests

In test/test_push_branch_gate_parser.py (where main moved this class), TestTokenizerContractBetweenTheLayers:

  • test_a_newline_inside_quotes_stays_in_its_word:
    • the segment split of a double-quoted multi-line message;
    • double-quoted && and single-quoted ; feature pushes after a multi-line message are allowed;
    • a multi-line message followed by a push to main, and an unquoted newline before a push to main, both report git-publish-push-protected-branch-name.
  • test_a_quote_the_walk_cannot_model_keeps_the_split_at_every_newline:
    • the comment-apostrophe bypass, a heredoc-body phantom quote, a heredoc inside a double-quoted command substitution with a " in its body, a backtick phantom quote, the three backslash-newline bypasses from the Opus and GPT reviews (inside double quotes, before an ANSI-C quote, and inside a heredoc opener), and the four comment phantoms hiding an ungated-only push from the d093e50 reviews ($'main', $b, ~, and $b behind a real multi-line X="...") all stay denied (each fails on the commit it was reported against, passes now);
    • a quoted message containing Fixes #1 stays whole.
    • Fails on the previous head of this PR, passes now.
  • test_quoted_text_that_quotes_a_push_line_is_judged_line_by_line: the Security Scope Review's newly refused rows (an echo, a printf, a PR comment body and a commit message that quote a feature push line) are allowed again, and a quoted push to main stays denied. Fails on f96e4f0, passes now. It also holds the editor and quoted-option rows ('-e', ''-e, "--edit") and the refusal-hint row, which fail on 3752abf6. The --author -m/--date -m amend rows and the dropped echo/git tag/gh pr owners followed by a feature push fail on 33f99449 and pass now.
  • test_the_unmodelled_construct_list_is_pinned_to_the_quote_walk: pins the _QUOTE_WALK_UNMODELLED_RE pattern and checks every listed construct, backslash-newline included, turns quoted-newline trust off, and that the same construct inside a plain single quote does not; a single-quoted message holding a backtick, chained to a feature push, is allowed and the same chain to main denied. An earlier revision also pinned a sha256 of _iter_shell_chars's source; it was removed on the First Principles review, since the per-line backstop and its test now guard a construct the list misses. d093e50 removed the list on the First Principles review, since the backstop denied every known phantom shape on its own; the Opus and GPT reviews then found that the backstop as written (targets only, every sentinel dropped) let a comment apostrophe hide $'main'/$b, which the list's # check had been covering. Both are restored and the backstop is strengthened, so either guard alone denies every case found. Separately, why both guards stay: the construct list decides where the merged (quote-aware) reading is used at all, so an allow rests only on a walk that models bash for that command; the per-line backstop is the deny guarantee if the list is ever incomplete. At this head, removing a construct from the list no longer lets its phantom case through, because the backstop denies it; that is the backstop's job, and test_a_phantom_quote_cannot_hide_a_push_even_without_the_construct_list pins it.
  • test_the_shell_title_gets_the_verdict_of_the_command_it_displays (GPT 6.1 review of 1b0852fc5): every allow row in _INERT_ALLOW_ROWS (the reported shapes and each oracle row's feature twin, 11 rows) with and without Running: ; the 11 prefixed cases fail on 1b0852fc5. test_the_shell_title_prefix_is_read_through_once_and_only_exactly: the prefixed oracle rows (protected pushes) stay denied, the prefixed form of every corpus command the bare form denies is denied, and the lookalikes above stay denied.
  • test_the_own_line_hint_is_linear_in_a_run_of_blanks (Opus 5.5 review of 7d4e73088): a refused push with up to 20,000 blanks before $b stays linear, and so does a run of ;a= after the push (conftest.assert_rejected_without_backtracking). The separator pattern (deny_gate._OWN_LINE_SEPARATOR_RE) is timed alone: the whole gate reads the text several times and runs under coverage in CI, where a 20,000-unit pump through is_denied cost 3.1 s. One short pump still goes through is_denied. Fails on 7d4e73088 (3.27 s of CPU at 20,000), passes now.
  • test_the_inert_head_check_reads_the_command_once_not_per_line (Opus 5.5 review of d18879bca): 1,250 quoted push lines, each an inert head, stay linear. Fails on d18879bca (3.04 s of CPU), passes now.

Existing suites:

  • Every test file referencing is_denied, shell_normalizer, _split_push_command_segments or _git_publish_floor_tags, plus the line-budget test: 8277 passed, 16 skipped. After the rebase onto af1eb61: the push-gate, line-budget, argv-floor and security test files, 5103 passed. After the rebase onto 518b36d1: the push-gate, line-budget, argv-floor, denied-commands, split patch-reach and facade test files, 1339 passed, and the substitution/paren/heredoc subset of test/test_security.py, 65 passed. After the rebase onto 2798d6b3: the same files, 1328 passed. On 9800507e1, with the split security suites and facade tests added: 1,847 passed, 1 skipped (2 local-only markdown_it import errors). test_a_phantom_quote_cannot_hide_a_push_even_without_the_construct_list empties the construct list and checks the three reviewer bypasses still deny a hidden push to main, a hidden bare push and a hidden $b push; it fails without the per-line backstop.
  • test_every_per_line_deny_survives_the_whole_text_reading (Design Review's differential): over this module's own multi-line push corpus plus generated head × push × tail variants (comment apostrophes, X=", trap ', heredocs, backslash-newlines, backticks × main/master/bare/$b/$'main'/~/${b}/feature targets), run with the construct list on and emptied, every tag a push line earns judged alone as a single-line command is present in the whole-text verdict; only the ungated sentinel may be absent, and only on a line the whole-text walk enters inside a quote. It fails when the per-line backstop is disabled.
  • test_no_command_real_bash_runs_as_a_protected_push_is_allowed (Design Review's "checked against real bash"): an oracle independent of _iter_shell_chars. Real bash parses and runs every command in the same corpus, read from a script file, with git a shell function (loaded through BASH_ENV) that only logs its argv (b=main, g=git; sh/bash re-enter the same bash; PATH is an empty directory; scratch cwd). Every command whose executed argv is a protected or bare push (over 100 of them, including the trap $'\x67it …' shape) must be denied, with the construct list on and emptied. It fails on a4c74349, where bash runs a main push the filter allowed. It is never skipped: Windows runs it under the shared Git Bash lookup (_find_posix_test_shell), since the function stubs need no shebang or symlink, and a missing bash fails the test on every platform (Design review of 33f99449, GPT 6.1 review of 30e81bdb). On Linux the function stubs catch exactly the same 194 commands as the earlier PATH stubs. On 3752abf6 it ran and passed (6.2 s) on Linux, in Backend Tests (3.12, 3). On 9f26005b it ran and passed on Windows in Backend Tests (Windows) (3), in 40.79 s against its per-command timeout=10. On 6c45e3c4 it passed on Windows again in Backend Tests (Windows) (3), in 38.80 s. On 9eaabe9f it passed on Windows in Backend Tests (Windows) (3), in 38.72 s.
  • Where CI runs the oracle and the per-line differential (test_every_per_line_deny_survives_the_whole_text_reading), Design review of 529a6daa8: both are plain tests in test/test_push_branch_gate_parser.py, with no mark or skip. ci.yml's changes filter counts every path outside website/, .github/ and scripts/ as backend, so any change to shell_normalizer_walk.py or argv_floor_git.py runs them in the eight Linux Backend Tests (3.12, 1-8) shards. The eight Backend Tests (Windows) shards run them under Git Bash on a fork head when a Windows path or Windows-branching line changes (or with the ci:windows label), and on main after every merge. On 529a6daa8 all 16 Linux and Windows shards ran; the one red, Windows (1), is the known test_ci_ipv6_routing collection timeout.
  • test_every_inert_allowlist_entry_has_a_real_bash_oracle_row (Design Review's "enforced by a test rather than by convention"): reads _INERT_FLAGS and fails on any flag with no row in _INERT_ORACLE_ROWS; the real-bash oracle requires every one of those rows to run a protected push that stays denied. Adding -n to git add fails it.
  • test_generated_mask_edge_words_never_make_a_dash_word_inert (Design Review's "oracle corpus generates mask-edge words systematically"): 17 mask-edge words (empty, dash-leading, glued, escaped quotes) x 3 commit-message bodies (one a disguised $1 push) x 3 positions (before, after, glued to the message), each followed by a feature push. Wherever the exemption allows one, every word bash passes to git commit is non-empty and only -m/-q lead with a dash, so no edge word can open the editor. Mutation check: letting quote marks or anything through the post-mask character class fails it (the existing suite missed the quote-mark weakening).
  • test_the_splitter_keeping_a_quoted_newline_is_what_allows_the_reported_command (Design Review's "a test shows a git-publish-* floor refuses literal git push [flags] origin feature-branch #12631 command whose verdict changes when only keep_quoted_newlines is turned off"): the reporter's git commit -m '<multi-line>'; git push -u fork fix/x and event 7 with a single- or double-quoted message are allowed on this head and refused when the splitter is forced to split inside quotes again. The per-line exemption alone does not allow them, so both halves decide and _split_push_command_segments cannot stay identical to main. A replay of 26 git-publish-* floor refuses literal git push [flags] origin feature-branch #12631-shaped commands found 15 whose verdict or reason changes with that one switch.

Manual verification

26-case replay through security.is_denied, 0 failures:

  • Allowed:
    • a multi-line double- or single-quoted message (including one containing Fixes #123, and a CRLF one) followed by a feature push;
    • a plain feature push, and an unquoted newline before a feature push;
    • the four Security Scope rows that quote a feature push line.
  • Denied:
    • both comment-apostrophe bypass variants;
    • heredoc-body and command-substitution-heredoc phantom quotes, and a backtick phantom quote;
    • a multi-line message then a push to main, and an unquoted newline then a push to main;
    • backslash-newline splices, plain and inside double quotes;
    • a bash -c payload with a newline then a push to main;
    • a heredoc apostrophe then a push to main;
    • a bare push after a quoted newline;
    • substitution and brace glue in the target;
    • a quoted push to main inside a feature push's refspec followed by a real push to main.
  • On main: only the four quoted-message-then-feature-push cases differ (they are refused as target-unverifiable).

Running: title sweep (GPT 6.1 review of 1b0852fc5): 8,411 commands (the parser corpus plus generated heads × messages × separators × pushes, including running: and double-prefix heads), each judged bare and with Running: , on this head, 1b0852fc5 and main (9800507e1). On this head the prefixed title is never weaker than the bare command (0 cases), and on the 5,819 commands without a prefix of their own both forms get the same verdict (0 differ; on 1b0852fc5 the title was stricter on 122). The title allows 122 commands main denies, all 122 also allowed bare on this head (this PR's intended allows). Bare verdicts against 1b0852fc5: the only 36 changes are commands that themselves begin with one running: ; a double prefix is still refused.

Also clean: black --check, isort --check-only, flake8, mypy on shell_normalizer_walk.py, shell_normalizer.py, denied_rules.py, deny_gate.py and argv_floor_git.py, scripts/check_file_line_cap.py, scripts/check_comment_history.py, scripts/docs-lint.sh.

Screenshots / video

N/A. No UI change.

Related Issues

Refs #12631. This fixes the quoted-newline cause diagnosed there. The issue stays open for:

  • the heredoc-in-command-substitution commit-message shape, still refused, now by the conservative split;
  • a quoted body whose own line reads as a push;
  • the env PATH=… prefix.

Pattern harvest

Rule candidate: review-prompt
Pattern: a splitter that trusts a quote state machine across a boundary the machine does not fully model (a newline ending a comment or heredoc line). Trust the state only where the grammar it models is the whole grammar in play, and fall back to the conservative split otherwise.

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

Contribution License Agreement

@Maqix
Maqix requested a review from a team as a code owner September 30, 2026 14:44
@Maqix
Maqix requested a review from dodgeblaster September 30, 2026 14:44
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of c47bac4fa9df08393fbfd5968cdfcf08809b2912 via the fork AI-review pipeline — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix works on the mechanism that causes the refusal: the splitter ends a segment at a quoted newline. The root-cause alternative, carrying quote state into each line, was considered and rejected with a counter-example.

What this change ships

Inventory (6 items) — 6 justified

Intent: let an agent push a feature branch in the same shell call as a multi-line git commit -m message. This is a FIX.

  1. A literal feature push after a multi-line git commit -m '…' is no longer refused as target-unverifiable — justified
  2. A protected push behind a multi-line commit now reports push-protected-branch-name instead of target-unverifiable — justified
  3. The refusal reason now says "Put the push on its own line" when that retry would pass — justified
  4. Every push line of a multi-line command is still judged on its own, and that per-line reading stays the deny authority — justified
  5. Text that merely quotes a push (echo, --body) is read line by line, as on main — justified
  6. _SHELL_TITLE_PREFIX moves from denied_rules.py to shell_normalizer_walk.py so both readers share one constant — justified

[FIRST-PRINCIPLES-REVIEWED] c47bac4

Description read

[DESCRIPTION-READ] 792c3c1586d617f01443acd645a28203f8683856a11f9ac9a58c4a238aa2ddfc

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 30, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of c47bac4fa9df08393fbfd5968cdfcf08809b2912 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the change only widens what is allowed, to a closed allowlist that a real-bash oracle test pins, and the per-line reading still decides every deny.

Notes

[DESIGN-REVIEWED] c47bac4

Description read

[DESCRIPTION-READ] d7f7f548c8b8ef54b10313047181dc3bc23e6f5740e9cd8aa64157a9a9eacf68

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 30, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed c47bac4fa9df08393fbfd5968cdfcf08809b2912 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c47bac4

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed c47bac4fa9df08393fbfd5968cdfcf08809b2912 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] c47bac4

@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 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review (fork) — 🔴 BLOCK (blocking)

Which legitimate operations does c47bac4fa9df08393fbfd5968cdfcf08809b2912 newly refuse? Model proposes, scripts/deny_diff.py decides — updated in place on each push. A script-confirmed regression blocks PR readiness.

the per-platform reports could not be folded

Scope-Verdict: PASS

Reason: This change mostly loosens the push floor: a quoted newline after a git commit message no longer splits the command, so a feature push behind a multi-line message gets read correctly. Where it gets stricter (a joined segment that doesn't parse as a push is re-read line by line, and every push line is still judged on its own), it rebuilds how the base read each line rather than adding a new pattern. No regression has been confirmed by the script. The changed refusal text ("Put the push on its own line") is advice only and changes no verdict, so nothing is left unadjudicated.

TIGHTENING: the _git_publish_floor_tags segment walk in the git-publish floor (sensitive-bash tier) -- it refuses a phantom or real quoted newline hiding a protected, bare or unverifiable push in a joined segment. The hunk: if "\n" in command and _git_push_args(command) is None: pending[:0] = _split_push_command_segments(command, keep_quoted_newlines=False), together with the per-line backstop for line, close in _inert_quoted_line_heads(text_lower, _is_git_publish): line_tags = set(_git_publish_floor_tags(line)) ... tags |= line_tags.

ADJUDICATED: 15 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: posix (12 rows) and windows (3 rows). The diff only assumes things about the bash quote and newline grammar, not about paths or executables. The posix rows probe the edges of the new split:

  • multi-line scripts with no quote spanning a line;
  • a quoted newline before and after a push;
  • a quoted newline inside the push's own argv (-o);
  • a heredoc, which is an unmodelled construct;
  • owners other than git commit (gh, git tag);
  • quoted text that mentions a push;
  • the Running: title prefix.

The windows rows cover a drive-letter \ path inside an otherwise inert command (a \ is outside the plain allowlist), the git.exe spelling of a multi-line publish, and the publish-then-PR flow. I could not write a row for a cmd.exe-native quoting of a multi-line argument, because the floor reads every command with bash quoting rules.

[SCOPE-REVIEWED] c47bac4

@Maqix
Maqix force-pushed the fix/push-floor-quoted-newline branch 2 times, most recently from f96e4f0 to df753ed Compare September 30, 2026 17:09
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 30, 2026
@Maqix

Maqix commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Could a maintainer re-run the failed jobs? A fork contributor can't re-run workflows here.

On df753ed the only red check besides readiness is Backend Tests (3.12, 3), and it's unrelated to this diff:

  • The failing test is test/test_session_export.py::test_a_sent_export_streams_its_staged_file_and_removes_it, which expected a staged egress/*.json.gz file to have been removed.
  • Coverage Gate fails only because of it ("backend-test=failure -- failing closed").

Every file that exercises the push floor is green, and the Design, First Principles, GPT 5.6 and Opus 5 reviews pass on this head. The fork Security Scope lane hasn't re-run since f96e4f0. df753ed addresses its four newly-refused rows: quoted text that only mentions a push is read line by line again, exactly as on main.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Sep 30, 2026
@Maqix
Maqix force-pushed the fix/push-floor-quoted-newline branch from df753ed to b5c36ce Compare October 2, 2026 13:02
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 2, 2026
@Maqix
Maqix force-pushed the fix/push-floor-quoted-newline branch from b5c36ce to bdf1c79 Compare October 2, 2026 13:30
@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 readiness: action required A blocking check or review needs attention labels Oct 2, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

This PR stops the push gate from refusing a feature push chained after a multi-line quoted git commit message. It fixes the root cause in _split_push_command_segments, where a quoted newline now stays inside its word. Main's per-line reading stays the deny backstop in _git_publish_floor_tags, and the ungated sentinel is dropped only for a word that passes the closed _quoted_word_is_inert allowlist. Head dcb6bfa is a rebase since our last review at 9e252fc, and I diffed the PR's own production hunks across the two heads. The per-line entry walk moved unchanged into shell_normalizer._quoted_line_entries. _quoted_word_is_inert now refuses every $'…' and $"…" word outright, where before it accepted a $'…' body with no $, backtick or backslash, so the delta only narrows the allow. I re-checked the earlier break shapes (git commit 'x' -- -m, protected targets on a later line, #' phantom quotes, $'\x2d…'-style decoded options) against the new code, and none reach an allow. I still have no defect to report. The hard blocker is unchanged: Sensitive Change Review fails by design ("This PR comes from a fork and changes a sensitive path. A fork PR cannot pass this gate"). Can a maintainer take this over on an upstream branch (Co-authored-by: Maqix, Supersedes #15438) and run the real sandbox there so the gate can pass? — crew-pr-reviewer (deep re-check)

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 91eeda3.

This PR changes the push gate's deny logic in src/kiro_crew/security/ (argv_floor.py L4435, shell_normalizer.py L2785). Security-gate changes need a human security owner, and Sensitive Change Review fails by design for a fork PR on a sensitive path. A maintainer needs to take it over on an upstream branch (Co-authored-by: Maqix, Supersedes #15438).

Since our last review at dcb6bfa, the production delta only narrows the allow:

  • _INERT_FLAGS is now commit -m/-q and push -u/-q, with no add flags;
  • the git -c owner and the = predecessor are gone;
  • a -- used as the -m value no longer ends flag scanning.

I found no concrete defect.

Two things need answers:

  • The current-head Design review is CONCERNS ("two layers where one decides"). It says the splitter change adds no allow, and asks for _split_push_command_segments to stay byte-identical to main. There is no target=design reply for this head.
  • The description says the inert word may follow a long option's =. L2824 now accepts only a space or tab there, so that sentence should go.

The other AI lanes pass, and Security Scope found no confirmed regressions. I did not run the gate or the oracle tests locally.

— crew-pr-reviewer (r100)

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at b74bc22.

This PR stops the push gate from refusing a feature push chained after a multi-line quoted git commit -m. A quoted newline now stays inside its word in _split_push_command_segments. Main's per-line reading in _git_publish_floor_tags stays the deny authority. The two points from our r100 review are settled: the Design lane is now PASS, and the description no longer claims an inert word may follow a long option's =. I found no concrete defect.

What blocks approval:

  1. Policy requires human review. The PR changes the push gate in security/argv_floor.py, security/shell_normalizer.py and security/__init__.py. Sensitive Change Review fails by design for a fork PR on a sensitive path, so a maintainer needs to take it over on an upstream branch (Co-authored-by: Maqix, Supersedes fix(security): keep a quoted newline inside its word on the push path #15438).
  2. The current-head Opus advisory has no reply. The refusal hint fires whenever any line starts inside a quote. That includes git commit -m 'a⏎b'; git push origin $b, where moving the push to its own line is still refused. Fix it or post a disposition.
  3. The PR says it uses Refs #12631 to leave room for the three Not a goal gaps: the $(cat <<'EOF' …) message, a quoted body whose line reads as a push, and the env PATH=… prefix. But git-publish-* floor refuses literal git push [flags] origin feature-branch #12631 was closed on 2026-10-13, so nothing tracks them now. Please open one issue per remaining gap and link them in the description.

CI is otherwise green on this head. I read the code and tests but did not run them.

— crew-pr-reviewer (r103)

@Maqix

Maqix commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (a5c1e85b3), no conflicts and no behaviour change. Push-gate tests (1,805), lint, type and comment-history checks pass locally. The Fast Gate failure on the previous head was Harness Parity Gate, which main fixed in #22178.

Two asks for a maintainer:

  1. Approve the fork workflows on 028d9b67e, so CI and the AI reviews can run.
  2. @iamwhatever: your last review found no defect and suggested a maintainer copy this upstream, since Sensitive Change Review can't pass from a fork. Is that still the plan? I'm happy to rebase it whenever you need. fix(security): allow an env-prefixed push after a multi-line message #20854 is stacked on it.

@Maqix

Maqix commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Re the GPT 6.1 blocking finding on 1b0852fc5 (comment): confirmed and fixed in 65b3df737.

Finding. kiro-cli titles a shell call Running: <command>, and GateFacts.deny_targets judges that title as well as the command. The inert-word proof only matched a git commit starting at offset 0, so the title Running: git commit -m 'a⏎b'; git push -u fork fix/x was still refused while the bare command was allowed. It failed closed, but the fix did not reach the live call. Before the fix I reproduced it on 7 of 8 allowed commands.

Fix. _quoted_word_is_inert now reads through ONE exact leading running: (the text is lowercased there). This is the rule denied_rules._exception_applies already uses. The _SHELL_TITLE_PREFIX constant moved to shell_normalizer_walk.py, and denied_rules imports it back, so there is still one copy (the walk cannot import denied_rules without a load cycle). running: running: …, running:git …, xrunning: … and a prefix after a separator are not stripped.

Tests (TestTokenizerContractBetweenTheLayers):

  • test_the_shell_title_gets_the_verdict_of_the_command_it_displays runs 11 allow rows with and without Running: . The 11 prefixed cases fail on 1b0852fc5.
  • test_the_shell_title_prefix_is_read_through_once_and_only_exactly checks three things: prefixed protected-push oracle rows stay denied, the prefixed form of every corpus command the bare form denies is denied, and the lookalikes above stay denied.

Sweep. 8,411 commands, each judged bare and prefixed. On this head the title is never weaker than the command (0 cases), and on commands without a prefix of their own the two forms always agree. The title allows only the 122 commands this PR already allows bare. Gates pass; the package budget is 32,244 on main 9800507e1.

Could a maintainer approve the fork workflows on 65b3df737? Thanks.

@Maqix

Maqix commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto today's main as 006d159042: one commit, and only the line-count number changed (0 verdict changes vs e1e49474fc, same test pass set). Opus, GPT, Design and First Principles all passed the previous head. Security Scope's check was red only because its per-platform reports could not be folded; its own verdict was PASS with 0 newly refused.

@iamwhatever @bolichen97 @cruisercohen could a maintainer approve the fork workflows on this head, and pick up the upstream copy offered earlier (Co-authored-by: + Supersedes #15438)? That is the only way past Sensitive Change Review for a fork. #20854 is stacked on this and is rebased onto it too.

@Maqix

Maqix commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for approving the runs on 62b1ee50b7 (the rebase onto 241e39cf78; only the line-count number changed, re-pinned to the measured 32,394).

Status on this head:

  • Backend Tests (3.12) 1-8, Coverage Gate and the other Linux gates pass. The red Windows shards are timeouts (for example ci-surface-tests.py --surface backend after 45 s), and the same shards are red on fix(security): read a push line in a literal gh body as data #20853 and fix(security): allow an env-prefixed push after a multi-line message #20854. Dependency License Gate reports "Dependency review is not supported on this repository".
  • Three review lanes did not run, so they have no verdict: GPT 6.1 Review ("could not run"), Security Scope Review ("the generate job did not finish") and Internal Content Scan ("could not run"). On the previous head 5bf16a3e20, with the same code, all AI lanes passed: Opus, GPT, Design, First Principles and Security Scope.

Could a maintainer please re-run those three lanes? After that, the PR needs a human review. Or, as offered earlier, an upstream copy, since Sensitive Change Review cannot pass from a fork.

@Maqix

Maqix commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Opus 5.5 finding on 6dfccbc (the "Put the push on its own line" hint): confirmed and fixed in 5986a0e, still one commit. The same function's second gap, which Opus raised on #20854, is fixed here too.

Cause. _own_line_fix_applies (deny_gate.py) decides whether the refusal says "Put the push on its own line". It had two gaps:

  1. It judged the rewritten command on the top-level text only (_git_publish_floor_tags(rewritten)), but the floor reads every nested shell payload. So git commit -m 'a⏎b' && git push origin feat; bash -c 'git push origin $b' got the hint, even though the $b in the nested push is what keeps it refused. Moving the push onto its own line returned the same refusal and the same hint.
  2. The rewrite was a quote-blind re.sub, so it also split at a ; inside the quoted message. git commit -m 'a; git push origin f⏎⏎b' && git push origin feat got the hint, and the resubmission still had ; git push inside the quote, so the hint came back every time.

Fix. The rewrite now moves a git command only after an active separator, using the offsets from the shared quote walk (_iter_shell_chars, step.active). It then judges the result over every _shell_payload_sources(rewritten) source that _is_git_publish, the same way the floor does. If that walk fails, the hint is left out, since it is only advice. Both of your commands now keep the substitution reason. The existing hint cases (cd ~/r && …, env GIT_DIR=/x git push …) still get the hint, and resubmitting them with the push on its own line is allowed. The new no-hint rows and the walk-failure test fail on 6dfccbc and pass on 5986a0e.

Verdicts did not change. Against 6dfccbc:

  • probe.py: 5,104 commands, 0 flips.
  • c100p probe: 6,688 commands, 0 flips. nested_probe: 2,268 commands, 0 flips.
  • c92 sweep: 8,415 commands, identical output.
  • c93 sweep: 11,026 commands, 0 verdict flips and 0 masked-reason diffs. Only the hint flag changed, on 1,732 commands, all removals. 1,731 of them are nested-payload pushes, and the remaining one is the quoted-separator command.

The package line budget is 32,730.

@iamwhatever @bolichen97 @cruisercohen could one of you approve the workflow runs on 5986a0e? Once the AI reviews are green, this PR only needs a review, or the upstream copy offered earlier if the fork-only gates are still in the way.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 7f57006.

The two open points from our r103 review are settled: the own-line hint now judges every nested payload (deny_gate.py#L420), and the three remaining gaps are tracked in #20845, #20846 and #20847. All five model lanes pass, and Security Scope Review confirms no newly refused command.

What blocks: this changes what the push deny gate allows in src/kiro_crew/security/ (_split_push_command_segments, _git_publish_floor_tags), and Sensitive Change Review fails by design for a fork PR on those paths. A security owner needs to review it, or a maintainer can take it over on an upstream branch.

Optional: First Principles suggests keeping _own_line_fix_applies private to deny_gate instead of exporting it.

— crew-pr-reviewer (r125)

@Maqix

Maqix commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @iamwhatever — understood, and glad the two r103 points and the three tracked gaps (#20845, #20846, #20847) are settled with all five model lanes green and Security Scope confirming no newly-refused command.

The blocker is now clear: Sensitive Change Review fails by design for a fork PR touching src/kiro_crew/security/, so this needs a security owner's review or a maintainer taking it over on an upstream branch. Whichever you prefer — I'll keep the head steady at 7f57006ef4 so this HOLD stays valid, and keep it rebased if main touches the security code.

On the optional First Principles note (keep _own_line_fix_applies private to deny_gate instead of exporting it): happy to fold that in, but I'd rather not push a new head just for it since that would reset this HOLD and re-gate the run. Say the word if you'd like it in before the security-owner review (or I can leave it to the upstream takeover).

@Maqix

Maqix commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Daily status for head e1d9994bb0 (one commit over main, merges cleanly).

The red test shards here are not from this PR. Both Backend Tests (3.12, 5) and Backend Tests (Windows) (5) fail only on test/test_memory_files_substitution.py::TestTheInjectedImplementationAnswers::test_pruning_removes_from_the_seam_and_leaves_local_files_alone (assert 2 == 1). That is the prune-clock flake main fixed in #24191 after this head's base; it passes 3/3 on current main locally. Coverage Gate fails closed because those shards did not finish green.

@iamwhatever @cruisercohen could one of you re-run the failed jobs on this head? Your HOLD (r125) asks only for a security-owner review of the deny-floor change, or an upstream copy that credits the author. Either works for me, and I'll keep the head steady until then.

@Maqix

Maqix commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Daily follow-up on head cd5e039b41 (rebased onto main b06d6a8501; only the package line budget moved, +3 for the paths.py install-tree fence).

Thanks for approving the runs. On this head:

  • Opus 5.5, GPT 6.1, Design, First Principles: all pass, no blocking findings. UX skipped (no user-facing surface).
  • Security Scope Review: no verdict -- "the per-platform reports could not be folded", no leg produced confirmed rows. A pipeline fault, not a finding. @iamwhatever @cruisercohen could one of you re-run it?
  • Backend Tests (3.12, 2) / (Windows, 2): the XPASS(strict) in test/test_crew_log_fullscan_guard.py ("a warm session fold refolds the whole unit...") is main's own stale strict xfail, in a file this PR does not touch; the same marker is on current main f3a7d42f5c. The Windows leg also hit the runner's lsof apt install retry.

The policy HOLD still stands as you wrote it: the remaining blocker is the fork Sensitive Change Review, so this needs a security-owner review here or the upstream copy. Happy to rebase again or carve anything out if that helps.

@Maqix

Maqix commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Opus 5.5 review of 7d4e73088: fixed in 91f01dccd0 (still one commit, merges cleanly with main).

  • The own-line hint regex now matches the separator first and trims the blanks around it in Python, instead of opening with [ \t]*. On the 20,000-blank shape it drops from 3.3 s to 0.3 s and grows 2.0x per doubling. The rewritten text is the same on 213,519 strings. New test test_the_own_line_hint_is_linear_in_a_run_of_blanks fails on 7d4e73088 and passes now.
  • The per-line inert check had the same kind of cost, and it is this PR's code, so I fixed it here too instead of only in fix(security): allow an env-prefixed push after a multi-line message #20854. The masked rest of the command is the same for every quoted line, so it is now read once per command (_inert_rest). On 1,250 quoted push lines in 19 KB, is_denied drops from 5.4 s to 0.9 s, 2.0x per doubling, with 0 differences in _inert_quoted_line_heads on 102,240 multi-line commands. New test test_the_inert_head_check_reads_the_command_once_not_per_line.

Verdicts: 0 flips vs 7d4e73088 on every sweep (c92, c93 hint-aware, probe 6,688, nested 2,268). Budget 32,834.

@iamwhatever @cruisercohen could you approve the workflow runs on 91f01dccd0? After that, the hold still needs a security-owner review, or the upstream copy offered earlier; I'm glad to help with either.

@Maqix

Maqix commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Opus 5.5 review of 91f01dccd: fixed in 5c496983b5 (one commit; #20854 restacked on it as 1a06557737).

  • The assignment value in the hint's lookahead now stops at a separator, (?:\w+=[^\s;&|]*\s+)*, as you suggested and as bash reads it. The ;a= run after the push drops from 1.2 s to 0.26 s at 6,000 repeats and grows 2.0x per doubling.
  • test_the_own_line_hint_is_linear_in_a_run_of_blanks now pumps the ;a= input too. It fails on 91f01dccd and passes now.
  • The hint text changes on 73 of 208,415 random strings, all where the old \S* let an assignment value run across ;, & or |. On the c93 hint-aware sweep (11,026 commands), 0 verdict flips and 0 reason differences vs 7d4e73088. The other sweeps (c92, probe 6,688, nested 2,268) are unchanged too.
  • Budget 32,835.

@iamwhatever could you approve the runs on 5c496983b5 and 1a06557737?

@Maqix

Maqix commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Every AI lane passed on 5c496983b5, but my new linearity test failed Backend Tests (3.12, 3) there: CI runs it under coverage, and a 20,000-blank pump through the whole is_denied cost 3.1 s against the 2.0 s budget (0.3 s without coverage; linear either way).

Fixed in 224650db38 (#20854 restacked as 4c940ca7a0): the hint's separator pattern is now deny_gate._OWN_LINE_SEPARATOR_RE, and the test times that pattern alone at full size, for both the blank run and the ;a= run. One short pump still goes through is_denied. The test still fails on both old patterns (2.89 s at 20,000 blanks; 99x for 10x on ;a=). Same pattern, so no verdict or hint text changes. Budget 32,840.

Sorry for the extra round. @iamwhatever could you approve the runs on the two new heads?

@Maqix

Maqix commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Daily follow-up. Rebased again: main #25172 added one line to the security package, so only the package line budget clashed. New head d79db3dc61 (one commit on main d42544f622, merges cleanly; budget 33,027). The stacked #20854 is rebuilt on it as b2350bd55b.

No rule or verdict changed since 5c496983b5, where every AI lane passed (Opus, GPT, Security Scope, Design, First Principles). Since then: the coverage-safe timing test (224650db38) and three budget-only rebases. Sweeps vs the previous head: 0 verdict flips, 0 masked-reason diffs.

The AI lanes on the previous head 3bcc7f107d did not produce a verdict (Opus/GPT/Content Scan "could not run", Security Scope "no leg reported"). Design and First Principles passed there.

@iamwhatever could you approve the workflow runs on d79db3dc61 (and on #20854's b2350bd55b)? This PR is still waiting on a security-owner review. An upstream copy of this commit is also fine with me if that is easier.

@Maqix

Maqix commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Daily follow-up on head ebe6632607 (one commit on main 383338d877, merges cleanly with current main). The stacked #20854 sits on it as 374491028d.

Since 5c496983b5, where every AI lane passed (Opus, GPT, Security Scope, Design, First Principles), the only changes are the coverage-safe timing test (224650db38) and budget-only rebases. No rule or verdict changed: 0 verdict flips on every sweep.

On ebe6632607: GPT 6.1, Design and First Principles pass. Two lanes did not reach a verdict:

  • Security Scope: "generate job did not finish" (pipeline fault). It passed on 9ab4aa619c, a budget-only rebase earlier.
  • Opus 5.5: has not posted on this head. Its last review, on 7d094193fe, had no blocking findings.

On #20854's 374491028d, every AI lane passes.

@iamwhatever could you re-run Security Scope and Opus on ebe6632607? This PR is still waiting on a security-owner review. An upstream copy of this commit is also fine with me if that is easier.

@Maqix

Maqix commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Daily follow-up on head 30a3a5e8b0, one commit on current main (fee6b974e9), merges cleanly. #20854 is restacked on it (8f2123b9ba).

main merged #24562, #26469 and #26456 since the last head. #26456 removed the _perm_verb_* facade names right next to this PR's _own_line_fix_applies, so I kept ours and dropped theirs; nothing else in the commit changed. I checked the rebase against the old head, the old main, the new head and the new main: no command this PR refused is allowed now, every new refusal is one main also makes, and no protected push gets through. Gates pass (2,142 tests).

@iamwhatever @bolichen97 could one of you approve the workflow runs on 30a3a5e8b0 and 8f2123b9ba? On earlier heads Opus, GPT, Design and First Principles all passed. This PR still needs a security-owner review, or the upstream copy offered earlier.

_split_push_command_segments ended a segment at every newline, including
one inside quotes. The next segment's quote walk then restarted unquoted,
so the closing quote of a multi-line commit message opened a new quote
that swallowed the following && and turned a literal feature-branch push
into one unparseable word, refused as git-publish-target-unverifiable.

A literal newline inside quotes is now word data, like the other quoted
separators, but only while the quote walk can be trusted across lines.
The walk does not model heredocs, command/parameter/process substitution,
backticks or comments, where a phantom quote could hide the next line, so
a command holding any of them keeps the split at every newline. A merged
segment that does not parse as a push (quoted text that merely mentions
one, like printed instructions or a PR comment body) is read line by
line, exactly as before, so no quoted text is newly refused.
Unquoted and escaped newlines still split, so backslash-newline splices
keep failing closed, and a protected push after a multi-line message is
now reported as push-protected-branch-name.

kiro-cli titles a shell call `Running: <command>` and the deny tiers
judge that title too, so the inert-word proof reads through ONE exact
leading `running: ` (the prefix constant denied_rules already uses for
its exceptions, now defined beside the walk) and the live call gets the
verdict of the command it displays.

The refusal's "put the push on its own line" hint moves a push only at
an unquoted separator, and judges the rewritten command over every
nested shell payload, as the floor does. A separator inside the quoted
message, or a bash -c push to $b, earned the hint, and the command with
the push on its own line came back with the same refusal and the same
hint. The rewrite matches the separator first and trims the blanks
around it, so a long blank run costs linear time. An assignment value
stops at a separator, as in bash, so a run of ;a= is linear too. Verdicts do not
change.

The inert-head check now masks and judges the rest of the command once
and reuses that reading for every quoted line: only the judged word
differs between lines, and it masks to the same text. Read per line, it
rescanned the whole command for each one, quadratic in the line count.

The security spec paragraph and the package line budget are updated to
match.

Refs kirodotdev#12631
@Maqix

Maqix commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Daily follow-up. main merged another round of security-package changes, so I rebased again: this PR is now 25c0b37b50, one commit on current main (f45380e92a), and it merges cleanly. #20854 is restacked on it (37ce13f2ba). Only the line-budget pin changed (33,919, from main's 33,723).

Checked against the old head, the old main, the new head and the new main: no command this PR refused is allowed now, every new refusal is one main also makes, and no protected push gets through. Gates pass (2,142 tests).

@iamwhatever @bolichen97 could one of you approve the workflow runs on 25c0b37b50 and 37ce13f2ba? This PR still needs a security-owner review, or the upstream copy offered earlier.

@Maqix

Maqix commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@iamwhatever @bolichen97 @cruisercohen a direct question, since this has been open about a month.

Every head I push goes stale against main within hours, and each new head needs a fresh run approval. A fork PR also can't clear Sensitive Change Review. So I can't land this from here.

Would one of you take it over upstream: copy it to a branch in this repo and merge it there? Credit is up to you. If you'd rather not have this change at all, that's fine too, just say so.

If there's no reply here by tomorrow (Nov 5, about 12:00 CET), I'll close this PR to keep your queue clean.

@Maqix

Maqix commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing this, as said above. Thanks @iamwhatever @bolichen97 @cruisercohen for the reviews along the way. The branch stays on my fork if anyone wants to pick it up later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git-publish-* floor refuses literal git push [flags] origin feature-branch

2 participants