Skip to content

Harden the regex for space admins query #385

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sdelcroix
Copy link

Fixes #383

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.29%. Comparing base (ccb89b5) to head (1dcffff).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #385   +/-   ##
=======================================
  Coverage   97.29%   97.29%           
=======================================
  Files         146      146           
  Lines        3735     3735           
=======================================
  Hits         3634     3634           
  Misses        101      101           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

Would you mind to explain why this is necessary?

@sdelcroix
Copy link
Author

@microstudi Hi :)

Aren’t the details provided in the issue sufficient? I’m not sure what more I can add / say more.

@microstudi
Copy link
Contributor

I that issue you say that this addition to the regex solves the problem. However you also say that you just asked chatgpt, I don't have anything against it but it indicates that you don't know what this regex addition exactly does. I would like a clarification to ensure there are no more cases that can arise due this addition.

Also, this PR does not have a test to check that effectively it solves the bug., You thing you could add one?

@sdelcroix
Copy link
Author

sdelcroix commented May 9, 2025

Thanks for the answer @microstudi
I understand, that's fair ;)

As you can see in the commit, the part (?!\\d) has been added to the regex to be sure that the "searched" id is strictly found, and not followed by any other number.
Thus, if "8" is "searched", the regex won't return users with id beginning by "8" (81, 809, 813, 8xxx, ...).
If "81" is "searched", the regex won't return users with id beginning by "81" (812, 8145 ,81xxx, ...).
And so on.

Unfortunately, I'm not a ruby / RoR developer. I only contribute, in the Decidim ecosystem, with very small fixes which involve general programming knowledge.
So I don't have any in writing tests / specs for Ruby / RoR applications.

I'm open to learn though ! :)

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.

Admin accountabilty : space admins from other organizations are listed due to a too large capturing regex
2 participants