Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Read and write both small and large files to Github.
The regular GitHub Contents API can't handle files larger than 1MB - this class knows how to spot that problem and switch to the large-file-supporting low level Git Data API instead.
Note that file contents is passed and returned as bytestrings, not regular strings.
pip install github-contents
You will need a GitHub OAuth token with full repository access.
The easiest way to create one of these is using https://github.com/settings/tokens
from github_contents import GithubContents
# For repo simonw/disaster-data:
github = GithubContents(
"simonw",
"disaster-data",
token=GITHUB_OAUTH_TOKEN,
branch="main"
)
To read a file:
content_in_bytes, sha = github.read(path_within_repo)
To write a file:
content_sha, commit_sha = github.write(
filepath=path_within_repo,
content_bytes=contents_in_bytes,
sha=previous_sha, # Optional
commit_message=commit_message,
committer={
"name": COMMITTER_NAME,
"email": COMMITTER_EMAIL,
},
)
FAQs
Python class for reading and writing data to a GitHub repository
We found that github-contents demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.