Skip to content
Merged
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [ ] ATC prerequisite/check errors were reviewed; an incomplete run is not reported as zero findings.
- [ ] Authorization and SQL-injection implications were reviewed.
- [ ] Security claims distinguish proven entry-point reachability from sink-level behavior and state actor prerequisites, or this is not applicable.
- [ ] Generated/transformed input was reviewed on both sides of representation boundaries (comments, quoting, escaping, wrapping, and token/line splitting), or this is not applicable.
- [ ] New or changed logic has ABAP Unit coverage where technically feasible.
- [ ] Documentation and changelog impact were considered.
- [ ] The accepted PR will use squash merge and a Conventional Commit PR title.
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For changes that affect `src/` or live behavior:
3. Add the smallest failing regression test and replay it against the original production code so the intended red failure is recorded.
4. Write an implementation/test/rollback plan in `docs/plans/`, including ABAP 7.50 compatibility, Clean ABAP/Clean Core, abaplint, ABAP Unit, live activation/syntax/ATC, safe browser smoke, and ST22 delta. For security findings, distinguish demonstrated sink behavior from proven end-to-end entry-point reachability and state the actor prerequisites plus invariant without overclaiming. Review the plan before production changes.
5. Implement the smallest change that turns the test green. Refactor only while the complete suite remains green. For frontend, database, authorization, or other environment-dependent assumptions, treat the first green implementation as a spike until a live integration test confirms it. Edit source locally for source-only changes; create structural SAP objects in a development system and export them with native abapGit instead of inventing serializer XML.
6. Run `npm ci`, `npm test`, `git diff --check`, a complete diff review, and the relevant security/authorization review. Freeze the source/repository-object candidate in a commit before expensive live validation and record its commit plus source hash. Any subsequent `src/` or serialized-object change invalidates syntax, Unit, ATC, and smoke evidence and requires those affected gates to be rerun. Deploy the exact candidate to each available SAP target without pretending that the shared abapGit `master` link represents an unmerged branch.
6. Run `npm ci`, `npm test`, `git diff --check`, a complete diff review, and the relevant security/authorization review. When input is generated, wrapped, split, serialized, or otherwise transformed before execution, compare security semantics on both sides of that representation boundary; comments, quoting, escaping, length limits, and line/token boundaries must not hide behavior. Freeze the source/repository-object candidate in a commit before expensive live validation and record its commit plus source hash. Any subsequent `src/` or serialized-object change invalidates syntax, Unit, ATC, and smoke evidence and requires those affected gates to be rerun. Deploy the exact candidate to each available SAP target without pretending that the shared abapGit `master` link represents an unmerged branch.
7. On SAP_BASIS 750 first when available, then S/4HANA 2023, require controlled activation, active syntax, all ABAP Unit tests, and complete ATC runs or explicit prerequisite failures. An ARC-1 write acknowledgement or `activate=true` request is not activation evidence: call activation explicitly, require active/inactive main-object equality, and query inactive child parts (including screens, GUI statuses, text elements, and includes) for every changed composite object. Main-source equality alone is not a pass when a child part remains inactive. Run a fresh-session safe browser smoke and ST22 delta on A4H only. A failed/unavailable gate is never a pass. After evidence is complete, restore every directly deployed object on a shared target to the intended `master` state and verify activation/object state, unless the maintainer explicitly reserves that candidate for the next task.
8. Perform a final implementation review, update finding evidence, commit with a Conventional Commit subject, push the branch, open a pull request, and wait for required CI to become green.
9. After the first green PR run, audit the plan, implementation, test evidence, CI output, and development process. Apply useful process/documentation improvements to the same PR, move its plan to `docs/plans/finished/`, push, and wait for CI again. Record the final green run in the PR description or a PR comment; do not create a new evidence-only commit that invalidates the checked head.
Expand Down
20 changes: 10 additions & 10 deletions docs/baseline-findings.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ZTOAD baseline findings

_Snapshot: 2026-08-06 · branch `codex/fix-base-sec-001` rebased after BASE-SEC-002 · live system A4H client 001, SAP_BASIS 758 SP02 · secondary target NPL client 001, SAP_BASIS 750 SP02_
_Snapshot: 2026-08-06 · branch `codex/fix-base-sec-003` rebased after BASE-SEC-002 and BASE-SEC-001 · live system A4H client 001, SAP_BASIS 758 SP02 · secondary target NPL client 001, SAP_BASIS 750 SP02_

This is the ordered work list for incremental TDD. It records observed defects separately from broad style debt so a new failure cannot disappear inside the legacy backlog. A finding is closed only after its regression test is green locally where possible, green on A4H, and green on the SAP_BASIS 750 target.

Expand All @@ -9,15 +9,15 @@ This is the ordered work list for incremental TDD. It records observed defects s
| Gate | Result | Interpretation |
|---|---|---|
| Repository `npm test` | Passed, 0 configured abaplint findings | Fast compatibility/XML gate is green |
| Pinned abaplint default profile | 1,949 findings across 59 rules; post-BASE-SEC-002 `master` baseline 1,841 across 58 | The added validator/splitter tests account for the reviewed increase; configured abaplint remains at zero |
| A4H SAP syntax | 0 errors, 2 warnings | The merged Native SQL sink and its warning are absent; replacing the regex splitter removed another POSIX warning |
| A4H ABAP Unit | 40 passed, 0 failed | The combined suite covers Native SQL retirement, generated-fragment validation, and representation-safe wrapping |
| Pinned abaplint default profile | 2,030 findings across 59 rules | Configured abaplint remains at zero and is the merge gate; the full default profile is a diagnostic debt inventory |
| A4H SAP syntax | 0 errors, 2 POSIX warnings | The exact integrated source activated successfully; both warnings are pre-existing compatibility findings |
| A4H ABAP Unit | 55 passed, 0 failed | The combined suite covers all three P0 security fixes |
| A4H ATC `S4HANA_READINESS_2023` | Initial run displayed 0 finding rows | Later evidence shows missing prerequisites; this is not an authoritative zero gate |
| A4H ATC `ABAP_CLOUD_READINESS` | 667 findings: 461 priority 1, 206 priority 2 | Exact post-rebase inventory; still an architectural burn-down signal, not a zero gate |
| A4H WebGUI smoke | Fresh editor startup passed; no SQL executed and no ST22 delta | Editor and DDIC panes render without browser errors; missing `STATUS010` remains `BASE-BUG-007` |
| A4H ATC `ABAP_CLOUD_READINESS` | 668 findings: 462 P1, 206 P2 | Architectural burn-down signal; not a zero gate |
| A4H WebGUI smoke | Fresh editor/DDIC startup passed; no browser error, SQL execution, or ST22 delta | Missing `STATUS010` remains independently tracked as `BASE-BUG-007` |
| ABAP 7.50 live gate | ARC-1 lifecycle passed; ZTOAD blocked | `arc-1-750` can create/activate/syntax/unit/delete, but ZTOAD's transparent table is absent and SAP_BASIS 750 cannot create it over ADT |

BASE-SEC-002 is merged and its Native SQL sink is absent from this candidate. The exact rebased source SHA-256 is `58dc34ebe9a5d18863fd0f26d863ba8ed78e132789d663dde417aeaabac567eb`; A4H active/inactive source matches at server-normalized SHA-256 `7a6bf2dc6c43fb598fbf2dee8bbc646d5070d5ae8a83380a2153a50ebae9dd73`. Coverage is 21.86% statements, 19.23% branches, and 14.81% procedures. `S4HANA_READINESS_2023` again returned zero rows but remains incomplete because known prerequisites are unavailable. See the [finished BASE-SEC-001 plan](plans/finished/base-sec-001.md), [BASE-SEC-002 research](research/2026-08-06-base-sec-002-native-sql.md), and [BASE-BUG-001 plan](plans/finished/base-bug-001.md).
BASE-SEC-002 and BASE-SEC-001 are merged and their complete production/test corpus is preserved in this candidate. The exact integrated source SHA-256 `339a53f579fcde6b95dee08841a421fbe510839d06113902c800b6c28eee5397` matched the activated A4H source at server-normalized SHA-256 `46789b7a44ac06953e9a69a03f19199d6192ebf10327aa24c3e13c77d1e9c654`. Coverage was 25.07% statements, 24.10% branches, and 16.87% procedures. `S4HANA_READINESS_2023` returned no rows but remains incomplete because its prerequisite checks are unavailable. See the [finished BASE-SEC-003 plan](plans/finished/base-sec-003.md), [finished BASE-SEC-001 plan](plans/finished/base-sec-001.md), and [BASE-SEC-002 research](research/2026-08-06-base-sec-002-native-sql.md).

## Ordered findings register

Expand All @@ -26,9 +26,9 @@ Priority meanings: **P0** blocks the requested test workflow or is an immediate
| ID | Pri. | Finding and evidence | Test to drive the fix | Status |
|---|---:|---|---|---|
| BASE-RUN-001 | P0 | ZTOAD originally dumped in WebGUI through `DP_PUBLISH_URL`; a rejected SQL-mode spike then dumped in `CL_GUI_SOURCEEDIT`. The final adapter uses `CL_GUI_TEXTEDIT` in WebGUI and keeps `CL_GUI_ABAPEDIT` elsewhere. | Two editor-policy Unit tests plus fresh WebGUI launch/input and post-run ST22 delta. | Fixed candidate: 19/19 green, editor renders and accepts input, no new dump; full query dispatch waits on `BASE-BUG-007` |
| BASE-SEC-001 | P0 | User text reached both generated-program sinks, and the original code accepted a harmless `.<space>WRITE sy-uname` statement-injection proof as valid ABAP. External review also confirmed that the 255-character hard cut could split a doubled quote while still producing a pool. | Direct SELECT/DML generator regressions plus a pure boundary matrix for literals, decimals, operators, comments, host escapes, templates, chained statements, unbalanced quotes, namespace-shaped period lookalikes, and safe generated-line wrapping. | Fixed candidate: exact post-#18 source is 40/40 green on A4H; unsafe fragments/layouts return no pool and no SQL was executed |
| BASE-SEC-001 | P0 | User text reached both generated-program sinks, and the original code accepted a harmless `.<space>WRITE sy-uname` statement-injection proof as valid ABAP. External review also confirmed that the 255-character hard cut could split a doubled quote while still producing a pool. | Direct SELECT/DML generator regressions plus a pure boundary matrix for literals, decimals, operators, comments, host escapes, templates, chained statements, unbalanced quotes, namespace-shaped period lookalikes, and safe generated-line wrapping. | Fixed and merged in PR #20; inherited by this 55/55 integrated candidate |
| BASE-SEC-002 | P0 | Native SQL used unsupported kernel call `C_DB_EXECUTE`. It was a high-impact arbitrary database-command path and produced a live compiler warning. | Default rejection, rejection despite the deprecated enable flag, preserved UPDATE/DELETE parsing, and a no-kernel-call repository contract. | Fixed and merged in PR #18; inherited by this candidate |
| BASE-SEC-003 | P0 | SELECT authorization extraction tokenizes top-level `FROM`/`JOIN` text and can miss nested subqueries/CTEs or concealed data sources. | Multi-table joins, nested subqueries, aliases, comments, quoted identifiers, UNION branches, and unauthorized inner-table cases. | Open |
| BASE-SEC-003 | P0 | SELECT authorization extraction tokenized top-level `FROM`/`JOIN` text and could miss nested subqueries/CTEs or concealed data sources. A quote-aware scanner now applies the existing policy to every provable physical source and rejects unprovable dynamic/CTE/comment/path/hierarchy syntax, including attached path tokens. | Multi-table joins, nested subqueries, aliases, literal keywords, scanner-level comment rejection, `UNION`/`UNION ALL` sources, attached/detached paths, hierarchy/keyword lookalikes, and unauthorized inner-table cases. | Fixed candidate: exact integrated source is 55/55 green on A4H; parenthesized joins deliberately fail closed |
| BASE-BUG-001 | P1 | [Issue #6](https://github.com/marianfoo/ztoad/issues/6): a reported `SELECT DISTINCT ... COUNT ... MAX ... GROUP BY ... HAVING` query produces “The INTO/APPENDING clause must be at the end of the SELECT.” | Sanitized `DD03L` reproduction; check exact generated ordering around `HAVING`, `ORDER BY`, `UP TO`, and `INTO TABLE`. | Fixed and 17/17 green on A4H; live 7.50 pending |
| BASE-BUG-002 | P1 | [Issue #7](https://github.com/marianfoo/ztoad/issues/7): a reported `SUM( CASE ... END ) AS ...` over `EKBE` produces “No component exists with the name CASE.” The expression is split into false result components. | Sanitized aggregate with multi-line `CASE`, qualified fields, multiplication, alias, WHERE, and GROUP BY; assert one aggregate expression and the expected generated row type. | Open |
| BASE-BUG-003 | P1 | [Issue #4](https://github.com/marianfoo/ztoad/issues/4): `SUBSTRING`/`CONCAT` produce “No component exists with the name SUBSTRING(”, exposing naïve select-list tokenization. | Nested function arguments, commas inside functions, aliases, literals containing spaces/commas, and function composition. | Open |
Expand Down Expand Up @@ -59,7 +59,7 @@ This diagnostic profile is intentionally not the merge gate yet. Run `npm run li

The program now ends with six harmless, short ABAP Unit classes:

- `LTC_QUERY_PARSER`: 8 tests for simple SELECT, default/explicit/unlimited limits, tail clauses, UNION separation, comma syntax, caller `INTO` removal, and missing `FROM` rejection.
- `LTC_QUERY_PARSER`: 23 tests for the original SELECT contract plus authorized/unauthorized nested sources, two-level nesting, ordinary and parenthesized joins, literal/identifier keyword lookalikes, scanner-level comment rejection, later `UNION`/`UNION ALL` sources, and fail-closed dynamic/CTE/attached-path/detached-path/hierarchy sources.
- `LTC_QUERY_INPUT_VALIDATOR`: 12 tests for the supported SQL-fragment alphabet, literal state, decimals/minus, and source-boundary rejection.
- `LTC_QUERY_GENERATOR`: 5 tests for strict aggregate clause ordering, escaped-count and legacy-select compatibility, statement-injection rejection, and doubled-quote wrapping rejection.
- `LTC_LINE_SPLITTER`: 6 tests for short/exact/long safe lines, unsafe hard-cut and literal-space rejection, and column-one comment prevention.
Expand Down
Loading