Skip to content

Commit 170bf9c

Browse files
gfraiteurclaude
andcommitted
Add TeamCity risk assessment rules to MCP approval server
- GET requests (build status, logs, configurations): LOW risk - Scheduling regular builds: LOW risk - Scheduling deployments (names with Deploy, Publish, Production, etc.): HIGH risk - Modifying/deleting configurations: HIGH risk Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2417323 commit 170bf9c

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/PostSharp.Engineering.BuildTools/Mcp/Services/RiskAnalyzer.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,33 @@ public sealed class RiskAnalyzer
6060
- `dotnet build` / `dotnet test` / `dotnet pack` : LOW risk - local operations (but should normally be done in the container)
6161
- `dotnet nuget push`: HIGH risk - publishes packages publicly, hard to undo
6262
63+
### TeamCity Operations (REST API)
64+
TeamCity is accessed via REST API at https://postsharp.teamcity.com/app/rest/
65+
66+
**Reading operations (LOW risk):**
67+
- GET `/app/rest/builds` - viewing build history and status
68+
- GET `/app/rest/builds/{id}` - viewing specific build details
69+
- GET `/app/rest/builds/{id}/log` - reading build logs
70+
- GET `/app/rest/buildTypes` - listing build configurations
71+
- GET `/app/rest/projects` - listing projects
72+
- Any GET request to TeamCity API is LOW risk
73+
74+
**Scheduling builds:**
75+
- POST `/app/rest/buildQueue` - scheduling a build
76+
- LOW risk if the build configuration name does NOT contain: Deploy, Publish, Production, Prod, Stage, Staging, Swap
77+
- HIGH risk if the build configuration name CONTAINS any of: Deploy, Publish, Production, Prod, Stage, Staging, Swap
78+
- Look at the `buildType.id` or `buildType.name` in the request body to determine the type
79+
- Example LOW risk: `PostSharpEngineering_Build`, `Metalama_UnitTests`, `*_VersionBump`
80+
- Example HIGH risk: `PostSharpEngineering_Deploy`, `Metalama_PublishNuGet`, `*_Release`, `*_Production`
81+
82+
**Modifying configurations (HIGH risk):**
83+
- PUT to `/app/rest/buildTypes/*` - modifying build configuration
84+
- POST to `/app/rest/buildTypes` - creating build configuration
85+
- DELETE to `/app/rest/buildTypes/*` - deleting build configuration
86+
- PUT/POST/DELETE to `/app/rest/projects/*` - modifying projects
87+
- PUT/POST/DELETE to `/app/rest/vcs-roots/*` - modifying VCS roots
88+
- Any PUT, POST (except buildQueue for non-deploy builds), or DELETE that modifies TeamCity configuration = HIGH risk
89+
6390
### File Operations
6491
- Commands that delete files outside the working directory: HIGH risk
6592
- Commands that modify system files: CRITICAL risk

0 commit comments

Comments
 (0)