Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [ ] Authorization and SQL-injection implications were reviewed.
- [ ] 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.

## Test evidence / exceptions

Expand Down
4 changes: 3 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ For changes that affect `src/` or live behavior:
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.
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.
10. Merge only after the maintainer accepts any recorded live-system limitations. Pull the resulting `master`, verify Release Please behavior, and do not manually tag an ordinary release.
10. Merge only after the maintainer accepts any recorded live-system limitations. Use GitHub's squash merge so the reviewed PR lands as one Conventional Commit; do not expose red/green/audit workflow commits on `master`. Pull the resulting `master`, verify Release Please behavior, and do not manually tag an ordinary release.

For a source-only candidate, a controlled direct source deployment is preferable to switching the shared native-abapGit repository away from `master`. Record the candidate commit/hash and activate only the intended object. Structural changes still require a real native-abapGit round trip and may need a dedicated package/system to avoid changing shared objects underneath other work.

For a coordinated structural-object round trip, refresh native abapGit before staging, review all system/Git drift, and select only the intended object. Never use **Add All** when unrelated changes are present. Review the staged filenames before commit, record every intentionally unselected drift item, push, refresh again, and require the intended object to be clean.

If ARC-1's pre-write linter selects the wrong ABAP release, bypass only that local lint step after the repository's pinned abaplint gate is green. Keep server preflight, explicit activation, SAP syntax, Unit, ATC, and object-state verification enabled, and record the tooling mismatch in the findings register.

ZTOAD's report source is large enough that streaming a complete `SAPWrite` JSON payload through stdin can return `EAGAIN`. If that occurs, create a bounded temporary JSON payload file, pass its path to ARC-1, and verify the subsequent write before activation; never interpret the failed streamed request as a deployed candidate. Capture very large ATC JSON to a temporary file and emit an exact count/priority/prerequisite summary so terminal truncation cannot corrupt the evidence.

If ARC-1 authentication or a live system is unavailable, local checks may continue, but do not claim live validation. Record the missing gate in the PR and complete it before merge unless the maintainer explicitly accepts the risk.

NPL currently lacks ZTOAD's transparent table. SAP_BASIS 750 has no ADT transparent-table create endpoint, so ARC-1 cannot provision it safely. Never substitute a DDIC structure. Until the real table is provisioned outside the ADT-only workflow, record NPL ZTOAD activation/syntax/Unit/ATC as blocked even though the ARC-1 object lifecycle itself is proven usable.
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ddic tree
Tips : You can search a table in the tree using header clic

Managed queries
SELECT, INSERT, UPDATE, DELETE, Any native SQL command
SELECT, INSERT, UPDATE, DELETE

About New SQL Query Syntax
You could use new syntax (if your SAP system manage it)
Expand Down Expand Up @@ -95,11 +95,7 @@ In this SQL editor, you have 2 ways to do an INSERT :
- By passing value of used fields only
`INSERT SEOCLASSTX SET CLSNAME = 'ZZMACLASS' DESCRIPT = 'TeSt class'`

Native SQL special syntax
To execute a native SQL command, please add the prefix NATIVE
before your query
`NATIVE CREATE INDEX 'TESTINDEX' ON T001 (MANDT, WAERS, BUKRS)`
`NATIVE DROP INDEX 'TESTINDEX'`
Native SQL is intentionally rejected. Database-specific statements belong in audited database-administration tooling, not in ZTOAD.

## Sample queries

Expand All @@ -125,14 +121,13 @@ before your query
You could define your authorization object to restrict function usage by user.
If you dont define auth object, all users will have same access as defined bellow.
The auth object have 2 fields TABLE and ACTVT
ACTVT can take 5 values that you could define here.
ACTVT can take 4 values that you could define here.
By default :

- 01 for INSERT command
- 02 for UPDATE command
- 03 for SELECT command
- 06 for DELETE command
- 16 for EXECUTE NATIVE SQL command
- TABLE contain allowed table name pattern

The Authorization object name ist `ZTOAD_AUTH`.
Expand Down Expand Up @@ -162,7 +157,7 @@ No you define globally the authorizations:
auth_update TYPE string VALUE space, "'*',
* Allow DELETE query on SAP table (restricted by given pattern)
auth_delete TYPE string VALUE space, "'*',
* Allow any native sql command (set value to space to disable)
* Deprecated and ignored; Native SQL cannot be enabled
auth_native(1) TYPE c VALUE space, "abap_true,
```

Expand Down
18 changes: 9 additions & 9 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-bug-006` · 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-002` · 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,17 +9,17 @@ 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,878 findings across 58 rules; `master` baseline 1,857 across 57 | Existing debt plus 19 adapter naming and 2 legacy exception-contract findings; reproducible locally, not an immediate all-or-nothing gate |
| A4H SAP syntax | 0 errors, 4 warnings | Program compiles on SAP_BASIS 758 |
| A4H ABAP Unit | 19 passed, 0 failed | Parser, generator, command, line-splitting, and editor-policy tests are green |
| Pinned abaplint default profile | 1,841 findings across 58 rules; pre-fix branch baseline 1,878 | Removing the Native SQL executor reduced diagnostic debt by 37; remaining debt is reproducible locally, not an immediate all-or-nothing gate |
| A4H SAP syntax | 0 errors, 3 warnings | Program compiles on SAP_BASIS 758; the unsupported kernel-call warning is gone |
| A4H ABAP Unit | 20 passed, 0 failed | Parser, generator, command, line-splitting, and editor-policy tests are green |
| 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` | 768 findings: 463 priority 1, 305 priority 2 | Current classic report is not ABAP Cloud compatible |
| A4H ATC `ABAP_CLOUD_READINESS` | 759 findings: 457 priority 1, 302 priority 2 | Nine findings removed with the Native SQL sink; current classic report remains non-Cloud-compatible |
| A4H WebGUI smoke | Editor startup/input passed; query dispatch blocked | Final editor renders and accepts text without a new dump; installed GUI status `STATUS010` is missing (`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 |

The four normal syntax warnings on the BASE-RUN-001 candidate are POSIX-regex deprecation at lines 1965, 1988, and 2114, plus the unsupported `C_DB_EXECUTE` call at line 4118.
The BASE-RUN-001 candidate had four normal syntax warnings: three POSIX-regex deprecations plus unsupported `C_DB_EXECUTE`. The BASE-SEC-002 candidate removes the kernel call, leaving only the three known regex warnings.

The BASE-BUG-001 parser/generator baseline remains green inside the current 19-test suite. The current `ABAP_CLOUD_READINESS` result is 768 findings (463 P1, 305 P2). The latest `S4HANA_READINESS_2023` run returned no rows but is incomplete because seven prerequisite checks are unavailable. See the [finished BASE-BUG-001 plan](plans/finished/base-bug-001.md) and the [BASE-RUN-001 research](research/2026-08-06-base-run-001-webgui-editor-root-cause.md) for exact evidence.
The BASE-BUG-001 parser/generator baseline remains green inside the current 20-test suite. The current `ABAP_CLOUD_READINESS` result is 759 findings (457 P1, 302 P2). The latest `S4HANA_READINESS_2023` run returned no rows but is incomplete because seven prerequisite checks are unavailable. See the [finished BASE-BUG-001 plan](plans/finished/base-bug-001.md) and the [BASE-SEC-002 research](research/2026-08-06-base-sec-002-native-sql.md) for exact evidence.

## Ordered findings register

Expand All @@ -29,7 +29,7 @@ Priority meanings: **P0** blocks the requested test workflow or is an immediate
|---|---:|---|---|---|
| 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 becomes dynamic Open SQL and generated ABAP (`GENERATE SUBROUTINE POOL`, lines 2310 and 3657). Parser-derived table/field/tail tokens are not validated through a strict include list. | Malicious/ambiguous table, column, `WHERE`, `HAVING`, subquery, comment, and quoted-keyword cases; verify rejection before generation. | Open |
| BASE-SEC-002 | P0 | Native SQL uses unsupported kernel call `C_DB_EXECUTE` at line 3818. It is a high-impact arbitrary database-command path and produces a live compiler warning. | Authorization-negative test, default-disabled test, allow-list test against a disposable Z object, and no-kernel-call architecture test. | Open |
| 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 candidate: local gates green, A4H 20/20 green and warning removed, read-only startup produced no dump; exact NPL gate prerequisite-blocked because PROG/TABL ZTOAD are absent |
| 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-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 |
Expand Down Expand Up @@ -64,7 +64,7 @@ The program now ends with five 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_GENERATOR`: 3 tests for strict aggregate clause ordering plus escaped-count and legacy-select compatibility.
- `LTC_LINE_SPLITTER`: 3 tests for short lines, the 255-character boundary, and long-line splitting.
- `LTC_COMMAND_PARSER`: 3 tests for UPDATE, DELETE FROM, and NATIVE quote conversion.
- `LTC_COMMAND_PARSER`: 4 tests for UPDATE, DELETE FROM, default Native SQL rejection, and rejection despite the deprecated enable flag.
- `LTCL_EDITOR_CONFIGURATION`: 2 tests selecting the supported WebGUI text editor while retaining the desktop ABAP editor.

These are characterization tests: they make current behavior explicit without claiming that every behavior is correct. For each open bug, add the smallest failing regression test first, then implement the fix, then refactor while all earlier tests remain green.
6 changes: 4 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ Do not manually install only the report source. That omits the dynpros, table, a
7. Deploy the exact candidate source to SAP_BASIS 750 first through ARC-1/ADT when its real dependencies exist; record any missing ADT prerequisite as blocked. Keep the A4H native-abapGit link on `master` and record an unmerged candidate as a direct deployment. Follow every write with an explicit activation call, active/inactive main-object comparison, and an inactive-child-part query for affected composite objects; a write response, activation option, or equal main-source hash alone does not prove that screens, statuses, texts, and includes are active.
8. On NPL, activate only the intended object and run active syntax, all ABAP Unit tests, and complete ATC variants through ARC-1. On A4H/SAP_BASIS 758, repeat those checks and additionally start a fresh browser session for safe smoke and ST22 delta. Verify required dynpros/GUI statuses before attributing an end-to-end failure to the source candidate.
9. If a correction must be made in SAP, export it through native abapGit or reproduce it locally, then review every serialized/source difference. Never leave an unexported system-only fix.
10. Perform a final review, update evidence, commit/push the short-lived branch, open the PR, and wait for CI. After the first green run, audit the process/CI, update guidance in the same PR, move the plan to `docs/plans/finished/`, push, and wait again.
10. Perform a final review, update evidence, commit/push the short-lived branch, open the PR, and wait for CI. After the first green run, audit the process/CI, update guidance in the same PR, move the plan to `docs/plans/finished/`, push, and wait again. After maintainer acceptance, use GitHub's squash merge so the PR lands as one Conventional Commit even though its branch preserves red/green/audit history.

Always test 7.50 first when the destination and the candidate's real dependencies are available. A change that uses newer syntax may appear correct on 2023 yet be impossible to activate on the compatibility floor. The `arc-1-750` profile and ADT lifecycle are configured and proven; exact ZTOAD validation remains blocked while transparent table `ZTOAD` is absent because SAP_BASIS 750 cannot create transparent tables over ADT. See [the NPL dossier](research/2026-08-06-npl-adt-only-validation.md).

Native abapGit branch switching changes real system objects, and abapGit Flow remains beta. Do not use either casually in the shared package. Structural-object PRs may require a dedicated package/system or an explicitly coordinated temporary branch procedure.

If ARC-1's pre-write linter reports an incorrect ABAP release, do not weaken all write checks. After the pinned repository abaplint gate passes, disable only the mis-profiled local lint request, retain server preflight, activate explicitly, and run SAP syntax/Unit/ATC/object-state checks. Track the tool mismatch separately from the product change.

For the large ZTOAD report, an ARC-1 stdin write can fail with `EAGAIN` before SAP receives the source. Retry through a bounded temporary JSON payload file, then require a successful write response and explicit activation. Large ATC result JSON can exceed terminal output limits; capture the complete result first and derive exact finding counts, priority counts, and prerequisite errors from that complete payload rather than parsing truncated console text.

## 5. Structural object changes

Examples include adding issue #2's transaction code, changing the table definition, changing dynpros or text elements, and adding a global class.
Expand Down Expand Up @@ -183,7 +185,7 @@ For every relevant change, verify:
- values are bound or safely quoted instead of concatenated where possible;
- comments, aliases, nested expressions, subqueries, and unions cannot hide additional statements;
- row limits remain enforced unless the user explicitly requests the documented override;
- native SQL remains disabled by default;
- Native SQL remains unconditionally rejected and forbidden sinks such as `C_DB_EXECUTE` do not return;
- error/generated-code displays do not leak credentials or confidential values.

Run ATC security checks on the live systems. Local abaplint cannot prove runtime authorization or dynamic-SQL safety.
Expand Down
Loading