Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CID-3369: Validate permissions on each installation before scanning #68

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mohamedlajmileanix
Copy link
Contributor

@mohamedlajmileanix mohamedlajmileanix commented Jan 2, 2025

πŸ›  Changes made

Validate permissions on each installation before scanning

✨ Type of change

Please delete the options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

πŸ§ͺ How Has This Been Tested?

  • scanGitHubResources should skip organizations without correct permissions and events

🏎 Checklist:

  • My code follows the style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • Any dependent changes have been merged and published in downstream modules
  • My commit message clearly reflects the changes made
  • Assigned the appropriate labels (version, PR type, etc.)

@mohamedlajmileanix mohamedlajmileanix added the bug Something isn't working label Jan 2, 2025
@mohamedlajmileanix mohamedlajmileanix requested a review from a team as a code owner January 2, 2025 17:01
@mohamedlajmileanix mohamedlajmileanix changed the title CID-3369: Validate permissions on each organisation before scanning CID-3369: Validate permissions on each installation before scanning Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

LeanIX GitHub Agent Code Coverage

File Coverage [89.62%] 🍏
GitHubClient.kt 100% 🍏
Constants.kt 100% 🍏
GitHubScanningService.kt 93.38% 🍏
GitHubEnterpriseService.kt 92.03% 🍏
WebhookEventService.kt 91.33% 🍏
GitHubResponsesDto.kt 62% 🍏
Total Project Coverage 72.04% 🍏

Comment on lines 45 to 55
if (missingPermissions.isNotEmpty() || missingEvents.isNotEmpty()) {
var message = "GitHub App is missing the following "
var message = "$type missing the following "
if (missingPermissions.isNotEmpty()) {
message = message.plus("permissions: $missingPermissions")
}
if (missingEvents.isNotEmpty()) {
if (missingPermissions.isNotEmpty()) {
message = message.plus(", and the following")
message = message.plus(", and the following ")
}
message = message.plus("events: $missingEvents")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing events are only being check if missingPermissions.isNotEmpty() || missingEvents.isNotEmpty().
Not sure if this is by design or a mistake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants