Yes, exactly this - or ideally as a conditional that I could use with the when: clause to control whether a step runs at all based on whether the PR is from a fork or not.
The use case is that we have two repos - a public OSS repo, and a private Enterprise repo which contains proprietary code (that we include as a submodule and check out using secrets)
My aim is to set up one pipeline that runs tests against every PR raised, but contains a conditional check that will only expose the secrets to clone the Enterprise submodule if the PR does not come from a fork - i.e. it was raised from a branch inside our repo, which has push access locked down to company staff only.