Skip to content

fix(people): address cubic review findings for offboarding feature#2884

Merged
Marfuen merged 1 commit into
mainfrom
mariano/cs-312-cubic-review-fixes
May 20, 2026
Merged

fix(people): address cubic review findings for offboarding feature#2884
Marfuen merged 1 commit into
mainfrom
mariano/cs-312-cubic-review-fixes

Conversation

@Marfuen
Copy link
Copy Markdown
Contributor

@Marfuen Marfuen commented May 20, 2026

Summary

Fixes all valid Cubic review findings from #2878:

Security (P1):

  • Prevent CSV formula injection in offboarding export by prefixing dangerous leading chars (=, +, -, @, \t, \r)
  • Sanitize attachment filenames in ZIP paths to prevent path traversal
  • Scope revocation lookup by organizationId to prevent cross-tenant deletion
  • Rollback completion record if evidence upload fails (prevents partial state)
  • Scope attachment deletion to member and event type (not just org+attachmentId)

Bug fixes (P2):

  • Add member ID to bulk export folder names to prevent name collisions
  • Filter pending offboarding completion counts to enabled template items only
  • Validate date query params before DB filters (prevents 500s on invalid dates)
  • Use @IsInt() for sortOrder DTO validation
  • Show "Until {date}" when only end date is set in date range filter
  • Clear file input in finally block so failed uploads can be retried
  • Validate tab query param against dynamically available tabs (respects feature flags)
  • Show error state in TodosOverview on fetch failure instead of false "All clear"

Test plan

  • Export offboarding data — CSV should have formula-safe fields
  • Upload evidence with special characters in filename — ZIP should sanitize
  • Bulk export with duplicate member names — folders should be unique
  • Complete checklist item with evidence — if upload fails, completion should rollback
  • Filter people by invalid date string — should return 400, not 500
  • Set only end date in date range filter — label should show "Until {date}"
  • Navigate to ?tab=offboarding for non-offboarded employee — should fallback to details

🤖 Generated with Claude Code


Summary by cubic

Strengthens the offboarding workflow with key security fixes and UX/validation improvements across exports, evidence uploads, and filters. Aligns with CS-312 by making employment event filtering and evidence collection safer and more reliable.

  • Security

    • CSV export: prefix dangerous leading chars to prevent formula injection.
    • ZIP export: sanitize attachment filenames to block path traversal; restrict attachment deletion by member and event type.
    • Access revocations: scope lookups by organizationId to prevent cross-tenant actions.
    • Checklist: rollback completion if evidence upload fails to avoid partial state.
  • Bug Fixes

    • Exports: add member ID to folder names to avoid collisions.
    • Pending counts: include only enabled template items.
    • Validation: strict date param parsing (400 on invalid); use @IsInt() for sortOrder.
    • UI: show “Until {date}” when only an end date is set; show error state in TodosOverview on fetch failure.
    • UX: always clear file input after upload attempts; validate the employee tab against available tabs (feature flags and offboarding).

Written for commit 7414aca. Summary will update on new commits. Review in cubic

- prevent CSV formula injection in export by prefixing dangerous chars
- sanitize filenames in ZIP paths to prevent path traversal
- add member ID to export folder names to prevent collisions
- scope revocation lookup by organizationId to prevent cross-tenant access
- rollback completion record if evidence upload fails
- filter completion counts to enabled template items only
- use @ISINT() for sortOrder DTO validation
- validate date query params before building DB filters
- scope attachment deletion to member and event type
- show "Until {date}" when only end date is set in filter
- clear file input in finally block for retry support
- validate tab param against dynamically available tabs
- show error state in TodosOverview on fetch failure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented May 20, 2026

CS-312

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment May 20, 2026 8:47pm
comp-framework-editor Ready Ready Preview, Comment May 20, 2026 8:47pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped May 20, 2026 8:47pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Linked issue analysis

Linked issue: CS-312: [Feature] Add personnel Employment events date tracking + supporting evidence upload section

