Skip to content

Update Feature Branch#823

Merged
tariqksoliman merged 11 commits intots-810from
development
Dec 10, 2025
Merged

Update Feature Branch#823
tariqksoliman merged 11 commits intots-810from
development

Conversation

@tariqksoliman
Copy link
Copy Markdown
Member

No description provided.

ac-61 and others added 11 commits November 19, 2025 17:09
* Fix scale bar position in mobile mode

* chore: bump version to 4.1.12-20251119 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Added Layer Refresh Rate option for loading animation time steps
* Added customizable animation export options (defaults to GIF only)
* Use rectangular animation areas
* Suppress build warning from ffmpeg
* chore: bump version to 4.1.14-20251124 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* #813 STAC UI import/export 1

* #813 STAC import/export 2
* Add new callback for newActiveFeature

* chore: bump version to 4.1.15-20251201 [version bump]

---------

Co-authored-by: Amanda Chung <Amanda.Chung@jpl.nasa.gov>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ile mode (#817)

* Highlight buttons in extended timeline view as range indicator in mobile mode

* chore: bump version to 4.1.16-20251203 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* #815 Update STAC Collection metadata

* #815 Update STAC Collection metadata 2

* chore: bump version to 4.1.15-20251203 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* #820 Fix DrawTool - Incrementer Value Multi-User Race Conditions

* chore: bump version to 4.1.18-20251205 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix issue with local versus UTC time in expanded timeline display

* Consolidate function
@tariqksoliman tariqksoliman self-assigned this Dec 10, 2025
Comment on lines +120 to +126
const collectionResponse = await fetch(
`${stacUrl}/collections/${collection}`,
{
method: "GET",
headers: { "content-type": "application/json" },
}
);

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.

Copilot Autofix

AI 4 months ago

In general, to fix SSRF vulnerabilities when user input is used to determine part of a backend HTTP request URL, you must ensure that the user input cannot cause the server to access arbitrary resources. The best way to do this is to restrict the URL path segment (collection in this case) to a known-safe allow-list of permitted values, or to strictly validate that it is a safe value (for example, allowing only alphanumeric names, possibly including certain symbols like "-", "_", but never slashes or dots). The validation should happen immediately after extracting the user input from the request, before you use it in the fetch.

Specific steps:

  • Add a validation step after extracting collection from req.params.
    • You can either check collection is in a pre-defined allow-list (most secure), or enforce that it matches a safe pattern (e.g., using a regexp to allow only "^[\w-]+$" — letters, digits, underscore, dash).
  • If the value is unsafe, immediately reject the request with a 400 Bad Request (or similar) response.
  • No external libraries are strictly required—Node's RegExp is sufficient.
  • These code edits should be made at the beginning of the /collections/:collection/export handler, after retrieving collection.
Suggested changeset 1
API/Backend/Stac/routes/stac.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/API/Backend/Stac/routes/stac.js b/API/Backend/Stac/routes/stac.js
--- a/API/Backend/Stac/routes/stac.js
+++ b/API/Backend/Stac/routes/stac.js
@@ -111,6 +111,21 @@
 router.get("/collections/:collection/export", async function (req, res, next) {
   const { collection } = req.params;
 
+  // Validate collection to prevent SSRF: only allow alphanumerics, underscore, hyphen.
+  if (!/^[\w-]+$/.test(collection)) {
+    logger(
+      "error",
+      "Invalid collection name in export request",
+      req.originalUrl,
+      req,
+      { collection }
+    );
+    return res.status(400).send({
+      status: "failure",
+      message: "Invalid collection name.",
+    });
+  }
+
   const stacUrl = `http://${
     process.env.IS_DOCKER === "true" ? "stac-fastapi" : "localhost"
   }:${process.env.STAC_PORT || 8881}`;
EOF
@@ -111,6 +111,21 @@
router.get("/collections/:collection/export", async function (req, res, next) {
const { collection } = req.params;

// Validate collection to prevent SSRF: only allow alphanumerics, underscore, hyphen.
if (!/^[\w-]+$/.test(collection)) {
logger(
"error",
"Invalid collection name in export request",
req.originalUrl,
req,
{ collection }
);
return res.status(400).send({
status: "failure",
message: "Invalid collection name.",
});
}

const stacUrl = `http://${
process.env.IS_DOCKER === "true" ? "stac-fastapi" : "localhost"
}:${process.env.STAC_PORT || 8881}`;
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +139 to +142
const itemsResponse = await fetch(nextUrl, {
method: "GET",
headers: { "content-type": "application/json" },
});

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
@tariqksoliman tariqksoliman merged commit 7199e2b into ts-810 Dec 10, 2025
7 of 9 checks passed
tariqksoliman added a commit that referenced this pull request Dec 22, 2025
* #810 Cesium initial

* #810 Cesium 2

* Updated webpack to handle Cesium assets

* Update Feature Branch (#823)

* Fix scale bar position in mobile mode (#811)

* Fix scale bar position in mobile mode

* chore: bump version to 4.1.12-20251119 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Updates to Animation Tool (#812)

* Added Layer Refresh Rate option for loading animation time steps
* Added customizable animation export options (defaults to GIF only)
* Use rectangular animation areas
* Suppress build warning from ffmpeg
* chore: bump version to 4.1.14-20251124 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* #813 STAC UI import/export (#814)

* #813 STAC UI import/export 1

* #813 STAC import/export 2

* Fix Expanded TimeUI Hours timezone offset

* Add new callback for newActiveFeature (#816)

* Add new callback for newActiveFeature

* chore: bump version to 4.1.15-20251201 [version bump]

---------

Co-authored-by: Amanda Chung <Amanda.Chung@jpl.nasa.gov>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Highlight buttons in extended timeline view as range indicator in mobile mode (#817)

* Highlight buttons in extended timeline view as range indicator in mobile mode

* chore: bump version to 4.1.16-20251203 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* #815 Update STAC Collection metadata (#818)

* #815 Update STAC Collection metadata

* #815 Update STAC Collection metadata 2

* chore: bump version to 4.1.15-20251203 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* #820 Fix DrawTool - Incrementer Value Multi-User Race Conditions (#821)

* #820 Fix DrawTool - Incrementer Value Multi-User Race Conditions

* chore: bump version to 4.1.18-20251205 [version bump]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix issue with local versus UTC time in expanded timeline display (#819)

* Fix issue with local versus UTC time in expanded timeline display

* Consolidate function

* Improve init-db logging

---------

Co-authored-by: ac-61 <ac-61@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joe T. Roberts <5315956+jtroberts@users.noreply.github.com>
Co-authored-by: Amanda Chung <Amanda.Chung@jpl.nasa.gov>

* #810 Configure default panel width

* #810 More Cesium improvements

* #810 Improve Cesium time responsiveness and feature selection

---------

Co-authored-by: Joe Roberts <joe.t.roberts@jpl.nasa.gov>
Co-authored-by: ac-61 <ac-61@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joe T. Roberts <5315956+jtroberts@users.noreply.github.com>
Co-authored-by: Amanda Chung <Amanda.Chung@jpl.nasa.gov>
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.

3 participants