Open
Description
Describe the feature or problem you’d like to solve
Enable functionality for Dependabot, Secret Scanning and Push Protection for repositories.
It would be good to be able to:
- check if the security feature is enabled for a repo
- enable/disable the security feature.
Proposed solution
Add endpoints for Dependabot, Secret Scanning and Push Protection for repositories.
Additional context
Secret Scanning & Push Protection
Within the REST API's GET /repos/{owner}/{repo}
, there is a security_and_analysis
block:
"security_and_analysis": {
"advanced_security": {
"status": "enabled"
},
"secret_scanning": {
"status": "enabled"
},
"secret_scanning_push_protection": {
"status": "disabled"
},
"secret_scanning_non_provider_patterns": {
"status": "disabled"
}
https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository
Dependabot
Replication of GET /repos/{owner}/{repo}/automated-security-fixes
Activity
smadi0x86 commentedon Apr 8, 2025
I'd like to work on this issue, here is my plan:
Implement core security settings functionality:
Add five new tools following the project patterns:
get_security_settings
update_security_settings
get_dependabot_security_updates_status
enable_dependabot_security_updates
disable_dependabot_security_updates
I have already got a high level overview about this enhancement and its implementation, before I submit a PR, I would appreciate any recommendations or confirmations about:
TotalDwarf03 commentedon Apr 8, 2025
Small suggestion to make the dependabot pattern use
update_dependabot_security_updates
. Dependabot updates can be enabled or disabled, alongside paused.As per
GET /repos/{owner}/{repo}/automated-security-fixes
:smadi0x86 commentedon Apr 8, 2025
Thanks for the suggestion @TotalDwarf03 , I see your point about the
paused
state in the API response, however, I decided to keep the separateenable
/disable
pattern for a few reasons:While the GET endpoint returns both
enabled
andpaused
states, the actual modification endpoints in GitHub's API are separate:PUT /repos/{owner}/{repo}/automated-security-fixes
(to enable)DELETE /repos/{owner}/{repo}/automated-security-fixes
(to disable)Having separate tools makes the intent more explicit for users, so instead of having to figure out what payload to send to an update endpoint, they can simply call:
enable_dependabot_security_updates
when they want to turn it ondisable_dependabot_security_updates
when they want to turn it offThe
paused
state is still accessible through theget_dependabot_security_updates_status
tool, which returns the complete status including bothenabled
andpaused
fields:Let me know if you would like me to adjust this approach or if you have any other suggestions, I'd be happy to hear from any existing contributor/maintainer as I started drafting the implementation.
smadi0x86 commentedon Apr 8, 2025
I created a PR to share the implementation, I faced an issue that is explained in the PR, I built a docker image and pushed it to my own docker hub to test the tools in real time with an LLM client (copilot), here is what I faced:
smadi0x86 commentedon Apr 8, 2025
To be more concise:
get_security_settings
, it confirms that vulnerability alerts are enabledEnableDependabotSecurityUpdates
, the API still requires explicit enabling of vulnerability alertsThis discrepancy is why I commented out the EnableDependabotSecurityUpdates and DisableDependabotSecurityUpdates functions and documented the issue in the code.
smadi0x86 commentedon Apr 9, 2025
UPDATE
I created the PR for the sole purpose of sharing what I did so far, I am trying to figure out a solution to the issue of the remaining tools (
EnableDependabotSecurityUpdates
andDisableDependabotSecurityUpdates
), but I would like to take insights from any maintainer/contributor so I can complete the PR.SamMorrowDrums commentedon Apr 13, 2025
Thanks for this, I actually had a draft PR for enabling some security features before launch. #52
What delayed me was that the API is not super well matched to what we would want to present here, but I intend to finish it soon. Some sibling properties like push protection also require secret scanning to be on first. Effectively I want to think this through carefully first. Part of the problem is also that there are many scenarios where it would fail (org hasn't purchased the product, banned by policy).
LMK if you have ideas on how best to model the interaction on the LLM side.
smadi0x86 commentedon Apr 14, 2025
Thanks for your comment, to sum up issues are:
For now, we can:
For example:
would you like to collaborate on implementing these improvements? i can help with:
We can create a wrapper around github API that validate and give clear status info, what do u think?
SamMorrowDrums commentedon Apr 19, 2025
Sorry for the delay, I have had a lot of things to look at and the next couple of weeks are likely to be very busy too. I am certainly not against collaborating on your fork if needed to get the feature completed.
I do think it would be pretty cool to get this feature made. Making repos more secure with this is a nice touch.
smadi0x86 commentedon Apr 19, 2025
No worries :) I created a PR for this issue if you looked at it by any chance you will see that I commented 2 tools in the code which had the issue you faced previously, so we can figure them out and im open to your opinion about them, regarding the rest of code works like a charm with my tests just needs reviews for any optimization.