Skip to content

Disallow reading from external datasets - #129

Merged
loichuder merged 2 commits into
mainfrom
disallow-external-datasets
Oct 19, 2026
Merged

loichuder merged 2 commits into
mainfrom
disallow-external-datasets

Conversation

@loichuder

@loichuder loichuder commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

External datasets are a scary HDF5 feature in terms of security. Also, they don't seem used in all the usecases we encountered.

I therefore propose that we completely disallow reading from external datasets in h5grove. The metadata can be served but serving the data (and therefore resolving the external dataset) via /data will now raise a specific error. /stats will also raise an error since it needs to get the data to compute stats.

🤖 Claude used to generate the tests and update the api.yaml

@loichuder
loichuder requested review from axelboc and t20100 October 16, 2026 13:20
@loichuder

Copy link
Copy Markdown
Member Author

I'll investigate the CI failure. It is linked to Sphinx but the tests pass.

@t20100 t20100 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use 403 error code, otherwise LGTM!

Comment thread src/h5grove/content.py Outdated
Comment on lines +320 to +321
except NotSupportedError as e:
raise create_error(501, str(e))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using 403 Forbidden?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403:

The HTTP 403 Forbidden client error response status code indicates that the server understood the request but refused to process it. This status is similar to 401, except that for 403 Forbidden responses, authenticating or re-authenticating makes no difference. The request failure is tied to application logic, such as insufficient permissions to a resource or action.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501:

If you have visited a web page and you are seeing 501 errors, these issues require investigation and fixing by server owners or administrators.

Comment thread src/h5grove/content.py Outdated
- `safe`: Convert to a type supported by JS typedarray (https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
"""
if self._h5py_entity.external:
raise NotSupportedError("Cannot resolve external datasets")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

external added in h5py 8years ago: h5py/h5py#1000

@axelboc axelboc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with using 403 👍

@loichuder
loichuder force-pushed the disallow-external-datasets branch 2 times, most recently from fe8043e to c7285fc Compare October 19, 2026 09:29
@loichuder
loichuder force-pushed the disallow-external-datasets branch from c7285fc to d575f13 Compare October 19, 2026 09:30
@loichuder
loichuder force-pushed the disallow-external-datasets branch from 39d7218 to 9d9142d Compare October 19, 2026 09:41
@loichuder
loichuder merged commit 9740b2a into main Oct 19, 2026
2 checks passed
@loichuder
loichuder deleted the disallow-external-datasets branch October 19, 2026 09:45
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