I want to use Jenkinsfile from local system
I don't think there is any way to get this to work directly anymore, and I don't think it was ever intended to be supported. If your goal is to reuse the same Jenkinsfile across Pipelines, the closest supported equivalent would be to use a Pipeline library as I recommended in JENKINS-67879. We could potentially add a way to disable the related security fixes to make this work again, but note that if you have a Jenkins instance where not all users are admins, the vulnerabilities would effectively give all of those users admin permission.
Why should the script from the jenkinsfile not be able to access other files from the own checkout (if the "Lightweight checkout" is not enabled)?
If you need to use the checkout, I would use the checkout step (ideally with a lightweight checkout of the Jenkinsfile if supported by your SCM plugin to avoid double checkouts), combined with the dir step if you need to put the checkout in a specific directory. The security fix only hashes the checkout directories that get automatically created on the controller to support heavyweight checkouts (to avoid directory reuse across SCMs), which is required for SCM plugins that do not support lightweight checkout. If your Pipeline is currently accessing the files from the heavyweight checkout on the Jenkins controller, then you are either running builds on the controller (very unsafe!), or are doing things in a trusted Pipeline library that are probably better done with a sh step that runs on an agent.
If you cannot use lightweight checkout for the Jenkinsfile and really need to look at the heavyweight checkout directories on the controller, you can examine the contents of the <hash>-scm-key.txt files at the same level as the checkout directories to look for a specific SCM and then use the hash directory with the same name. Also, note that the directories are not randomized, they are a hashed version of the SCM key and a hidden key in Jenkins, so once the directory has been created once, the hash will always be the same for that SCM on that Jenkins instance going forward.
But I have my own plugin in Jenkins that uses the workflow-cps plugin for getting Jenkinsfile script from jenkins workspace <job_name>@script directory.
Do you have a link to this plugin? There may be better APIs to use depending on what exactly you are doing.
I have the same problem: I have a pipeline checking out the jenkinsfile and try to access other files from the checkout.
Why should the script from the jenkinsfile not be able to access other files from the own checkout (if the "Lightweight checkout" is not enabled)?
So I think the solution is, that the plugin provides an official way to access the checkout.
As a workaround you can downgrade workflow_cps (Pipeline: Groovy) to https://updates.jenkins-ci.org/download/plugins/workflow-cps/2648.va9433432b33c/workflow-cps.hpi