Skip to content

Update npm_and_yarn dependencies and enhance parameter sanitization#97

Merged
rsmoke merged 7 commits intomainfrom
staging
Mar 31, 2026
Merged

Update npm_and_yarn dependencies and enhance parameter sanitization#97
rsmoke merged 7 commits intomainfrom
staging

Conversation

@rsmoke
Copy link
Copy Markdown
Member

@rsmoke rsmoke commented Mar 31, 2026

This pull request introduces a new mechanism to sanitize incoming request parameters by removing null bytes, preventing potential issues or security risks associated with null byte injection. The sanitization is applied recursively to all parameters, including nested structures. Comprehensive request specs are also added to verify this behavior for user registration and login flows.

Parameter sanitization improvements:

  • Added a before_action in ApplicationController to recursively strip null bytes from all incoming parameters, including nested hashes and arrays. This ensures that no null bytes are present in any part of the request data.

Testing and validation:

  • Added request specs for user registration in user_registrations_spec.rb to verify that null bytes are sanitized from both top-level and nested parameters, and that user creation still succeeds.
  • Added request specs for user login in user_sessions_spec.rb to confirm that login works as expected even when null bytes are present in parameters, including nested structures.

dependabot bot and others added 6 commits March 26, 2026 04:38
Bumps the npm_and_yarn group with 1 update in the / directory: [yaml](https://github.com/eemeli/yaml).


Updates `yaml` from 2.3.4 to 2.8.3
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v2.3.4...v2.8.3)

---
updated-dependencies:
- dependency-name: yaml
  dependency-version: 2.8.3
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Implemented a before_action to strip null bytes from request parameters, enhancing security and data integrity. Introduced methods to recursively sanitize strings, arrays, hashes, and ActionController::Parameters, ensuring all incoming data is clean before processing.
Implemented tests to ensure that user registration handles null bytes in parameters correctly. The specs verify that null bytes are sanitized without raising errors and that the user is successfully created, both for flat and nested payloads. This enhances the robustness of user input handling in the registration process.
…arn-8ffe74b2ea

Bump yaml from 2.3.4 to 2.8.3 in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 2 updates in the / directory: [brace-expansion](https://github.com/juliangruber/brace-expansion) and [picomatch](https://github.com/micromatch/picomatch).


Updates `brace-expansion` from 1.1.12 to 1.1.13
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](juliangruber/brace-expansion@v1.1.12...v1.1.13)

Updates `picomatch` from 2.3.1 to 2.3.2
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.13
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
…arn-f9a7637a8a

Bump the npm_and_yarn group across 1 directory with 2 updates
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a global Rails request-parameter sanitization hook to remove null bytes (\u0000) from incoming params, and updates a few Yarn-locked dependencies. New request specs cover sign-up and sign-in flows when null bytes are present in submitted parameters.

Changes:

  • Add an ApplicationController before_action that recursively strips null bytes from request parameters.
  • Add request specs for Devise user registration and session creation with null-byte-containing params (including nested structures).
  • Update yarn.lock entries for brace-expansion, picomatch, and yaml.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 7 comments.

File Description
app/controllers/application_controller.rb Adds recursive null-byte stripping for incoming parameters via a before_action.
spec/requests/user_registrations_spec.rb Adds registration request specs exercising null-byte sanitization behavior.
spec/requests/user_sessions_spec.rb Adds login request specs exercising null-byte sanitization behavior.
yarn.lock Bumps a few transitive JS dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Implemented a test to ensure that null bytes in passwords are sanitized during user authentication. The test verifies that no errors are raised and that the user is redirected appropriately after login. This enhances the security of user session handling by ensuring that null bytes do not disrupt the authentication process.
@rsmoke rsmoke merged commit cbad1f4 into main Mar 31, 2026
5 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