Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

First pass at removing unneeded capture groups #838

Merged
merged 2 commits into from Sep 24, 2017

Conversation

fgsch
Copy link
Contributor

@fgsch fgsch commented Jul 18, 2017

While here also remove some unnecessary capture actions.

@fgsch
Copy link
Contributor Author

fgsch commented Jul 18, 2017

Part of #839

@dune73
Copy link
Contributor

dune73 commented Jul 20, 2017

Thank you for the PR, @fgsch. I think we have not talked about the unneeded capture groups before. However, I see it loosely related to the rule cleanup project outlined in #808. Is that correct and should we tag this PR and the new issue that you made with that rule cleanup tag.

Also: Could you describe the steps and techniques you use in this PR in a few words. Not everybody is a regex king...

@fgsch
Copy link
Contributor Author

fgsch commented Jul 20, 2017

It's indeed loosely related but I decided to handle this separately since the process is somewhat manual. I'm happy for you to add the rule cleanup tag as long as we treat them as separate things (e.g. they don't block each other).

Regarding the steps and techniques, I will address it in a separate comment.

@dune73
Copy link
Contributor

dune73 commented Sep 8, 2017

OK. Back to this one. It was all nice and beautiful, but we let it lay around too long and now it has settled some dust.

I'm ready to merge, but we have merged the whitespace PR to v3.0/dev in the meantime. And I also think this should go against v3.1/dev (and later considered for backporting).

When rebasing against v3.1/dev it might be worth considering the parallel whitespace PR coming out of rule cleaning as well. This is meant to be pushed in quickly too.

If that's settled, I'm ready to merge.

@fgsch
Copy link
Contributor Author

fgsch commented Sep 10, 2017

OK, I will rebase this against 3.1 and update this PR.

@dune73
Copy link
Contributor

dune73 commented Sep 14, 2017

Thank you.

@fgsch fgsch force-pushed the fgsch/rm-unneeded-capture-groups branch from b9c2862 to 01fc636 Compare September 15, 2017 10:12
@fgsch fgsch changed the base branch from v3.0/dev to v3.1/dev September 15, 2017 10:12
@fgsch
Copy link
Contributor Author

fgsch commented Sep 15, 2017

Updated.

I've split the changes across 2 commits, one for the removal of capture groups, and one for the capture action.

As I mentioned this is the first of more commits to address it.

@fgsch fgsch force-pushed the fgsch/rm-unneeded-capture-groups branch from 01fc636 to 95ca50e Compare September 21, 2017 07:28
@fgsch fgsch changed the base branch from v3.1/dev to v3.0/dev September 21, 2017 07:29
@fgsch fgsch changed the base branch from v3.0/dev to v3.1/dev September 21, 2017 07:29
@fgsch fgsch force-pushed the fgsch/rm-unneeded-capture-groups branch 2 times, most recently from e479a8f to 72cfe30 Compare September 21, 2017 07:42
@fgsch
Copy link
Contributor Author

fgsch commented Sep 21, 2017

Updated after the merge of #897.
As a bonus removed the trailing spaces to make the CI happy.

@dune73
Copy link
Contributor

dune73 commented Sep 21, 2017

Hope to find time to look into this (and many other PRs) today.

@dune73
Copy link
Contributor

dune73 commented Sep 22, 2017

I took a closer look and it looks quite good.

However, I think some of the capture actions you remove are necessary. For example in 920420, where the match is referenced as TX:0 in the chained rule.

@fgsch
Copy link
Contributor Author

fgsch commented Sep 22, 2017

You are correct. I got confused with MATCHED_VAR, sorry.
I will correct this and repush.

@dune73
Copy link
Contributor

dune73 commented Sep 22, 2017

Please do. And please check the other ones as well. I am not sure it all caught my attention.

@fgsch fgsch force-pushed the fgsch/rm-unneeded-capture-groups branch from 72cfe30 to 46bd0e2 Compare September 22, 2017 12:14
@fgsch
Copy link
Contributor Author

fgsch commented Sep 22, 2017

I've removed the commit altogether for now so this only deals with the capture groups (and the trailing space for travis' sake).

@dune73
Copy link
Contributor

dune73 commented Sep 22, 2017

OK. I looked again. No hard regressions seen anymore.

However, I am really afraid of killing functionality in areas where we do not have unit tests. This is a fairly dangerous PR.

Could somebody else take a close look too?

Also, is this meaning to do away with every unnecessary capture group or only some of them?

@fgsch
Copy link
Contributor Author

fgsch commented Sep 22, 2017

Also, is this meaning to do away with every unnecessary capture group or only some of them?

All of them.

@dune73
Copy link
Contributor

dune73 commented Sep 24, 2017

I'm not really sure I look at the right things, but how about 942440?

@dune73
Copy link
Contributor

dune73 commented Sep 24, 2017

Other than that, I have ran extensive tests on this PR and it looks OK AFAICT.

I am inclined merge after some more clarifications. Anybody disagree?

@lifeforms
Copy link
Contributor

Visually walked through this PR and done some very quick tests, I see no problems!

@dune73
Copy link
Contributor

dune73 commented Sep 24, 2017

OK, I'll wait for a response on 942440 from @fgsch and then I'll merge.

@fgsch
Copy link
Contributor Author

fgsch commented Sep 24, 2017

Re 942440, I have misunderstood your question.
Since this requires manual verification I've decided to split the work in multiple PRs.

This work is meant to eventually do all of them but this PR only covers some.
Sorry for the misunderstanding.

@dune73
Copy link
Contributor

dune73 commented Sep 24, 2017

So we can merge this, but then there will be additional PRs? (-> OK with me)

@fgsch
Copy link
Contributor Author

fgsch commented Sep 24, 2017

@dune73 yup, that's the idea.

@dune73
Copy link
Contributor

dune73 commented Sep 24, 2017

Thank you, @fgsch. Merging.

@dune73 dune73 merged commit dc063e9 into SpiderLabs:v3.1/dev Sep 24, 2017
@dune73 dune73 mentioned this pull request Sep 24, 2017
fzipi added a commit to fzipi/owasp-modsecurity-crs that referenced this pull request Sep 24, 2017
@fgsch fgsch deleted the fgsch/rm-unneeded-capture-groups branch May 9, 2019 15:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants