UNPKG

@crazyrabbitltc/railway-mcp

Version:

Railway MCP Server - 146+ tools with 100% Railway API coverage, comprehensive MCP testing framework, and real infrastructure management through AI assistants. Enhanced version with enterprise features, based on original work by Jason Tan.

271 lines (270 loc) 7.97 kB
export class SecurityRepository { client; constructor(client) { this.client = client; } async getAuditLogs(projectId, startDate, endDate, limit = 100) { const query = ` query getAuditLogs($projectId: String, $startDate: String, $endDate: String, $limit: Int) { auditLogs(projectId: $projectId, startDate: $startDate, endDate: $endDate, first: $limit) { edges { node { id timestamp userId userEmail action resourceType resourceId ipAddress userAgent success metadata } } } } `; const response = await this.client.request(query, { projectId, startDate, endDate, limit }); return response.auditLogs.edges.map(edge => edge.node); } async getVulnerabilities(projectId) { const query = ` query getVulnerabilities($projectId: String!) { project(id: $projectId) { vulnerabilities { edges { node { id projectId serviceId severity category title description cve affectedComponent recommendation status discoveredAt fixedAt } } } } } `; const response = await this.client.request(query, { projectId }); return response.project.vulnerabilities.edges.map(edge => edge.node); } async triggerSecurityScan(projectId, serviceId) { const query = ` mutation triggerSecurityScan($projectId: String!, $serviceId: String) { securityScanTrigger(projectId: $projectId, serviceId: $serviceId) { scanId status } } `; const response = await this.client.request(query, { projectId, serviceId }); return response.securityScanTrigger; } async updateVulnerabilityStatus(vulnerabilityId, status) { const query = ` mutation updateVulnerabilityStatus($vulnerabilityId: String!, $status: VulnerabilityStatus!) { vulnerabilityUpdate(id: $vulnerabilityId, status: $status) { id status fixedAt } } `; const response = await this.client.request(query, { vulnerabilityId, status }); return response.vulnerabilityUpdate; } async listSecurityPolicies(projectId) { const query = ` query listSecurityPolicies($projectId: String!) { project(id: $projectId) { securityPolicies { edges { node { id projectId name type rules { id condition action priority } isActive createdAt updatedAt } } } } } `; const response = await this.client.request(query, { projectId }); return response.project.securityPolicies.edges.map(edge => edge.node); } async listAccessTokens() { const query = ` query listAccessTokens { accessTokens { edges { node { id name permissions lastUsed expiresAt isActive createdAt } } } } `; const response = await this.client.request(query); return response.accessTokens.edges.map(edge => edge.node); } async createAccessToken(name, permissions, expiresAt) { const query = ` mutation createAccessToken($name: String!, $permissions: [String!]!, $expiresAt: String) { accessTokenCreate(name: $name, permissions: $permissions, expiresAt: $expiresAt) { token { id name permissions expiresAt createdAt } secret } } `; const response = await this.client.request(query, { name, permissions, expiresAt }); return response.accessTokenCreate; } async revokeAccessToken(tokenId) { const query = ` mutation revokeAccessToken($tokenId: String!) { accessTokenRevoke(id: $tokenId) } `; const response = await this.client.request(query, { tokenId }); return response.accessTokenRevoke; } async listIPAllowLists(projectId) { const query = ` query listIPAllowLists($projectId: String!) { project(id: $projectId) { ipAllowLists { edges { node { id projectId name ipRanges description isActive createdAt updatedAt } } } } } `; const response = await this.client.request(query, { projectId }); return response.project.ipAllowLists.edges.map(edge => edge.node); } async createIPAllowList(projectId, name, ipRanges, description) { const query = ` mutation createIPAllowList($projectId: String!, $name: String!, $ipRanges: [String!]!, $description: String) { ipAllowListCreate(projectId: $projectId, name: $name, ipRanges: $ipRanges, description: $description) { id projectId name ipRanges description isActive createdAt } } `; const response = await this.client.request(query, { projectId, name, ipRanges, description }); return response.ipAllowListCreate; } async updateIPAllowList(allowListId, ipRanges, isActive) { const query = ` mutation updateIPAllowList($allowListId: String!, $ipRanges: [String!], $isActive: Boolean) { ipAllowListUpdate(id: $allowListId, ipRanges: $ipRanges, isActive: $isActive) { id name ipRanges isActive updatedAt } } `; const response = await this.client.request(query, { allowListId, ipRanges, isActive }); return response.ipAllowListUpdate; } async generateComplianceReport(projectId, framework) { const query = ` mutation generateComplianceReport($projectId: String!, $framework: ComplianceFramework!) { complianceReportGenerate(projectId: $projectId, framework: $framework) { id projectId framework status score findings { control status description recommendation } generatedAt expiresAt } } `; const response = await this.client.request(query, { projectId, framework }); return response.complianceReportGenerate; } async getComplianceReports(projectId) { const query = ` query getComplianceReports($projectId: String!) { project(id: $projectId) { complianceReports { edges { node { id projectId framework status score findings { control status description recommendation } generatedAt expiresAt } } } } } `; const response = await this.client.request(query, { projectId }); return response.project.complianceReports.edges.map(edge => edge.node); } }