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

Fix always recompile regex URL for rules #291

Closed
wants to merge 1 commit into from
Closed

Fix always recompile regex URL for rules #291

wants to merge 1 commit into from

Conversation

lehainam-dev
Copy link

@lehainam-dev lehainam-dev commented Nov 1, 2019

Related issue

This condition always return true, because Rule.Match.compiledURL and Rule.Match.compiledURLChecksum is never updated in RepositoryMemory.rules, leading the expensive function CompileRegex always call each time oathkeeper check an URL is match rules or not.

I found this issue when testing oathkeeper performance with pprof.

Proposed changes

I change the way RepositoryMemory.rules and Rule.Match should update.

Honestly, I am not familiar with golang much. Please review and suggest if you have are better solutions.

Checklist

  • I have read the contributing guidelines
  • I have read the security policy
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got green light (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation within the code base (if appropriate)
  • I have documented my changes in the
    developer guide (if appropriate)

@CLAassistant
Copy link

CLAassistant commented Nov 1, 2019

CLA assistant check
All committers have signed the CLA.

@aeneasr
Copy link
Member

aeneasr commented Nov 1, 2019

Thank you! Would it be possible to add a test so this doesn't break in a future change accidentally?

@aeneasr
Copy link
Member

aeneasr commented Nov 14, 2019

Just checking back in if you'd be open for adding a test

@lehainam-dev
Copy link
Author

Hi @aeneasr ,
Sorry, I don't think that I would be available to write some tests.
I will pass this issue to your team. Thanks for your incredible work.

aeneasr added a commit that referenced this pull request Dec 17, 2019
A bug caused the rule matcher to not cache the regular expression result.

Closes #291
@aeneasr aeneasr closed this in #313 Dec 17, 2019
aeneasr added a commit that referenced this pull request Dec 17, 2019
A bug caused the rule matcher to not cache the regular expression result.

Closes #291
pike1212 pushed a commit to pike1212/oathkeeper that referenced this pull request Dec 18, 2019
A bug caused the rule matcher to not cache the regular expression result.

Closes ory#291
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.

3 participants