@grainulation/orchard 1.0.4 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/farmer.js CHANGED
@@ -11,7 +11,7 @@ let _warnedNoToken = false;
11
11
  /**
12
12
  * POST an activity event to farmer.
13
13
  * Graceful failure -- catch and warn, never crash.
14
- * @param {string} farmerUrl - Base URL of farmer (e.g. http://localhost:9090)
14
+ * @param {string} farmerUrl - Base URL of farmer
15
15
  * @param {object} event - Event object (e.g. { type: "scan", data: {...} })
16
16
  * @param {object} [opts] - Options
17
17
  * @param {string} [opts.token] - Bearer token for Authorization header
@@ -89,7 +89,7 @@ function notify(farmerUrl, event, opts) {
89
89
  * CLI handler for `orchard connect farmer`.
90
90
  * Reads/writes .farmer.json in targetDir.
91
91
  * @param {string} targetDir - Working directory
92
- * @param {string[]} args - CLI arguments (e.g. ["farmer", "--url", "http://..."])
92
+ * @param {string[]} args - CLI arguments (e.g. ["farmer", "--url", "<farmer-url>"])
93
93
  */
94
94
  async function connect(targetDir, args) {
95
95
  const subcommand = args[0];
package/lib/server.js CHANGED
@@ -790,6 +790,14 @@ ${ROUTES.map((r) => "<tr><td><code>" + r.method + "</code></td><td><code>" + r.p
790
790
  let filePath = url.pathname;
791
791
  filePath = join(PUBLIC_DIR, filePath);
792
792
 
793
+ // Prevent directory traversal
794
+ const resolved = resolve(filePath);
795
+ if (!resolved.startsWith(PUBLIC_DIR + "/") && resolved !== PUBLIC_DIR) {
796
+ res.writeHead(403);
797
+ res.end("Forbidden");
798
+ return;
799
+ }
800
+
793
801
  if (existsSync(filePath) && !statSync(filePath).isDirectory()) {
794
802
  const ext = extname(filePath);
795
803
  const mime = MIME[ext] || "application/octet-stream";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grainulation/orchard",
3
- "version": "1.0.4",
3
+ "version": "1.1.1",
4
4
  "description": "Multi-sprint research orchestrator — coordinate parallel research across teams",
5
5
  "main": "lib/planner.js",
6
6
  "exports": {