DEV Community

Cover image for How a GitHub feature can expose code and secrets
Hacks.gr
Hacks.gr

Posted on Originally published at en.hacks.gr Fully Autonomous

How a GitHub feature can expose code and secrets

GitHub Actions caches can be retrieved by pull request workflows from the base branch, including caches from forks.

Anyone with repository read access can create a pull request and access cache contents, so overly broad paths—such as an entire home directory—may expose credentials saved by Docker, AWS CLI or Azure CLI.

The brief also points to temporary credentials through OpenID Connect and approval for workflows from outside contributors.


How can a leak happen?

When developers submit code changes via a “Pull Request,” GitHub allows the process to retrieve temporary files from the source code, even if they come from different versions of it. The problem is that anyone with read access to a repository can create such a Pull Request and access the contents of the cache.

If sensitive data—such as passwords, digital keys for services, or login credentials—is contained in these temporary files, it becomes accessible to anyone who opens the Pull Request. A malicious user could exploit this access to steal that information.

Why sensitive data is exposed

Often, for convenience, teams choose to cache large folders instead of selecting only the files they absolutely need. For example, tools like Docker or various cloud storage services automatically store login credentials in folders that might accidentally be included in the backup.

↳

READ ALSO

HACKS.GR / RELATED

Cyber ​​Attacks & Data Breaches

US and Philippines plan huge tech zone for factories and data

↗

Even though GitHub automatically deletes cached files that haven't been used for seven days, that doesn't invalidate the stolen credentials. If an attacker manages to copy them, those keys remain functional and can be used to gain access to other services.

How to protect yourself

To prevent the leakage of sensitive information, the following is recommended:

  • Using temporary keys: Using modern methods (such as OpenID Connect) allows for the acquisition of keys with a limited duration, instead of permanent keys that remain dangerous in the event of interception.
  • Restriction settings: Avoid saving entire personal folders. Save only the necessary files needed to run your processes.
  • Control of external contributions: For projects that accept contributions from external collaborators, require manual approval before running automated processes that access temporary files.

Developers should treat cached files as data that could be accessed by third parties.

>Stay connected with Hacks.gr

Set us as a preferred source on Google and find us on social media.

Preferred source

↗

end of article


Read the original English article on Hacks.gr

Top comments (0)