I have created a second generation managed package using the dev hub org and namespace org and I have connected the dev hub org in the organizations subtab in publishing tab. But when I tried to login in the partner security portal (https://security.secure.force.com/sourcescanner/) my package is not showing up in the list even when I search with the package Id and org Id. I am unable to scan the managed package.
You can create a scratch org or dev org and push the source of your package into that org and then use its username on the form that's shown on the home page of the scanner application.
The URL for the free scan is this: https://security.my.salesforce-sites.com/security/tools/forcecom/scanner