| index cb6ac2e..29ea40e 100644 | ||
| --- a/plugin.json | ||
| +++ b/plugin.json | ||
| @@ -11,7 +11,7 @@ | ||
| 11 | 11 | "menus": false, |
| 12 | 12 | "verified": "mock", |
| 13 | 13 | "category": "devtools", |
| 14 | - "version": "1.0.0", | |
| 14 | + "version": "1.0.1", | |
| 15 | 15 | "license": "MIT", |
| 16 | 16 | "capabilities": [ |
| 17 | 17 | "outbound_https_github_rest_api", |
| index 18c63ff..69fd47f 100644 | ||
| --- a/src/gh.h | ||
| +++ b/src/gh.h | ||
| @@ -44,7 +44,7 @@ | ||
| 44 | 44 | |
| 45 | 45 | #define GH_SLUG "github" |
| 46 | 46 | #define GH_ID "plugin_github" |
| 47 | -#define GH_VER "1.0.0" | |
| 47 | +#define GH_VER "1.0.1" | |
| 48 | 48 | #define GH_NAME "github" |
| 49 | 49 | #define GH_DESC "GitHub tools" |
| 50 | 50 |
| index 3b377b0..4f344bf 100644 | ||
| --- a/src/plugin_github.c | ||
| +++ b/src/plugin_github.c | ||
| @@ -373,6 +373,12 @@ static int html_ui(const sx_plugin_info *info, const char *query, | ||
| 373 | 373 | (void)query; |
| 374 | 374 | (void)embed; /* the page's own prepaint script flags <html embedded> */ |
| 375 | 375 | (void)theme; |
| 376 | + /* The page is a control surface for a credential, so it is gated exactly | |
| 377 | + * like every ?action= is. The node proxy forwards X-Bot-Password when a | |
| 378 | + * browser reaches the plugin through bot-api, and an open node (no | |
| 379 | + * BOT_PASSWORD) stays open by design - but a passworded node answers 401 | |
| 380 | + * here rather than handing out the shell of the setup form. */ | |
| 381 | + sx_require_node_auth(); | |
| 376 | 382 | sx_cgi_header(200, "text/html; charset=utf-8"); |
| 377 | 383 | emit_ui(); |
| 378 | 384 | return 0; |
| index 44e2a1a..cda755c 100755 | ||
| --- a/tests/cgi.py | ||
| +++ b/tests/cgi.py | ||
| @@ -213,6 +213,12 @@ def main(): | ||
| 213 | 213 | check(st == "400", "an unknown action is 400", st) |
| 214 | 214 | |
| 215 | 215 | # ---------- HTML page ---------- |
| 216 | + # The page is a credential control surface, so it is gated like every | |
| 217 | + # action: a passworded node hands a stranger a 401, not the form. | |
| 218 | + st, ct, pl = cgi("", node_password="nodepw-1") | |
| 219 | + check(st == "401", "the page itself is 401 on a passworded node with no " | |
| 220 | + "client credential", st) | |
| 221 | + | |
| 216 | 222 | st, ct, pl = cgi("", bot_password="nodepw-1") |
| 217 | 223 | check(st == "200" and ct.startswith("text/html"), "GET serves the page", ct) |
| 218 | 224 | check("<script src=" not in pl and "cdnjs" not in pl and |
| 219 | 225 |
| index cb6ac2e..29ea40e 100644 | index cb6ac2e..29ea40e 100644 | ||
| --- a/plugin.json | --- a/plugin.json | ||
| +++ b/plugin.json | +++ b/plugin.json | ||
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | "menus": false, | 11 | "menus": false, |
| 12 | "verified": "mock", | 12 | "verified": "mock", |
| 13 | "category": "devtools", | 13 | "category": "devtools", |
| 14 | - "version": "1.0.0", | 14 | + "version": "1.0.1", |
| 15 | "license": "MIT", | 15 | "license": "MIT", |
| 16 | "capabilities": [ | 16 | "capabilities": [ |
| 17 | "outbound_https_github_rest_api", | 17 | "outbound_https_github_rest_api", |
| index 18c63ff..69fd47f 100644 | index 18c63ff..69fd47f 100644 | ||
| --- a/src/gh.h | --- a/src/gh.h | ||
| +++ b/src/gh.h | +++ b/src/gh.h | ||
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | 44 | ||
| 45 | #define GH_SLUG "github" | 45 | #define GH_SLUG "github" |
| 46 | #define GH_ID "plugin_github" | 46 | #define GH_ID "plugin_github" |
| 47 | -#define GH_VER "1.0.0" | 47 | +#define GH_VER "1.0.1" |
| 48 | #define GH_NAME "github" | 48 | #define GH_NAME "github" |
| 49 | #define GH_DESC "GitHub tools" | 49 | #define GH_DESC "GitHub tools" |
| 50 | 50 |
| index 3b377b0..4f344bf 100644 | index 3b377b0..4f344bf 100644 | ||
| --- a/src/plugin_github.c | --- a/src/plugin_github.c | ||
| +++ b/src/plugin_github.c | +++ b/src/plugin_github.c | ||
| @@ -373,6 +373,12 @@ static int html_ui(const sx_plugin_info *info, const char *query, | @@ -373,6 +373,12 @@ static int html_ui(const sx_plugin_info *info, const char *query, | ||
| 373 | (void)query; | 373 | (void)query; |
| 374 | (void)embed; /* the page's own prepaint script flags <html embedded> */ | 374 | (void)embed; /* the page's own prepaint script flags <html embedded> */ |
| 375 | (void)theme; | 375 | (void)theme; |
| 376 | + /* The page is a control surface for a credential, so it is gated exactly | ||
| 377 | + * like every ?action= is. The node proxy forwards X-Bot-Password when a | ||
| 378 | + * browser reaches the plugin through bot-api, and an open node (no | ||
| 379 | + * BOT_PASSWORD) stays open by design - but a passworded node answers 401 | ||
| 380 | + * here rather than handing out the shell of the setup form. */ | ||
| 381 | + sx_require_node_auth(); | ||
| 376 | sx_cgi_header(200, "text/html; charset=utf-8"); | 382 | sx_cgi_header(200, "text/html; charset=utf-8"); |
| 377 | emit_ui(); | 383 | emit_ui(); |
| 378 | return 0; | 384 | return 0; |
| index 44e2a1a..cda755c 100755 | index 44e2a1a..cda755c 100755 | ||
| --- a/tests/cgi.py | --- a/tests/cgi.py | ||
| +++ b/tests/cgi.py | +++ b/tests/cgi.py | ||
| @@ -213,6 +213,12 @@ def main(): | @@ -213,6 +213,12 @@ def main(): | ||
| 213 | check(st == "400", "an unknown action is 400", st) | 213 | check(st == "400", "an unknown action is 400", st) |
| 214 | 214 | ||
| 215 | # ---------- HTML page ---------- | 215 | # ---------- HTML page ---------- |
| 216 | + # The page is a credential control surface, so it is gated like every | ||
| 217 | + # action: a passworded node hands a stranger a 401, not the form. | ||
| 218 | + st, ct, pl = cgi("", node_password="nodepw-1") | ||
| 219 | + check(st == "401", "the page itself is 401 on a passworded node with no " | ||
| 220 | + "client credential", st) | ||
| 221 | + | ||
| 216 | st, ct, pl = cgi("", bot_password="nodepw-1") | 222 | st, ct, pl = cgi("", bot_password="nodepw-1") |
| 217 | check(st == "200" and ct.startswith("text/html"), "GET serves the page", ct) | 223 | check(st == "200" and ct.startswith("text/html"), "GET serves the page", ct) |
| 218 | check("<script src=" not in pl and "cdnjs" not in pl and | 224 | check("<script src=" not in pl and "cdnjs" not in pl and |
| 219 | 225 |