fix: Bind single-quote-containing config values via readfile() instead of .param set#144
fix: Bind single-quote-containing config values via readfile() instead of .param set#144mvanhorn wants to merge 1 commit into
Conversation
|
Thanks for this — and for auditing all three Could you rebase onto current |
|
Thanks again for this, and for the uniform audit of all three Rather than have you chase a moving target, we'll fold your change in directly — your commits as the base, reconciled with #180's CR-stripping, plus I'll link the PR here. Thanks for kicking this off! 🙏 |
|
Folded into #185 — your commit carried as the base (credited via |
Fixes #112 — the team-registry scripts bound config.json via a `.param set` dot- command, whose tokenizer ignores SQL '' escaping, so a config value containing a single quote (project path / agent name with an apostrophe) broke identity resolution and join. Convert identities.sh / join.sh / whoami.sh and the shared agmsg_registered_projects helper in resolve-project.sh to readfile() + json_valid, interpolating values as '' -escaped SQL string literals. Reconciled with #180's CRLF stripping (agmsg_sqlite_mem / inline tr -d). The readfile() paths go through a new agmsg_sql_readfile_path() (cygpath -w on Windows) so sqlite3.exe can open them — without it whoami returned not_joined on Windows. Based on #144 by @mvanhorn. Supersedes #144. Refs #180, #140. Co-authored-by: mvanhorn <mvanhorn@gmail.com>
Summary
The shared team-registry scripts bind config.json into sqlite3 by interpolating it into a
.param set :json '<config>'dot-command. The sqlite3 shell's dot-command tokenizer does not honor SQL''escaping, so any config value containing a single quote (e.g.Changes
Replace each
.param set :json '<config>'dot-command in whoami.sh, identities.sh, and join.sh with the same pattern resolve_team already uses: read the config file inside SQL viareadfile('<path>')CAST to TEXT, or interpolate the value as a SQL string literal with proper''doubling. Audit each of the three scripts for every.param set :jsonsite and convert them uniformly so paths and names with apostrophes are handled everywhere.Fixes #112