Skip to content

Conversation

leegarrett
Copy link
Contributor

@leegarrett leegarrett commented Apr 25, 2025

From the ansible 2.19 release notes:

  • templating - The disable_lookups option has no effect, since plugins must be updated to apply trust before any templating can be performed.

Fixes: #4592

@leegarrett
Copy link
Contributor Author

Not sure if ansible-lint only supports the latest ansible version, or a range. In the latter case this should probably fall back to setting it again in < 2.19.

@leegarrett leegarrett force-pushed the fix_unit_tests_4592 branch from 1a5ca3c to 2c7b6e9 Compare April 25, 2025 17:27
@leegarrett leegarrett changed the title Don't pass deprecated disable_lookups to template function (fixes: #4592) Don't pass deprecated disable_lookups to template function (fixes: ansible#4592) Apr 25, 2025
…sible#4592)

From the ansible 2.19 release notes:
- templating - The ``disable_lookups`` option has no effect, since plugins must be updated to apply trust before any templating can be performed.

So remove it.
@ssbarnea ssbarnea changed the title Don't pass deprecated disable_lookups to template function (fixes: ansible#4592) Don't pass deprecated disable_lookups to template function Jun 17, 2025
@ssbarnea ssbarnea self-assigned this Jun 17, 2025
@ssbarnea ssbarnea enabled auto-merge (squash) June 17, 2025 10:07
@ssbarnea ssbarnea merged commit 3fe9fb5 into ansible:main Jun 17, 2025
28 checks passed
@felixfontein
Copy link
Contributor

This (very likely) causes unwanted code execution, see #4643.

@alisonlhart
Copy link
Contributor

Hi @leegarrett, we're going to revert this change and release a patch fix because of #4643. If you could augment this change with a fix for the issue, that would be great. It appears there should be a version check, as you suggested in a comment originally.

alisonlhart added a commit to alisonlhart/ansible-lint that referenced this pull request Jun 18, 2025
@felixfontein
Copy link
Contributor

I think the only proper fix is to stop evaluating Jinja2 expressions. This has always been problematic and dangerous (see #2681). Imagine a collection where one lookup deletes every file in your home folder. If the collection also contains a role that has a template expression somewhere that calls the lookup, running ansible-lint on that collection will wipe all your files. This is not something folks expect to happen when running a linter.

Also the core team seems to be completely unaware of ansible-lint using disable_lookups, since there is a comment Skipping a deferred deprecation due to no known usage outside ansible-core. next to where the deprecation is emitted. CC @nitzmahone

@leegarrett
Copy link
Contributor Author

I'm fine with it being reverted. I however have no deeper knowledge on how to properly fix this and will pass on it. I just naively went with the 2.19 changelog, removed it, and gave it a quick test on my set of playbooks.

@alisonlhart
Copy link
Contributor

@leegarrett Thanks for the update, completely understood.
@felixfontein I see your point. We should have a deeper conversation on how to proceed on this. Can you open this as a discussion topic in this repo? Or open a new issue to discuss the broader topic? Instead of my fix in #4648, maybe we should just revert this change as mentioned above and decide where to go from there for 2.19 support.

@ssbarnea
Copy link
Member

@leegarrett We reverted this due to regression being detected. It will need to be redone with modifications to prevent that regression from happening.

@felixfontein
Copy link
Contributor

I started a discussion here: #4652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Unit tests fail when running against ansible 2.19
5 participants