Skip to content

Conversation

@marksmith
Copy link
Collaborator

Method hardening is enabled by default, to discourage dangerous undocumented method misuse i.e. calling File.join with possibly nested arrays (see #168 for a discussion of method hardening for File.join; the only hardened method currently implemented.)

This change allows method hardening to be disabled globally, by setting the harden configuration option to false in Ruby or by using the AIKIDO_HARDEN environment variable. Method hardening should only be disabled if the detected misuse is not immediately correctable.

If method hardening is disabled, in order to reliably detect path traversal attacks in File.join, all arrays in user input must be treated as potential paths, joined and stored in the context, at a potentially significant cost. (See #155 for a discussion of this fallback to fix File.join path traversal bypasses).

Method hardening is enabled by default to discourage dangerous
undocumented method misuse.

To disable method hardening, set the harden configuration option
to false in Ruby or using the AIKIDO_HARDEN environment variable.
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@marksmith
Copy link
Collaborator Author

marksmith commented Oct 29, 2025

The fallback solution could be optimized by limiting the special case to array query parameters. Should this be done?

@marksmith marksmith merged commit bbe9972 into main Oct 30, 2025
33 checks passed
@marksmith marksmith deleted the conditionally-harden-methods branch October 30, 2025 08:40
@marksmith
Copy link
Collaborator Author

Optimization was discussed internally and the decision was made not to optimize this now.

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