Skip to content

test(sql-server): prove the read path against a local SQL Server container - #11703

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-9878-41236216368-1
Oct 31, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-9878-41236216368-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Refs: #9878

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Adds plugins/sql-server/integration/read-path.mjs. The script starts an mcr.microsoft.com/mssql/server:2022-latest container (Developer edition), creates a read-only login (db_datareader in app only) and a second database, other, and drives the real stdio server over JSON-RPC on a registration confined to app. It prints one PASS or FAIL line each for S1/S2, S5, S6 and S7. Without a reachable Docker daemon it prints SKIP: docker not available and exits 0. Design choices: (1) The script is outside test/ so node --test (npm test) does not pick it up. (2) The executor keeps tedious's certificate checks on (encrypt true, trustServerCertificate default false, per the tedious docs), so the container's own self-signed cert would be refused. The script instead generates a cert for localhost, mounts it through mssql.conf as Microsoft's container TLS guide shows, and trusts it through ca for the sa connection and NODE_EXTRA_CA_CERTS for the server process. The plugin code is unchanged. (3) A refusal counts only when it is the right kind. A statement the reject list lets through (SELECT NEXT VALUE FOR, which needs UPDATE on the sequence) must meet a permission refusal. Every write is also sent straight to the server as the read-only login, past the reject list, and must be refused with a permission error. The database is fingerprinted as sa before and after. After every attempt, sa checks that no plugin session holds an open transaction.

Remaining work

  • Run node plugins/sql-server/integration/read-path.mjs on a Linux host with Docker and confirm it exits 0 with one PASS line each for S1/S2, S5, S6 and S7, and that without Docker it prints only SKIP: docker not available. The script has not been executed yet

Not verified

  • The script was never executed. This lane has no Docker, and Bash cannot run node, so neither the PASS path on a Docker host (done-when item 1) nor the SKIP path (item 2) was observed. No CI job runs this script. A person has to run npm ci --prefix plugins/sql-server and `node plugins/sql-server/in
  • npm test --prefix plugins/sql-server and any lint were not run here (no node). Left to the PR's CI test-node lane. The new file is outside the default node --test patterns, so it adds no unit test
  • ci-status green on the PR head (done-when item 3) is left to the PR's CI
  • Tidy was skipped: the change is over the 300-changed-line cutoff, because the new script alone is over 500 lines
  • Review finding not acted on: the S6 scan of config and registration files the test wrote itself partly confirms itself. Kept, because the issue asks for exactly that scan; the plugin files and server output are scanned too
  • Review finding left out of scope: the existing README section 'The reject list' (lines 102-106) says SELECT 1 AS a RECEIVE ... and ENABLE TRIGGER pass when they follow a SELECT with no semicolon. The reviewer cites a community source that the engine may reject DISABLE/ENABLE TRIGGER there as a s
  • Hosts the reviewer flagged that may fail setup rather than SKIP: arm64 without x86-64 emulation, SELinux-enforcing Docker (bind mounts may need :z), and snap-packaged Docker (private /tmp). Not verified and not handled
  • The working tree shows untracked files this run did not create (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc at the checkout root). They are left untouched and are not part of this change

Fix

  • plugins/sql-server/integration/read-path.mjs: new integration script covering the container, TLS, fixtures, MCP stdio client, the S1/S2, S5, S6 and S7 checks, SKIP without Docker, and cleanup of the container, temp dir and child process on every exit path, including SIGINT and SIGTERM
  • plugins/sql-server/README.md: new 'Integration test' subsection with the commands (npm ci, then node plugins/sql-server/integration/read-path.mjs), the setup, a table of what each check passes on, the exit codes and the SKIP line
  • .changes/sql-server/work-resolve-issue-issue-9878-4d2a9c71.md: patch changelog fragment (Added) for the integration test. Written by hand because new-changelog-fragment refuses a detached HEAD

Verification

The runner ran each check from the base copy against a339152:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • check-changelog-fragments: All 9 changelog fragment(s) under .changes/ are valid (run before and after the review fixes)
  • check-affected: 11 passed, 7 skipped (shellcheck, ruff, typos and changed-skills not applicable or not installed; three validate-plugins sub-checks skipped as tree-executing) over 3 changed files (run before and after the review fixes)
  • fresh-context review subagent (opus) over the whole diff. Confirmed findings, all fixed: any error used to count as the login's refusal, and the parse-error-prone SELECT 1 AS a DISABLE TRIGGER attempt was replaced, so permission refusals are now required. Writes are now also sent directly as the r
  • read https: //tediousjs.github.io/tedious/api-connection.html: encrypt defaults to true, trustServerCertificate defaults to false, serverName defaults to server, cryptoCredentialsDetails is passed to tls.createSecureContext, and execSqlBatch takes no parameters
  • read https: //learn.microsoft.com/en-us/sql/linux/sql-server-linux-docker-container-security: SQL Server 2019+ containers run as non-root mssql (uid 10001); TLS is set up with an openssl self-signed cert, an mssql.conf [network] tlscert/tlskey/tlsprotocols/forceencryption, and bind mounts of all t
  • read https: //learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker: the image tag is mcr.microsoft.com/mssql/server:2022-latest, Developer edition is the default, and the sa password policy needs at least 8 characters from 3 of 4 character sets
  • read https: //learn.microsoft.com/en-us/sql/t-sql/functions/next-value-for-transact-sql: NEXT VALUE FOR needs UPDATE permission on the sequence or its schema
  • read https: //learn.microsoft.com/en-us/sql/t-sql/statements/disable-trigger-transact-sql: disabling a DML trigger needs ALTER on the table
  • read https: //learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-sessions-transact-sql: everyone can see their own session; transaction_isolation_level 2 is ReadCommitted; the view has lock_timeout and open_transaction_count columns
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41236216368

Left out: the items under Not verified.

Related

#9878

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 151a5bf3131390880dcfa305ff4b379f01a19111: 0 finding(s), 0 as inline comments.

No security issues in the incremental change (critical-findings: 0).

What I reviewed:

  • Generated copies: plugins/sql-server/lib/prerequisites.{mjs,sh,ps1} are generated copies of the shared lib/prerequisites.* checker. scripts/shared-copies.txt adds the three matching lines. The .mjs copy has 748 lines against 746 for the canonical file, which fits the two added GENERATED header lines. I did not compare the contents line by line, since I had no shell to diff them.
  • prerequisites.mjs and prerequisites.sh input handling:
    • Probe commands come only from the plugin's own prerequisites.json. They run with spawnSync and an argument array, so there is no shell, and with cwd set to the lib directory.
    • The eval in the .sh node-notice mode runs only after the option name passes the *[!A-Z0-9_]* case filter.
    • Session ids are sanitized to [A-Za-z0-9_-] before they become a marker or latch file name.
    • Nothing in this change takes pull request or issue text as input.
  • prerequisites.json: it declares one optional docker CLI entry and detects it by name on PATH. It installs nothing and runs nothing.
  • Manifests and trusted paths: no plugin.json or marketplace.json changed, so there are no manifest flags. None of the changed files matches a trusted path.
  • Spend: none. Nothing here bills.

I did not re-read the other files in this pull request. They are unchanged since the last review.

@melodic-automation-lanes

melodic-automation-lanes Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 151a5bf3131390880dcfa305ff4b379f01a19111. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 151a5bf3131390880dcfa305ff4b379f01a19111: 0 finding(s), 0 as inline comments.

Incremental review of what changed since a339152: the sql-server plugin now declares its prerequisites. The change adds plugins/sql-server/prerequisites.json (one optional docker entry) and three vendored copies, lib/prerequisites.{mjs,sh,ps1}. It also adds the three matching lines to scripts/shared-copies.txt. I found nothing to flag.

  • Vendored copies: the .mjs, .sh and .ps1 files carry the "GENERATED from lib/prerequisites.*" header. The shared-copies.txt lines follow the existing app-control pattern (canonical lib/prerequisites.* → plugin copy). I could not run a diff against the canonical lib/ files because this lane has no shell. I only confirmed the canonical file exists and carries the same export function main. Drift between the copies and the canonical files is left to the repo's sync check in CI.
  • prerequisites.json: every entry has the required keys. kind: cli takes detect.any, for: ["plugin"] is valid, and check: "/harness-ops:prerequisites" matches the pattern other plugins use. The degrade text matches the SKIP behavior in integration/read-path.mjs:315-316, where the script prints SKIP: docker not available and exits 0.
  • Changelog: the existing patch fragment describes only the integration test and does not mention the new prerequisites.json or the lib/ copies. A patch bump still fits, so I did not count it as a finding.
  • Manifest: this increment does not touch plugin.json or marketplace.json, so there are no manifest <field> lines.
  • Cost: no billed resource or paid setting changes. The review spends nothing beyond the subscription.

The author-claimed items in the PR context, such as unexecuted integration runs and CI results, remain unverified by this review.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 151a5bf3131390880dcfa305ff4b379f01a19111.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 5086e81 Oct 31, 2026
46 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-9878-41236216368-1 branch October 31, 2026 21:56
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 5086e818b2412d97baadb3f9ec2428cc192ea7df; later checks count it verified from this comment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants