CI tokens get the permissions the job uses, and nothing else
The default GITHUB_TOKEN can write to the repository. A test job does not need that.
permissions:
contents: read
jobs:
release:
permissions:
contents: write
id-token: writeRead at the top, write only on the job that publishes. A compromised dependency in the test job then cannot push a tag.
securityci