Skip to content

FIX - EcoTaxa instances: refuse a URL that is not http(s) - #9

Merged
juliecoust merged 2 commits into
mainfrom
fix-ecotaxa-instance-url
Nov 13, 2026
Merged

juliecoust merged 2 commits into
mainfrom
fix-ecotaxa-instance-url

Conversation

@lamjarad-B

Copy link
Copy Markdown
Contributor

Creating an instance is already restricted to admins, but nothing checked the URL itself. It ends up in links of the front, where a javascript: URL would run code in the session of whoever clicked, and it is the target of the EcoTaxa API calls, which carry the accounts' tokens.

POST /ecotaxa_instances now answers 422 unless the URL is http or https. The admin check still comes first, so a non-admin gets the same 403 whatever the URL. Instances already in the database are not checked: the front guards its links.

Creating an instance is already restricted to admins, but nothing checked the
URL itself. It ends up in links of the front, where a `javascript:` URL would
run code in the session of whoever clicked, and it is the target of the EcoTaxa
API calls, which carry the accounts' tokens.

POST /ecotaxa_instances now answers 422 unless the URL is http or https. The
admin check still comes first, so a non-admin gets the same 403 whatever the URL.
Instances already in the database are not checked: the front guards its links.
When an archive failed, the `.partial` file was removed without waiting for the
write stream, which opens its file asynchronously. On a loaded machine the stream
could create the file after the removal and leave it behind, which made
`project-repository-zip.test.ts` fail intermittently in CI. The stream also stayed
open after the failure.

The failure path now closes the stream and waits for it before the removal, in the
3 copies of zipFolder (project repository, sample repository, exports). Each one
gets a test delaying the opening of the file past the failure.
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.77%. Comparing base (20d2b95) to head (853b2d1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
+ Coverage   81.72%   81.77%   +0.05%     
==========================================
  Files         214      214              
  Lines       12551    12568      +17     
  Branches     3020     3023       +3     
==========================================
+ Hits        10257    10278      +21     
+ Misses       2125     2121       -4     
  Partials      169      169              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@juliecoust
juliecoust merged commit c39fd26 into main Nov 13, 2026
3 checks passed
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.

2 participants