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

brk: migrate from core #5213

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

aryangupta701
Copy link
Contributor

@aryangupta701 aryangupta701 commented Jan 13, 2024

Overview

Part of zaproxy/zaproxy#8153

  • migrate brk form core to addon
  • update plugnhack to use brk addon
  • update websocket to use brk addon
  • update brk addon to use network addon

Related Issues

Specify any related issues or pull requests by linking to them.

Checklist

  • Update help
  • Update changelog
  • Run ./gradlew spotlessApply for code formatting
  • Write tests
  • Check code coverage
  • Sign-off commits
  • Squash commits
  • Use a descriptive title

For more details, please refer to the developer rules and guidelines.

I have read the CLA Document and I hereby sign the CLA

Signed-off-by: aryangupta701 <garyan447@gmail.com>
@thc202 thc202 changed the title migratre break to addon break: migrate from core Jan 13, 2024
Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
@thc202
Copy link
Member

thc202 commented Jan 14, 2024

You need to add the new add-on/project to the settings.gradle.kts file:

var addOns = listOf(

Note that network should not depend on the new add-on.

@aryangupta701
Copy link
Contributor Author

why should the network not depend on the break addon? I mean it will be using it right?

@aryangupta701
Copy link
Contributor Author

also how should I use this class? WithConfigsTest I am not able to use it directly I think I will have to create a clone for it in zap-extensions also?

@thc202
Copy link
Member

thc202 commented Jan 14, 2024

#5213 (comment)

The network add-on does not need the break functionality to work, it could be an optional dependency but even in that case there's no networking functionality that would depend on it. What should be done is change the network add-on to allow to set the serializer and the break add-on would set it.

#5213 (comment)

You need to adapt the tests to use TestUtils from the testutils project.

@aryangupta701
Copy link
Contributor Author

can plugnhack and websocket depend on break addon? @thc202

Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
@thc202
Copy link
Member

thc202 commented Jan 14, 2024

Yes, although it could be an optional dependency.

@aryangupta701
Copy link
Contributor Author

can you share an example of how to add an optional dependency?

Signed-off-by: aryangupta701 <garyan447@gmail.com>
@thc202
Copy link
Member

thc202 commented Jan 14, 2024

register("org.zaproxy.zap.extension.quickstart.spider.ExtensionQuickStartSpider") {
classnames {
allowed.set(listOf("org.zaproxy.zap.extension.quickstart.spider"))
}
dependencies {
addOns {
register("spider") {
version.set(">=0.1.0")
}
}
}
}

@thc202 thc202 changed the title break: migrate from core brk: migrate from core Jan 15, 2024
Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
@aryangupta701
Copy link
Contributor Author

are there any any existing help pages for brk extension? @thc202

@thc202
Copy link
Member

thc202 commented Jan 15, 2024

#5213 (comment)

You need to create a new extension in the corresponding add-ons (in the previous example, ExtensionQuickStartSpider which accesses the spider add-on). The classnames should allow classes (though simpler with a package) of the add-on itself not of the dependency.

#5213 (comment)

Yes, they are all currently in the zap-core-help repo (e.g. https://github.com/zaproxy/zap-core-help/blob/73a4fd1d5d2ae72fef6607ff35e3b22e49ea667a/addOns/help/src/main/javahelp/contents/ui/dialogs/addbreak.html).

@aryangupta701
Copy link
Contributor Author

I am planning to do this in 4 different PRs as updated in this PR's description. Will it be fine?

Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
Signed-off-by: aryangupta701 <garyan447@gmail.com>
@psiinon
Copy link
Member

psiinon commented Jan 15, 2024

Thats fine as long as the changes are consistant and dont break things inbetween the PRs.

@thc202
Copy link
Member

thc202 commented Feb 15, 2024

Yes, similar to what was done for the spider zaproxy/zaproxy#7335.

@aryangupta701
Copy link
Contributor Author

I am not sure why CLA is not working

@psiinon
Copy link
Member

psiinon commented Feb 16, 2024

I am not sure why CLA is not working

Me neither :/
Your details are not being added to https://github.com/zaproxy/cla/blob/main/signatures/version1/cla.json

@aryangupta701
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@aryangupta701 aryangupta701 marked this pull request as draft February 16, 2024 10:09
@aryangupta701 aryangupta701 marked this pull request as ready for review February 16, 2024 10:09
@aryangupta701

This comment has been minimized.

@aryangupta701

This comment has been minimized.

@aryangupta701

This comment has been minimized.

@thc202
Copy link
Member

thc202 commented Feb 16, 2024

Add just the agreeing comment and no other comments after (we will have to run the check manually).

@aryangupta701
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@zaproxy zaproxy deleted a comment from kingthorin Feb 16, 2024
zapbot added a commit to zaproxy/cla that referenced this pull request Feb 16, 2024
@thc202
Copy link
Member

thc202 commented Feb 16, 2024

CLA is now passing, it was hitting the default comments limit. Also removed the dummy test commit.

Signed-off-by: aryangupta701 <garyan447@gmail.com>
@aryangupta701
Copy link
Contributor Author

I think now is the good time for a quick review

@thc202
Copy link
Member

thc202 commented Mar 15, 2024

Did you mean to push more changes? Previous comments are still pending (e.g. #5213 (comment)).

@aryangupta701
Copy link
Contributor Author

oops forgot that. Thanks

Signed-off-by: Aryan Gupta <garyan447@gmail.com>
@aryangupta701
Copy link
Contributor Author

shall I now move on to other addons to migrate to brk addon?

addOns/brk/CHANGELOG.md Outdated Show resolved Hide resolved
@thc202
Copy link
Member

thc202 commented Mar 26, 2024

IMO better finish the changes in the brk add-on before that.

Co-authored-by: Rick M <kingthorin@users.noreply.github.com>
Signed-off-by: Aryan Gupta <garyan447@gmail.com>
@aryangupta701
Copy link
Contributor Author

what changes are left for break add-on?

@thc202
Copy link
Member

thc202 commented Apr 4, 2024

At least the following:

  • Second part of brk: migrate from core #5213 (comment)
  • Finish help migration (add a main page and move all core help content)
  • Use other order and name for the extension (currently failing with class cast exceptions as existing add-ons try to use it)
  • Don't throw RuntimeException if not able to find core interface (although that will be guarded by the deprecation check, it should still handle that case gracefully)
  • The extension should be unloadable (also worth double check that all is)
  • BreakpointsParam should be changed to extend VersionedAbstractParam
  • Do not rely on core resource messages for the API's descriptions
  • Remove since JavaDoc tags, no longer apply since this is new code
  • Update help keys to use the ones of the add-on (e.g. calls to ExtensionHelp.enableHelpKey(...) and overrides of getHelpIndex())

@kingthorin
Copy link
Member

@aryangupta701 are you able to keep going with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants