You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cursor/rules/setup.mdc
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,14 @@ alwaysApply: true
4
4
---
5
5
# Setup commands
6
6
To run this project locally:
7
-
1. `cd 10xGitHubPolicies.App`
8
-
2. `dotnet restore`
9
-
3. `dotnet run`
7
+
1. `cd 10xGitHubPolicies`
8
+
2. `docker-compose up -d`
9
+
3. `cd 10xGitHubPolicies.App`
10
+
4. `dotnet restore`
11
+
5. `dotnet ef database update`
12
+
6. `dotnet dev-certs https --trust`
13
+
7. `dotnet run --launch-profile https`
10
14
11
-
Alternatively, you can run from the root directory using `dotnet run --project 10xGitHubPolicies.App/10xGitHubPolicies.App.csproj`.
15
+
Alternatively, you can run from the root directory using `dotnet run --project 10xGitHubPolicies.App/10xGitHubPolicies.App.csproj --launch-profile https`.
16
+
17
+
**Important**: Always use the HTTPS profile to ensure OAuth authentication works correctly.
Copy file name to clipboardExpand all lines: README.md
+31-12Lines changed: 31 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,10 @@ The 10x GitHub Policy Enforcer is a GitHub App with an accompanying web UI desig
29
29
30
30
It uses a flexible policy evaluation engine to scan repositories for compliance with a centrally managed configuration file. When violations are found, it can automatically perform actions like creating issues in the repository or archiving it. The web dashboard provides a clear overview of your organization's compliance posture.
31
31
32
+
The application uses a dual-authentication strategy:
33
+
-**GitHub App**: For backend services to perform automated scans and actions
34
+
-**GitHub OAuth App**: For user authentication to the web dashboard
35
+
32
36
---
33
37
34
38
## Features
@@ -132,7 +136,10 @@ The application will be available at:
132
136
The application is configured via `appsettings.json` and user secrets for sensitive data.
133
137
134
138
### GitHub App Settings
135
-
You need to configure the GitHub App settings. During development, it's required to use the .NET Secret Manager to keep secrets out of source control.
139
+
The application uses a dual-authentication strategy requiring both a GitHub App (for backend services) and a GitHub OAuth App (for user authentication).
140
+
141
+
#### GitHub App (Backend Services)
142
+
The GitHub App is used by backend services to perform automated scans and actions against the GitHub API.
136
143
137
144
1. Initialize user secrets for the project (if you haven't already):
138
145
```sh
@@ -157,7 +164,27 @@ You need to configure the GitHub App settings. During development, it's required
157
164
```
158
165
Replace `your-organization-name` with your GitHub organization's slug.
159
166
160
-
### GitHub OAuth App Settings
167
+
#### GitHub App Setup
168
+
To create a GitHub App for backend services:
169
+
170
+
1. Go to [GitHub Developer Settings](https://github.com/settings/apps)
171
+
2. Click "New GitHub App"
172
+
3. Configure the following:
173
+
- **GitHub App name**: 10x GitHub Policy Enforcer
174
+
- **Homepage URL**: `https://localhost:7040/` (for local development)
175
+
- **Webhook URL**: Leave empty for local development
This project is currently **in development**. The immediate focus is on delivering the Minimum Viable Product (MVP) features outlined in the project scope.
Copy file name to clipboardExpand all lines: docs/hangfire-integration.md
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,10 +43,11 @@ The dashboard is accessible at the `/hangfire` endpoint of the application (e.g.
43
43
44
44
## Usage in the Application
45
45
46
-
Hangfire is primarily used in two places:
46
+
Hangfire is used in three main scenarios:
47
47
48
48
1.**On-Demand Repository Scanning**: When a user clicks the "Scan Now" button on the dashboard.
49
-
2.**Processing Actions for Violations**: After a scan is completed, a job is enqueued to process the configured actions for any violations found using the `ActionService`.
49
+
2.**Daily Automated Scanning**: A recurring job that automatically scans all repositories daily at midnight UTC.
50
+
3.**Processing Actions for Violations**: After a scan is completed, a job is enqueued to process the configured actions for any violations found using the `ActionService`.
50
51
51
52
### Enqueuing a Scan
52
53
@@ -68,6 +69,32 @@ private async Task StartScan()
68
69
69
70
By using `_backgroundJobClient.Enqueue()`, the `PerformScanAsync` method is executed on a background thread by a Hangfire worker. This immediately returns control to the UI, which can then display a "Scanning..." status to the user.
70
71
72
+
### Daily Automated Scanning
73
+
74
+
The application is configured with a recurring job that automatically scans all repositories daily:
75
+
76
+
```csharp
77
+
// Program.cs
78
+
79
+
// Configure recurring jobs
80
+
RecurringJob.AddOrUpdate<IScanningService>(
81
+
"daily-scan",
82
+
service=>service.PerformScanAsync(),
83
+
"0 0 * * *", // Daily at midnight UTC
84
+
newRecurringJobOptions
85
+
{
86
+
TimeZone=TimeZoneInfo.Utc
87
+
});
88
+
```
89
+
90
+
This configuration:
91
+
-**Job Name**: `"daily-scan"` - unique identifier for the recurring job
92
+
-**Cron Expression**: `"0 0 * * *"` - runs daily at midnight UTC
93
+
-**Timezone**: UTC to ensure consistent execution times
94
+
-**Service**: Uses `IScanningService.PerformScanAsync()` for the actual scanning logic
95
+
96
+
The recurring job ensures that all repositories are automatically scanned for policy compliance without manual intervention, providing continuous monitoring of organizational compliance.
97
+
71
98
### Enqueuing Actions Post-Scan
72
99
73
100
In the `ScanningService`, after a scan is successfully completed and violations have been saved, a job is enqueued for the `IActionService` to process the results.
0 commit comments