Skip to content

Conversation

@adolago
Copy link
Owner

@adolago adolago commented Feb 7, 2026

replaced DefaultHasher in hash filter with real cryptographic implementations (sha2, md5, sha1, blake3).


PR created automatically by Jules for task 16918420736395756210 started by @dolagoartur

Replaced the insecure `DefaultHasher` implementation in the `hash` filter with
proper cryptographic hash functions. Supported algorithms are `sha256` (default),
`sha512`, `md5`, `sha1`, and `blake3`.

- Used `sha2`, `md5`, `sha1`, `blake3` crates for consistent and standard hashing.
- Updated `hash` filter signature to return `Result` for better error handling.
- Added comprehensive tests for each supported algorithm.
- Removed misleading comments about `DefaultHasher`.

This ensures that `{{ 'value' | hash('sha256') }}` returns the actual SHA256 hash
instead of a random internal hash.

Co-authored-by: dolagoartur <146357947+dolagoartur@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5fbc475dec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +518 to +520
_ => Err(minijinja::Error::new(
minijinja::ErrorKind::InvalidOperation,
format!("Unsupported hash algorithm: {}", algo),

Choose a reason for hiding this comment

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

P2 Badge Allow documented hash algorithms in parser filter

The parser’s hash filter now returns an error for any algorithm outside the hardcoded list. This is a behavioral regression for templates that use algorithms the project documents elsewhere (e.g., sha384, blake2b, blake2s in src/plugins/filter/hash.rs), or that previously relied on defaulting behavior. In those cases render_template will now fail and abort variable rendering, even though the rest of the system claims Ansible-compatible support. Consider aligning the parser’s supported algorithms with the documented list or defaulting to sha256 for unknown algorithms instead of raising an error.

Useful? React with 👍 / 👎.

@adolago adolago merged commit 2666983 into main Feb 11, 2026
20 of 23 checks passed
@adolago adolago deleted the sentinel-secure-hash-filter-16918420736395756210 branch February 11, 2026 09:14
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.

1 participant