seqthink 1.0.1: gate the whole CGI surface behind require_node_auth()
Live probe on .100 caught a bare unauthenticated GET /plugin_seqthink answering 200 HTML. The 1.0.0 dispatch copied plugin_fetch, whose page is a public tool form; seqthink's page is a private thought-chain viewer, so it must answer 401 exactly like plugin_logs / plugin_notes / plugin_sqlite (binding rule: the first live check is the unauth GET -> 401). Discovery (--meta) and the stdio MCP server (--mcp) return before the gate, so discovery and MCP routing are unaffected, and bot-web already appends ?pwd= when it opens the plugin. - main: require_node_auth() before any QUERY_STRING dispatch (once, not per-branch) - tests: bare HTML GET now asserts 401 + no page leak; HTML renders with a credential; --mcp stays unauthenticated and never emits a CGI 401; source invariant that the gate precedes dispatch - README: viewer-UI row + Node API note corrected - VERSION -> 1.0.1 (source, release-dist.sh)
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-13 22:00:11
Commit90a97ef3
Parentsabbd49b0
Changed files
README.md+5−2■■■■■
release-dist.sh+1−1■■
src/plugin_seqthink.c+14−7■■■■■
tests/run.sh+9−1■■■■■
4 files+29−11
Diff
README.md+5−2■■■■■
index a3dd890..f48b14c 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ five-field result.
3232 | Discovery | `--meta` or `SX_PLUGIN_META=1` | one line of JSON, exit 0, **never authenticated** |
3333 | MCP server | `--mcp` | JSON-RPC 2.0 over stdio: `initialize`, `notifications/*`, `ping`, `tools/list`, `tools/call` |
3434 | Node API | `?action=...` or a POST JSON body | `Content-Type: application/json`, behind `require_node_auth()` |
35-| Viewer UI | `GET` (default) | responsive dark/light HTML (`?embed=1`, `&theme=`, `sx-theme` handoff), zero `<script src=>` |
35+| Viewer UI | `GET` (default) | responsive dark/light HTML (`?embed=1`, `&theme=`, `sx-theme` handoff), zero `<script src=>`, behind `require_node_auth()` |
3636
3737 ```bash
3838 ./plugin_seqthink --meta
@@ -99,7 +99,10 @@ stderr and replaced by the default).
9999 ## Node API (behind `require_node_auth()`)
100100
101101 `X-Bot-Password`, `Authorization: Bearer` or `?pwd=`; a no-op when the node has
102-no `BOT_PASSWORD`. `--meta`, `--mcp` and the HTML page are never gated.
102+no `BOT_PASSWORD`. `--meta` and `--mcp` are never gated. The viewer page shares
103+this gate: bot-web appends `?pwd=` when it opens the plugin, a bare LAN curl of
104+`/plugin_seqthink` without a credential answers `401`, like every other node
105+plugin.
103106
104107 | Action | Result |
105108 |---|---|
release-dist.sh+1−1■■
index 83b05c0..59ac559 100755
--- a/release-dist.sh
+++ b/release-dist.sh
@@ -28,7 +28,7 @@ set -euo pipefail
2828
2929 SLUG="seqthink"
3030 ID="plugin_seqthink"
31-VERSION="1.0.0"
31+VERSION="1.0.1"
3232 DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins"
3333
3434 ROOT="$(cd "$(dirname "$0")" && pwd)"
src/plugin_seqthink.c+14−7■■■■■
index 0b46868..b55589d 100644
--- a/src/plugin_seqthink.c
+++ b/src/plugin_seqthink.c
@@ -13,9 +13,10 @@
1313 * branchId?, needsMoreThoughts?}
1414 * 3. ?action=... (+ POST JSON) -> JSON node API behind require_node_auth():
1515 * chains / chain / stats / info / clear
16- * 4. GET (default) -> responsive dark/light HTML page: a
17- * thought-chain timeline (revisions, branches, progress) built from the
18- * snapshots the --mcp leg persists.
16+ * 4. GET (default) -> responsive dark/light HTML page (behind
17+ * require_node_auth(), same as the JSON API): a thought-chain timeline
18+ * (revisions, branches, progress) built from the snapshots the --mcp leg
19+ * persists.
1920 *
2021 * The tool is a clean-room C port of the behaviour of modelcontextprotocol
2122 * `servers/src/sequentialthinking` (the sequential-thinking MCP server):
@@ -103,7 +104,7 @@
103104
104105 #define PLUGIN_SLUG "seqthink"
105106 #define PLUGIN_ID "plugin_seqthink"
106-#define PLUGIN_VER "1.0.0"
107+#define PLUGIN_VER "1.0.1"
107108 #define PLUGIN_NAME "seqthink"
108109 #define PLUGIN_DESC "Thought chains"
109110
@@ -321,8 +322,8 @@ static int get_query_val(const char *qs, const char *key, char *out, size_t outs
321322 }
322323
323324 /* ------------------------------------------------------------------ */
324-/* Node authentication (X-Bot-Password | Bearer | ?pwd=). --meta, */
325-/* --mcp and the HTML page never call this; every JSON action does. */
325+/* Node authentication (X-Bot-Password | Bearer | ?pwd=). --meta and --mcp */
326+/* never call this; the whole CGI surface (HTML page + every JSON action) does.*/
326327 /* ------------------------------------------------------------------ */
327328
328329 static void require_node_auth(void)
@@ -1762,6 +1763,13 @@ int main(int argc, char **argv)
17621763 return 0;
17631764 }
17641765
1766+ /* The CGI surface is one private viewer: gate HTML AND the JSON API.
1767+ * Discovery (--meta) and the stdio MCP server (--mcp) returned above, so
1768+ * a node still probes and serves this plugin without a credential, but a
1769+ * bare unauthenticated GET /plugin_seqthink answers 401, exactly like
1770+ * plugin_logs / plugin_notes / plugin_sqlite. */
1771+ require_node_auth();
1772+
17651773 qs = getenv("QUERY_STRING");
17661774 if (!qs) qs = "";
17671775
@@ -1778,7 +1786,6 @@ int main(int argc, char **argv)
17781786 is_post = rm && strcmp(rm, "POST") == 0;
17791787
17801788 if (have_action || is_post) {
1781- require_node_auth();
17821789 body = read_body();
17831790 if (body) {
17841791 char jact[64] = "";
tests/run.sh+9−1■■■■■
index 0bc7985..3f9e848 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -314,8 +314,15 @@ R=$(SEQTHINK_STATE_DIR="$S" QUERY_STRING="action=chains" "$BIN"; true)
314314 check "open node (no BOT_PASSWORD) answers" '"chains":[' "$R"
315315 R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" --meta; true)
316316 check "--meta stays unauthenticated" '"name":"seqthink"' "$R"
317+printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"ping"}' > "$TMP/ping.jsonl"
318+R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" --mcp < "$TMP/ping.jsonl" 2>/dev/null; true)
319+check "--mcp stays unauthenticated (stdio)" '"jsonrpc":"2.0"' "$R"
320+check_not "--mcp never emits a CGI 401" "Status: 401" "$R"
317321 R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" < /dev/null; true)
318-check "HTML page stays unauthenticated" "<!DOCTYPE html>" "$R"
322+check "bare HTML GET 401 without a credential" "Status: 401 Unauthorized" "$R"
323+check_not "401 HTML leaks no page" "<!DOCTYPE html>" "$R"
324+R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw HTTP_X_BOT_PASSWORD=secretpw "$BIN" < /dev/null; true)
325+check "HTML renders with a credential" "<!DOCTYPE html>" "$R"
319326
320327 section "mode 3 JSON API: actions"
321328 R=$(SEQTHINK_STATE_DIR="$S" QUERY_STRING="action=chains" "$BIN"; true)
@@ -422,6 +429,7 @@ check "_WIN32 gate precedes includes" "_WIN32_WINNT 0x0601"
422429 check "Apple needs _DARWIN_C_SOURCE" "_DARWIN_C_SOURCE" "$SRC_TXT"
423430 check "meta is emitted before auth" "return run_meta();" "$SRC_TXT"
424431 check "mcp mode is dispatched" "return run_mcp();" "$SRC_TXT"
432+check "CGI surface gated before dispatch" "require_node_auth();" "$SRC_TXT"
425433 check_not "no shell command execution" "popen(" "$SRC_TXT"
426434 check_not "no system()" "system(" "$SRC_TXT"
427435 check_not "no sockets" "socket(" "$SRC_TXT"
428436
README.md+5−2■■■■■
index a3dd890..f48b14c 100644index a3dd890..f48b14c 100644
--- a/README.md--- a/README.md
+++ b/README.md+++ b/README.md
@@ -32,7 +32,7 @@ five-field result.@@ -32,7 +32,7 @@ five-field result.
32 | Discovery | `--meta` or `SX_PLUGIN_META=1` | one line of JSON, exit 0, **never authenticated** |32 | Discovery | `--meta` or `SX_PLUGIN_META=1` | one line of JSON, exit 0, **never authenticated** |
33 | MCP server | `--mcp` | JSON-RPC 2.0 over stdio: `initialize`, `notifications/*`, `ping`, `tools/list`, `tools/call` |33 | MCP server | `--mcp` | JSON-RPC 2.0 over stdio: `initialize`, `notifications/*`, `ping`, `tools/list`, `tools/call` |
34 | Node API | `?action=...` or a POST JSON body | `Content-Type: application/json`, behind `require_node_auth()` |34 | Node API | `?action=...` or a POST JSON body | `Content-Type: application/json`, behind `require_node_auth()` |
35-| Viewer UI | `GET` (default) | responsive dark/light HTML (`?embed=1`, `&theme=`, `sx-theme` handoff), zero `<script src=>` |35+| Viewer UI | `GET` (default) | responsive dark/light HTML (`?embed=1`, `&theme=`, `sx-theme` handoff), zero `<script src=>`, behind `require_node_auth()` |
36 36
37 ```bash37 ```bash
38 ./plugin_seqthink --meta38 ./plugin_seqthink --meta
@@ -99,7 +99,10 @@ stderr and replaced by the default).@@ -99,7 +99,10 @@ stderr and replaced by the default).
99 ## Node API (behind `require_node_auth()`)99 ## Node API (behind `require_node_auth()`)
100 100
101 `X-Bot-Password`, `Authorization: Bearer` or `?pwd=`; a no-op when the node has101 `X-Bot-Password`, `Authorization: Bearer` or `?pwd=`; a no-op when the node has
102-no `BOT_PASSWORD`. `--meta`, `--mcp` and the HTML page are never gated.102+no `BOT_PASSWORD`. `--meta` and `--mcp` are never gated. The viewer page shares
103+this gate: bot-web appends `?pwd=` when it opens the plugin, a bare LAN curl of
104+`/plugin_seqthink` without a credential answers `401`, like every other node
105+plugin.
103 106
104 | Action | Result |107 | Action | Result |
105 |---|---|108 |---|---|
release-dist.sh+1−1■■
index 83b05c0..59ac559 100755index 83b05c0..59ac559 100755
--- a/release-dist.sh--- a/release-dist.sh
+++ b/release-dist.sh+++ b/release-dist.sh
@@ -28,7 +28,7 @@ set -euo pipefail@@ -28,7 +28,7 @@ set -euo pipefail
28 28
29 SLUG="seqthink"29 SLUG="seqthink"
30 ID="plugin_seqthink"30 ID="plugin_seqthink"
31-VERSION="1.0.0"31+VERSION="1.0.1"
32 DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins"32 DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins"
33 33
34 ROOT="$(cd "$(dirname "$0")" && pwd)"34 ROOT="$(cd "$(dirname "$0")" && pwd)"
src/plugin_seqthink.c+14−7■■■■■
index 0b46868..b55589d 100644index 0b46868..b55589d 100644
--- a/src/plugin_seqthink.c--- a/src/plugin_seqthink.c
+++ b/src/plugin_seqthink.c+++ b/src/plugin_seqthink.c
@@ -13,9 +13,10 @@@@ -13,9 +13,10 @@
13 * branchId?, needsMoreThoughts?}13 * branchId?, needsMoreThoughts?}
14 * 3. ?action=... (+ POST JSON) -> JSON node API behind require_node_auth():14 * 3. ?action=... (+ POST JSON) -> JSON node API behind require_node_auth():
15 * chains / chain / stats / info / clear15 * chains / chain / stats / info / clear
16- * 4. GET (default) -> responsive dark/light HTML page: a16+ * 4. GET (default) -> responsive dark/light HTML page (behind
17- * thought-chain timeline (revisions, branches, progress) built from the17+ * require_node_auth(), same as the JSON API): a thought-chain timeline
18- * snapshots the --mcp leg persists.18+ * (revisions, branches, progress) built from the snapshots the --mcp leg
19+ * persists.
19 *20 *
20 * The tool is a clean-room C port of the behaviour of modelcontextprotocol21 * The tool is a clean-room C port of the behaviour of modelcontextprotocol
21 * `servers/src/sequentialthinking` (the sequential-thinking MCP server):22 * `servers/src/sequentialthinking` (the sequential-thinking MCP server):
@@ -103,7 +104,7 @@@@ -103,7 +104,7 @@
103 104
104 #define PLUGIN_SLUG "seqthink"105 #define PLUGIN_SLUG "seqthink"
105 #define PLUGIN_ID "plugin_seqthink"106 #define PLUGIN_ID "plugin_seqthink"
106-#define PLUGIN_VER "1.0.0"107+#define PLUGIN_VER "1.0.1"
107 #define PLUGIN_NAME "seqthink"108 #define PLUGIN_NAME "seqthink"
108 #define PLUGIN_DESC "Thought chains"109 #define PLUGIN_DESC "Thought chains"
109 110
@@ -321,8 +322,8 @@ static int get_query_val(const char *qs, const char *key, char *out, size_t outs@@ -321,8 +322,8 @@ static int get_query_val(const char *qs, const char *key, char *out, size_t outs
321 }322 }
322 323
323 /* ------------------------------------------------------------------ */324 /* ------------------------------------------------------------------ */
324-/* Node authentication (X-Bot-Password | Bearer | ?pwd=). --meta, */325+/* Node authentication (X-Bot-Password | Bearer | ?pwd=). --meta and --mcp */
325-/* --mcp and the HTML page never call this; every JSON action does. */326+/* never call this; the whole CGI surface (HTML page + every JSON action) does.*/
326 /* ------------------------------------------------------------------ */327 /* ------------------------------------------------------------------ */
327 328
328 static void require_node_auth(void)329 static void require_node_auth(void)
@@ -1762,6 +1763,13 @@ int main(int argc, char **argv)@@ -1762,6 +1763,13 @@ int main(int argc, char **argv)
1762 return 0;1763 return 0;
1763 }1764 }
1764 1765
1766+ /* The CGI surface is one private viewer: gate HTML AND the JSON API.
1767+ * Discovery (--meta) and the stdio MCP server (--mcp) returned above, so
1768+ * a node still probes and serves this plugin without a credential, but a
1769+ * bare unauthenticated GET /plugin_seqthink answers 401, exactly like
1770+ * plugin_logs / plugin_notes / plugin_sqlite. */
1771+ require_node_auth();
1772+
1765 qs = getenv("QUERY_STRING");1773 qs = getenv("QUERY_STRING");
1766 if (!qs) qs = "";1774 if (!qs) qs = "";
1767 1775
@@ -1778,7 +1786,6 @@ int main(int argc, char **argv)@@ -1778,7 +1786,6 @@ int main(int argc, char **argv)
1778 is_post = rm && strcmp(rm, "POST") == 0;1786 is_post = rm && strcmp(rm, "POST") == 0;
1779 1787
1780 if (have_action || is_post) {1788 if (have_action || is_post) {
1781- require_node_auth();
1782 body = read_body();1789 body = read_body();
1783 if (body) {1790 if (body) {
1784 char jact[64] = "";1791 char jact[64] = "";
tests/run.sh+9−1■■■■■
index 0bc7985..3f9e848 100755index 0bc7985..3f9e848 100755
--- a/tests/run.sh--- a/tests/run.sh
+++ b/tests/run.sh+++ b/tests/run.sh
@@ -314,8 +314,15 @@ R=$(SEQTHINK_STATE_DIR="$S" QUERY_STRING="action=chains" "$BIN"; true)@@ -314,8 +314,15 @@ R=$(SEQTHINK_STATE_DIR="$S" QUERY_STRING="action=chains" "$BIN"; true)
314 check "open node (no BOT_PASSWORD) answers" '"chains":[' "$R"314 check "open node (no BOT_PASSWORD) answers" '"chains":[' "$R"
315 R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" --meta; true)315 R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" --meta; true)
316 check "--meta stays unauthenticated" '"name":"seqthink"' "$R"316 check "--meta stays unauthenticated" '"name":"seqthink"' "$R"
317+printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"ping"}' > "$TMP/ping.jsonl"
318+R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" --mcp < "$TMP/ping.jsonl" 2>/dev/null; true)
319+check "--mcp stays unauthenticated (stdio)" '"jsonrpc":"2.0"' "$R"
320+check_not "--mcp never emits a CGI 401" "Status: 401" "$R"
317 R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" < /dev/null; true)321 R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw "$BIN" < /dev/null; true)
318-check "HTML page stays unauthenticated" "<!DOCTYPE html>" "$R"322+check "bare HTML GET 401 without a credential" "Status: 401 Unauthorized" "$R"
323+check_not "401 HTML leaks no page" "<!DOCTYPE html>" "$R"
324+R=$(SEQTHINK_STATE_DIR="$S" BOT_PASSWORD=secretpw HTTP_X_BOT_PASSWORD=secretpw "$BIN" < /dev/null; true)
325+check "HTML renders with a credential" "<!DOCTYPE html>" "$R"
319 326
320 section "mode 3 JSON API: actions"327 section "mode 3 JSON API: actions"
321 R=$(SEQTHINK_STATE_DIR="$S" QUERY_STRING="action=chains" "$BIN"; true)328 R=$(SEQTHINK_STATE_DIR="$S" QUERY_STRING="action=chains" "$BIN"; true)
@@ -422,6 +429,7 @@ check "_WIN32 gate precedes includes" "_WIN32_WINNT 0x0601"@@ -422,6 +429,7 @@ check "_WIN32 gate precedes includes" "_WIN32_WINNT 0x0601"
422 check "Apple needs _DARWIN_C_SOURCE" "_DARWIN_C_SOURCE" "$SRC_TXT"429 check "Apple needs _DARWIN_C_SOURCE" "_DARWIN_C_SOURCE" "$SRC_TXT"
423 check "meta is emitted before auth" "return run_meta();" "$SRC_TXT"430 check "meta is emitted before auth" "return run_meta();" "$SRC_TXT"
424 check "mcp mode is dispatched" "return run_mcp();" "$SRC_TXT"431 check "mcp mode is dispatched" "return run_mcp();" "$SRC_TXT"
432+check "CGI surface gated before dispatch" "require_node_auth();" "$SRC_TXT"
425 check_not "no shell command execution" "popen(" "$SRC_TXT"433 check_not "no shell command execution" "popen(" "$SRC_TXT"
426 check_not "no system()" "system(" "$SRC_TXT"434 check_not "no system()" "system(" "$SRC_TXT"
427 check_not "no sockets" "socket(" "$SRC_TXT"435 check_not "no sockets" "socket(" "$SRC_TXT"
428436