Skip to content

Validate Dataset modules for the Kedro HTTP server - #5726

Merged
lrcouto merged 21 commits into
mainfrom
validate-runtime-params
Aug 24, 2026
Merged

Validate Dataset modules for the Kedro HTTP server#5726
lrcouto merged 21 commits into
mainfrom
validate-runtime-params

Conversation

@lrcouto

@lrcouto lrcouto commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Addresses a possible RCE vulnerability on catalog type resolution through non-trusted runtime_params on the HTTP server.

Development notes

This PR was reworked after initial review. The first version added a dataset_modules_whitelist allowlist to OmegaConfigLoader based on #5568. We decided to not use an allowlist for this specific issue (an unified allowlist mechanism for Kedro is being currently discussed here: #5652)

For this current version, OmegaConfigLoader gains restrict_runtime_params_type_selection: bool = False. When set, any catalog type field actually resolved via runtime_params (at any nesting depth) is simply rejected.

Instead, KedroServiceSession.run() / .load_context() / ._get_config_loader() gains a trusted_runtime_params: bool = True parameter. trusted_runtime_params=False is passed by http_server.py's _execute_pipeline, since request.params is where untrusted and possibly malicious input is going to come from.

Impact to existing projects

Only projects whose catalog uses the runtime_params: resolver to set a dataset's type field, and run that catalog through the Kedro HTTP server, are affected. For example:

source_data:
  type: "${runtime_params:dataset.type}"
  filepath: "data/01_raw/companies.csv"

If the catalog does not contain this pattern, no changes need to be made.

If it does and it serves it over the HTTP server, POST /run requests that receive type from params will now fail with InterpolationResolutionError,


## Developer Certificate of Origin
All commits must be signed off to comply with the [DCO](https://developercertificate.org/). If your PR is blocked due to unsigned commits, follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR.

## Checklist

- [ ] Read the [contributing](https://github.com/kedro-org/kedro/blob/main/CONTRIBUTING.md) guidelines
- [ ] Linked to a relevant GitHub issue
- [ ] Signed off each commit with a [DCO](https://developercertificate.org/)
- [ ] Opened this PR as a 'Draft Pull Request' if it is work-in-progress
- [ ] Updated the documentation to reflect the code changes
- [ ] Added a description of this change in the [`RELEASE.md`](https://github.com/kedro-org/kedro/blob/main/RELEASE.md) file
- [ ] Added tests to cover my changes

Signed-off-by: Laura Couto <laurarccouto@gmail.com>
Signed-off-by: Laura Couto <laurarccouto@gmail.com>
Signed-off-by: Laura Couto <laurarccouto@gmail.com>
@lrcouto lrcouto linked an issue Aug 11, 2026 that may be closed by this pull request
Signed-off-by: Laura Couto <laurarccouto@gmail.com>
Signed-off-by: Laura Couto <laurarccouto@gmail.com>
@lrcouto lrcouto changed the title Add whitelist for dataset modules Validate Dataset modules for the Kedro HTTP server Aug 11, 2026
@lrcouto
lrcouto marked this pull request as ready for review August 11, 2026 18:11
@lrcouto
lrcouto requested a review from ankatiyar August 11, 2026 18:11
@ankatiyar

Copy link
Copy Markdown
Contributor

Thanks @lrcouto! I think before we add allowlisting mechanism here, we should wait to finalise the protocol re: #5652
In either case, I think we don't need to complicate the solution with allow listing at all. Is there a way we can check if the runtime_params passed by the user is an executable string (similar to the logging config bug we solved) if it goes into the type: field in general. Maybe we can centralise some utility functions and use them in the OmegaConfigLoader to check when catalog is being resolved?

@lrcouto

lrcouto commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @lrcouto! I think before we add allowlisting mechanism here, we should wait to finalise the protocol re: #5652 In either case, I think we don't need to complicate the solution with allow listing at all. Is there a way we can check if the runtime_params passed by the user is an executable string (similar to the logging config bug we solved) if it goes into the type: field in general. Maybe we can centralise some utility functions and use them in the OmegaConfigLoader to check when catalog is being resolved?

I'm thinking on how this could be done, because any dataset type entry is "executable" as in "running the module code", as it resolves to the dataset object. But not all of those have the possibility of being vulnerable to RCE. In the example of the PickleDataset, it'll load and arbitrary python object, which can be dangerous, but that same danger is not going to happen on a CSV dataset. The idea of using a whitelist would be to add that element of human oversight to the type selection before the dataset object itself is loaded.

So I'm considering blocking dataset selection via runtime_params only when the runtime_params themselves come from an untrusted source, i.e. from a request from outside. Lemme see if I can make that work.

lrcouto and others added 4 commits August 14, 2026 14:40
Signed-off-by: Laura Couto <laurarccouto@gmail.com>
Signed-off-by: L. R. Couto <57910428+lrcouto@users.noreply.github.com>
Signed-off-by: Laura Couto <laurarccouto@gmail.com>
Signed-off-by: Laura Couto <laurarccouto@gmail.com>
@lrcouto

lrcouto commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Pushed a different solution. A little less flexible than the allowlist, but simpler.

@ankatiyar ankatiyar 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.

Thanks @lrcouto this solution looks better to me - left some suggestions
Also wondering if this can be done in a slightly cleaner way without adding too much code in OmegaConfigLoader. I don't have a clean solution yet myself, will think about it some more and get back to you about this.

Comment thread docs/configure/how_to_use_templating.md Outdated
Comment thread docs/extend/serving.md Outdated
Comment thread kedro/server/http_server.py Outdated
Comment thread kedro/framework/session/service_session.py Outdated
k: v for k, v in merged_config_container.items() if not k.startswith("_")
}

@typing.no_type_check

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.

Is this necessary here and on line 435?

@lrcouto lrcouto Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mypy complains about the big Union that returns from OmegaConf.to_container. It's the same reason why this decorator is being used for load_and_merge_dir_config, for example.

lrcouto and others added 4 commits August 19, 2026 10:25
@lrcouto

lrcouto commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @ankatiyar ! Applied the suggested changes.

@merelcht merelcht 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.

The approach looks good to me. My main suggestion is to clean up the docstring/comments a bit, because they're quite verbose.

Comment thread docs/extend/serving.md
Comment thread kedro/config/omegaconf_config.py Outdated
Comment thread kedro/config/omegaconf_config.py Outdated
Comment thread kedro/framework/session/service_session.py Outdated

@ankatiyar ankatiyar 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.

Thanks @lrcouto the method looks good to me! I agree with merel's comments about making things less verbose!

Signed-off-by: Laura Couto <laurarccouto@gmail.com>
@lrcouto

lrcouto commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @merelcht ! Applied the suggested changes.

@merelcht merelcht 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.

Thanks Laura, this looks good to me now! 👍

@lrcouto
lrcouto enabled auto-merge (squash) August 24, 2026 13:03
@lrcouto
lrcouto merged commit b8cb7ff into main Aug 24, 2026
32 checks passed
@lrcouto
lrcouto deleted the validate-runtime-params branch August 24, 2026 13:09
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.

(security) Security Vulnerability

3 participants