Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldap_attrs: escape ldap search filter #5435

Merged
merged 6 commits into from
Nov 4, 2022

Conversation

rekup
Copy link
Contributor

@rekup rekup commented Oct 28, 2022

SUMMARY

Escape ldap search parameter before passing it to search_s

Fixes #5434

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ldap_attrs

@felixfontein
Copy link
Collaborator

Thanks for your contribution! Can you please add a changelog fragment? Thanks.

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-4 labels Oct 28, 2022
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added WIP Work in progress bug This issue/PR relates to a bug module module net_tools plugins plugin (any type) small_patch Hopefully easy to review labels Oct 28, 2022
@rekup rekup marked this pull request as ready for review October 28, 2022 08:40
@ansibullbot ansibullbot removed WIP Work in progress small_patch Hopefully easy to review labels Oct 28, 2022
@felixfontein
Copy link
Collaborator

CC @mrvanes

@felixfontein felixfontein changed the title escape ldap search filter ldap_attrs: escape ldap search filter Oct 29, 2022
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

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

Looks correct to me. I'll merge by the end of this week if nobody complains.

@felixfontein
Copy link
Collaborator

@mrvanes since you're also interested in the LDAP modules, maybe you can take a look here?

@felixfontein
Copy link
Collaborator

Please note that in #5461 the collection repository was restructured to remove the directory tree in plugins/modules/, and the corresponding tree in tests/unit/plugins/modules/. Your PR modifies files in this directory structure, and unfortunately now has some conflicts, potentially because of this. Please rebase with the current main branch to remove the conflicts.

@ansibullbot ansibullbot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Nov 3, 2022
@rekup rekup closed this Nov 3, 2022
@rekup rekup force-pushed the fix/ldap_attrs_escape branch from b257953 to c181f2d Compare November 3, 2022 06:48
@rekup
Copy link
Contributor Author

rekup commented Nov 3, 2022

I'm sorry I messed up the rebase. I'll try to fix this

@felixfontein
Copy link
Collaborator

@rekup rekup reopened this Nov 3, 2022
@rekup
Copy link
Contributor Author

rekup commented Nov 3, 2022

Thanks for your help and reviews @felixfontein, I really appreciate that! I think I've managed to restore the commits.

@ansibullbot ansibullbot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Nov 3, 2022
@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Merging #5435 (c181f2d) into main (c181f2d) will not change coverage.
The diff coverage is n/a.

❗ Current head c181f2d differs from pull request most recent head a0df4f3. Consider uploading reports for the commit a0df4f3 to get more accurate results

@@           Coverage Diff           @@
##             main    #5435   +/-   ##
=======================================
  Coverage   45.50%   45.50%           
=======================================
  Files         988      988           
  Lines       97111    97111           
  Branches    17743    17743           
=======================================
  Hits        44191    44191           
  Misses      50876    50876           
  Partials     2044     2044           
Flag Coverage Δ
integration 71.22% <0.00%> (ø)
sanity 21.31% <0.00%> (ø)
stub 0.00% <0.00%> (ø)
units 68.14% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@felixfontein felixfontein merged commit 1a97ca1 into ansible-collections:main Nov 4, 2022
@patchback
Copy link

patchback bot commented Nov 4, 2022

Backport to stable-4: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 1a97ca1 on top of patchback/backports/stable-4/1a97ca1a6f77cabca78d18bfd8a9f46939f11f8a/pr-5435

Backporting merged PR #5435 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible-collections/community.general.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-4/1a97ca1a6f77cabca78d18bfd8a9f46939f11f8a/pr-5435 upstream/stable-4
  4. Now, cherry-pick PR ldap_attrs: escape ldap search filter #5435 contents into that branch:
    $ git cherry-pick -x 1a97ca1a6f77cabca78d18bfd8a9f46939f11f8a
    If it'll yell at you with something like fatal: Commit 1a97ca1a6f77cabca78d18bfd8a9f46939f11f8a is a merge but no -m option was given., add -m 1 as follows intead:
    $ git cherry-pick -m1 -x 1a97ca1a6f77cabca78d18bfd8a9f46939f11f8a
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR ldap_attrs: escape ldap search filter #5435 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-4/1a97ca1a6f77cabca78d18bfd8a9f46939f11f8a/pr-5435
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Nov 4, 2022
@patchback
Copy link

patchback bot commented Nov 4, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/1a97ca1a6f77cabca78d18bfd8a9f46939f11f8a/pr-5435

Backported as #5469

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Nov 4, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1a97ca1)
@felixfontein
Copy link
Collaborator

@rekup thanks for fixing this!

felixfontein pushed a commit to felixfontein/community.general that referenced this pull request Nov 4, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1a97ca1)
felixfontein pushed a commit that referenced this pull request Nov 4, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1a97ca1)

Co-authored-by: Reto Kupferschmid <kupferschmid@puzzle.ch>
russoz pushed a commit to russoz-ansible/community.general that referenced this pull request Nov 5, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
felixfontein added a commit that referenced this pull request Nov 6, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1a97ca1)

Co-authored-by: Reto Kupferschmid <kupferschmid@puzzle.ch>
bratwurzt pushed a commit to bratwurzt/community.general that referenced this pull request Nov 7, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
bratwurzt pushed a commit to bratwurzt/community.general that referenced this pull request Nov 7, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
russoz pushed a commit to russoz-ansible/community.general that referenced this pull request Nov 10, 2022
* escape ldap search filter

* move escape to separate line

* add changelog fragment

* Update changelogs/fragments/5435-escape-ldap-param.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix encoding

* fixup! fix encoding

Co-authored-by: Felix Fontein <felix@fontein.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_issue module module net_tools plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ldap_attrs does not escape attribute values
3 participants