Status Acceptance criteria Notes
Prevent CSV formula injection in offboarding export by prefixing dangerous leading characters escapeCsvField now prefixes dangerous leading characters to make CSV fields formula-safe.
Sanitize attachment filenames in ZIP paths to prevent path traversal / unsafe names Added sanitizeFileName and used safeName when appending files into archive paths.
Scope revocation lookup by organizationId to prevent cross-tenant deletion Replaced findUnique lookup with findFirst and included organizationId in where clause.
Rollback offboarding checklist completion if evidence upload fails Upload is wrapped in try/catch and deletes the completion on error, then rethrows the error.
Scope attachment deletion to member and event type (not just org + attachmentId) Controller resolves the event entity type and verifies the attachment belongs to that member and event type before deletion.
Make bulk export folder names unique by including member ID to prevent name collisions Export prefix now includes member.id when building offboarded-employees folder name.
Filter pending offboarding completion counts to enabled template items only Query for offboardingChecklistCompletions includes a where clause restricting templateItem to isEnabled: true.
Validate date query params before applying DB filters (prevent 500s on invalid dates) Added parseDateParam that throws BadRequestException for invalid date strings and used it for onboard/offboard date params.
Use integer validation for sortOrder DTO Replaced @IsNumber with @ISINT for sortOrder and adjusted imports.
Show "Until {date}" when only end date is set in date range filter UI DateRangeFilter formatting now returns an "Until {date}" label when only end date is present.
Clear file input in finally so failed uploads can be retried File input clearing moved into a finally block to ensure it always resets after upload attempts.
Validate tab query param against dynamically available tabs and only expose offboarding tab when appropriate Replaced static VALID_TABS with availableTabs computed from feature flags and employee.offboardDate, and uses it for tab resolution.
Show error state in TodosOverview when fetch of pending offboarding fails TodosOverview now checks error from SWR and displays a failed-to-load message instead of assuming success.

Re-trigger cubic

@Marfuen Marfuen merged commit 9d43a6b into main May 20, 2026
11 checks passed
@Marfuen Marfuen deleted the mariano/cs-312-cubic-review-fixes branch May 20, 2026 22:03
claudfuen pushed a commit that referenced this pull request May 21, 2026
# [3.60.0](v3.59.2...v3.60.0) (2026-05-21)

### Bug Fixes

* **cloud-tests:** show meaningful Auto-Remediate diff for configure-only plans ([90c95f6](90c95f6))
* **evidence-export:** load automations one at a time to prevent OOM ([07f02e4](07f02e4))
* **people:** address cubic review findings for offboarding feature ([#2884](#2884)) ([9d43a6b](9d43a6b))
* **people:** address fifth round of cubic review findings ([#2893](#2893)) ([dbc364c](dbc364c))
* **people:** address fourth round of cubic review findings ([#2892](#2892)) ([ca9d9a5](ca9d9a5))
* **people:** address remaining cubic review findings for offboarding ([#2890](#2890)) ([8026352](8026352))
* **people:** address third round of cubic review findings ([#2891](#2891)) ([8ec5214](8ec5214))
* **people:** ds component compatibility fixes for offboarding UI ([200b112](200b112))
* **ui:** close MultipleSelector dropdown on blur so it stops blocking sibling form controls ([b9d08c8](b9d08c8))

### Features

* **api:** unblock cloud-tests mutations for API key + service token callers ([26e53da](26e53da))
* **cloud-tests:** add deterministic AWS plan normalizer for SLR params ([e0ec0f7](e0ec0f7))
* **cloud-tests:** fail fast on missing required AWS command params ([5f2d342](5f2d342))
* **cloud-tests:** universal AI step-repair on AWS validation errors ([8adf505](8adf505))
* **frameworks:** show controls as default tab with requirement column ([e41365d](e41365d))
* **people:** add employment events tracking and offboarding checklist ([5e15a73](5e15a73))
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.60.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants