Repository navigation
FIX - EcoTaxa instances: refuse a URL that is not http(s) - #9
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.