Skip to content

Commit a9d5208

Browse files
committed
chore: merge main into release for new releases
2 parents dea04df + 5c6e34e commit a9d5208

44 files changed

Lines changed: 6515 additions & 155 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/api/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
2727

28+
## Feature docs
29+
30+
- Security penetration tests integration:
31+
- `src/security-penetration-tests/README.md`
32+
2833
## Project setup
2934

3035
```bash

apps/api/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { AssistantChatModule } from './assistant-chat/assistant-chat.module';
3636
import { OrgChartModule } from './org-chart/org-chart.module';
3737
import { TrainingModule } from './training/training.module';
3838
import { EvidenceFormsModule } from './evidence-forms/evidence-forms.module';
39+
import { SecurityPenetrationTestsModule } from './security-penetration-tests/security-penetration-tests.module';
3940

4041
@Module({
4142
imports: [
@@ -84,6 +85,7 @@ import { EvidenceFormsModule } from './evidence-forms/evidence-forms.module';
8485
TrainingModule,
8586
OrgChartModule,
8687
EvidenceFormsModule,
88+
SecurityPenetrationTestsModule,
8789
],
8890
controllers: [AppController],
8991
providers: [
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Security Penetration Tests (Maced Integration)
2+
3+
This module exposes Comp API endpoints under `/v1/security-penetration-tests` and orchestrates report generation with Maced (`/v1/pentests`).
4+
5+
## Endpoints
6+
7+
- `GET /v1/security-penetration-tests`
8+
- `POST /v1/security-penetration-tests`
9+
- `GET /v1/security-penetration-tests/:id`
10+
- `GET /v1/security-penetration-tests/:id/progress`
11+
- `GET /v1/security-penetration-tests/:id/report`
12+
- `GET /v1/security-penetration-tests/:id/pdf`
13+
- `POST /v1/security-penetration-tests/webhook`
14+
15+
## Required environment variables
16+
17+
- `MACED_API_KEY`: Maced API key used by Nest API when calling provider endpoints.
18+
19+
## Optional environment variables
20+
21+
- `MACED_API_BASE_URL`: Defaults to `https://api.maced.ai`.
22+
- `SECURITY_PENETRATION_TESTS_WEBHOOK_URL`: Base callback URL for Comp webhook endpoint.
23+
24+
## Webhook handshake model
25+
26+
1. On create (`POST /v1/security-penetration-tests`), Maced issues a per-job `webhookToken` and returns it in the create response.
27+
2. Comp does not send a user-provided `webhookToken` upstream; the value is reserved for provider issuance.
28+
3. If callback target resolves to Comp webhook route and Maced returns `webhookToken`, Comp persists a handshake record in `secrets` using name:
29+
- `security_penetration_test_webhook_<reportId>`
30+
4. On webhook receive, Comp:
31+
- resolves org context (`X-Organization-Id` or `orgId`/`organizationId` query),
32+
- resolves token (`webhookToken` query or `X-Webhook-Token` header),
33+
- requires a persisted per-job handshake and verifies token hash match,
34+
- tracks idempotency (`X-Webhook-Id`/`X-Request-Id`, plus payload hash fallback),
35+
- returns `duplicate: true` for replayed webhook events.
36+
37+
## Notes
38+
39+
- Frontend should call Nest API only (no Next.js proxy routes for this feature).
40+
- Provider callbacks to non-Comp webhook URLs are passed through and are not forced to include Comp-specific webhook tokens.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { IsBoolean, IsOptional, IsString, IsUrl } from 'class-validator';
2+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3+
4+
export class CreatePenetrationTestDto {
5+
@ApiProperty({
6+
description: 'Target URL for the penetration test scan',
7+
example: 'https://app.example.com',
8+
})
9+
@IsUrl()
10+
targetUrl!: string;
11+
12+
@ApiProperty({
13+
description: 'Repository URL containing the target application code',
14+
example: 'https://github.com/org/repo',
15+
required: false,
16+
})
17+
@IsOptional()
18+
@IsUrl()
19+
repoUrl?: string;
20+
21+
@ApiPropertyOptional({
22+
description: 'GitHub token used for cloning private repositories',
23+
required: false,
24+
})
25+
@IsOptional()
26+
@IsString()
27+
githubToken?: string;
28+
29+
@ApiPropertyOptional({
30+
description: 'Optional YAML configuration for the pentest run',
31+
required: false,
32+
})
33+
@IsOptional()
34+
@IsString()
35+
configYaml?: string;
36+
37+
@ApiPropertyOptional({
38+
description: 'Whether to enable pipeline testing mode',
39+
required: false,
40+
default: false,
41+
})
42+
@IsOptional()
43+
@IsBoolean()
44+
pipelineTesting?: boolean;
45+
46+
@ApiPropertyOptional({
47+
description: 'Workspace identifier used by the pentest engine',
48+
required: false,
49+
})
50+
@IsOptional()
51+
@IsString()
52+
workspace?: string;
53+
54+
@ApiPropertyOptional({
55+
description:
56+
'Set false to reject non-mocked checkout flows for strict behavior',
57+
required: false,
58+
default: true,
59+
})
60+
@IsOptional()
61+
@IsBoolean()
62+
mockCheckout?: boolean;
63+
64+
@ApiPropertyOptional({
65+
description: 'Optional webhook URL to notify when report generation completes',
66+
required: false,
67+
})
68+
@IsOptional()
69+
@IsUrl()
70+
webhookUrl?: string;
71+
72+
@ApiPropertyOptional({
73+
description: 'Whether to run the pentest in simulation mode',
74+
required: false,
75+
default: false,
76+
})
77+
@IsOptional()
78+
@IsBoolean()
79+
testMode?: boolean;
80+
}

0 commit comments

Comments
 (0)