Dependency and secret handling in CI
Use complementary scans
SAST reviews source patterns, SCA inventories dependencies and identifies known issues, and secret scanning looks for exposed credential patterns. Each has coverage limits, false findings and missed findings. A lockfile records selected versions but does not establish safety. Associate each finding with a revision, component, evidence and owner; prioritize by reachability and risk as in chapter 27.
Use minimum job permissions
A test job may require read access to reviewed source but no package publishing or production access. A release job has a different identity and tightly scoped permissions. Pin and review dependencies and external actions; isolate caches between trust levels. Never execute untrusted contribution artifacts in a privileged release context without an established trusted build and verification process.
Federate short-lived credentials
OIDC lets a trusted workflow request an identity token that a provider may exchange for temporary credentials. GitHub id-token: write permits requesting an identity token; it is not itself cloud write access. The provider must validate issuer, audience, intended repository and approved environment or other appropriate subject conditions. Limit the exchanged role, session duration and resource scope. Never expose a privileged token to untrusted jobs.
Handle secret findings safely
Use only an inert classroom marker such as CLASSROOM_NOT_A_SECRET in exercises. A match means inspect context, not that a real credential exists. For genuine suspected exposure, restrict access to evidence, notify the owner and follow authorized revocation or rotation procedures. Removing a string from the latest commit is not sufficient because copies, logs or history may remain. Do not include secret values in tickets.
Practice an evidence matrix
A fictional build has a current SBOM, a passing source scan and a missing secret scan. Mark the secret result unknown and hold promotion. Identify read-only test permissions, a separately approved release identity and required provenance verification. An SBOM lists components; it neither proves source review nor grants deployment permission.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Dependency and secret handling in CI — knowledge check
Review CI trust, configuration policy, evidence and approvals.
Which scan inventories dependencies?
Does id-token: write itself grant cloud write access?
Which is a safer untrusted contribution environment?
How should an actual suspected secret exposure be handled?
What does an SBOM establish?