feat(security): add security vulnerability reports module and checkout lifecycle#2193
feat(security): add security vulnerability reports module and checkout lifecycle#2193
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb7a64de99
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/app/src/app/api/security/vulnerability-reports/[id]/report/route.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2df06e6b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/app/src/app/api/security/vulnerability-reports/webhook/route.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e4c528f51
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/app/src/app/api/security/vulnerability-reports/_api-proxy.ts
Outdated
Show resolved
Hide resolved
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Outdated
Show resolved
Hide resolved
… Maced webhook reconciliation
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a1e273ab0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/app/src/app/api/security/vulnerability-reports/_api-proxy.ts
Outdated
Show resolved
Hide resolved
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03d1d6d084
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/app/src/app/api/security/vulnerability-reports/_api-proxy.ts
Outdated
Show resolved
Hide resolved
.../app/src/app/(app)/[orgId]/security/vulnerability-reports/hooks/use-vulnerability-reports.ts
Outdated
Show resolved
Hide resolved
apps/app/src/app/api/security/vulnerability-reports/webhook/route.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd7d1df56e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Outdated
Show resolved
Hide resolved
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1e89d75a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Show resolved
Hide resolved
.../app/src/app/(app)/[orgId]/security/vulnerability-reports/hooks/use-vulnerability-reports.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f2a0346fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Show resolved
Hide resolved
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6286c240d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch (error) { | ||
| this.logger.error( | ||
| `Unable to parse Maced get response for report ${id}`, | ||
| error instanceof Error ? error.message : String(error), | ||
| ); |
There was a problem hiding this comment.
Preserve not-found errors when org ownership check fails
getReport wraps both JSON parsing and assertProviderOrganizationMatch(...) in the same try, then converts any thrown error into 502 Invalid response. When SECURITY_VULNERABILITY_REPORTS_ORG_ID_MAP is configured and a run belongs to a different provider org, assertProviderOrganizationMatch throws a 404, but this catch path masks it as a gateway failure; callers of getReport (including progress/report/pdf flows that call it first) will treat authorization misses as transient backend outages and may retry unnecessarily.
Useful? React with 👍 / 👎.
Summary
This PR introduces a full Security → Vulnerability Reports flow in-app with a backend integration path to Maced pentest runs, plus a feature-flag rollout gate for Security exposure.
Why
Security reporting needed a concrete async workflow (create → checkout → queue visibility → progress tracking → report artifacts) with staged rollout capability. The scope now includes production-readiness guardrails for future Stripe and safer enablement controls.
What changed
1) Security product surface and workflow
apps/app/src/app/(app)/[orgId]/security/page.tsxapps/app/src/app/(app)/[orgId]/security/vulnerability-reports/page.tsxapps/app/src/app/(app)/[orgId]/security/vulnerability-reports/vulnerability-reports-page-client.tsx?checkout=success|error&runId=...).apps/app/src/app/(app)/[orgId]/security/vulnerability-reports/checkout/page.tsxapps/app/src/app/(app)/[orgId]/security/vulnerability-reports/[reportId]/page.tsxapps/app/src/app/(app)/[orgId]/security/vulnerability-reports/[reportId]/vulnerability-report-page-client.tsx2) App API proxy layer
apps/app/src/app/api/security/vulnerability-reports/_api-proxy.tsapps/app/src/app/api/security/vulnerability-reports/route.tsapps/app/src/app/api/security/vulnerability-reports/[id]/route.tsapps/app/src/app/api/security/vulnerability-reports/[id]/progress/route.tsapps/app/src/app/api/security/vulnerability-reports/[id]/report/route.tsapps/app/src/app/api/security/vulnerability-reports/[id]/pdf/route.tsapps/app/src/app/api/security/vulnerability-reports/webhook/route.ts3) Backend API module (Maced orchestration)
apps/api/src/security-vulnerability-reports/security-vulnerability-reports.module.tsapps/api/src/security-vulnerability-reports/security-vulnerability-reports.controller.tsapps/api/src/security-vulnerability-reports/security-vulnerability-reports.service.tsapps/api/src/security-vulnerability-reports/dto/create-vulnerability-report.dto.tsapps/api/src/app.module.ts4) Type/model alignment
apps/app/src/lib/security/vulnerability-reports-client.ts5) App-shell stabilization and rollout control
apps/app/src/app/(app)/[orgId]/components/AppShellWrapper.tsxTooltipProvider+ SSR-stable logo variant handling.isSecurityEnabled.apps/app/src/app/(app)/[orgId]/components/app-shell-search-groups.tsxapps/app/src/app/(app)/[orgId]/layout.tsxis-security-enabledflag and passes to shell.apps/app/src/app/(app)/[orgId]/security/layout.tsx/security/*so disabled users are blocked at entry.Scope
v1/security-vulnerability-reportsintegration module for Macedpentestsendpoints, including webhook relay and callback URL normalization.is-security-enabled.Runtime cost / safety note
The MACED provider is token-expensive per generation (~$50/run). This PR intentionally avoids forcing any automatic/subscribed generation behavior and keeps job creation explicit. When validating end-to-end with real credentials, use a deliberate, single-run smoke test only.
Env / configuration notes
MACED_API_KEYin API runtime environment.SECURITY_VULNERABILITY_REPORTS_WEBHOOK_URLnormalization behavior in service layer.Validation