Repository navigation
Fix dataset visibility privacy filtering - #80
Merged
Merged
Conversation
- Add migration to create visibility column (private/public) - Fix list endpoint to filter datasets by visibility - Update publication workflow to set visibility=public - Update TypeScript types to include visibility field - Default all datasets to private for security Fixes critical security issue where all users could see all private datasets regardless of ownership.
Critical fixes: - Add visibility check to GET /datasets/:id endpoint - Add comprehensive error handling for database visibility updates - Add rollback mechanism for failed database updates in admin endpoints - Surface audit log failures to users with warnings Type design improvements: - Make status field type-safe: 'active' | 'archived' | 'deleted' - Add JSDoc documentation for status and visibility fields - Add runtime validation for Dataset type with validateDataset() - Apply validation in listDatasets() to catch backend errors Documentation improvements: - Clarify sandbox exclusion behavior in backend comments - Add admin privilege exception in CLI help text - Document defense-in-depth client-side filtering rationale - Expand JSDoc comments in datasets.ts Error handling improvements: - Wrap database queries in try-catch with proper error responses - Validate query results before use - Add detailed error messages for debugging - Include action_required field for manual intervention All changes verified to compile without new TypeScript errors.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR80Version: 🤖 Updated on each push. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #79
Implements dataset visibility filtering to prevent users from seeing private datasets they don't own.
Changes
1. Database Migration (0006_dataset_visibility.sql)
visibilitycolumn todatasetstable ('private'or'public')'private'for all existing and new datasets (safe default)2. Backend Filtering (datasets.ts)
Updated
GET /datasetsendpoint with proper visibility rules:With
--mineflag:Without
--mineflag (public catalog):3. Publication Workflow (admin.ts)
visibility='public'when making repo public4. TypeScript Types (api.ts)
Datasetinterface to includevisibility: "public" | "private"5. Documentation (dataset.ts)
Updated
nemar dataset listhelp text to clearly explain:--mineflag to see your own datasets (including private)Testing
Database Migration
visibility = 'private'Backend
nemar dataset list- should only show public datasetsnemar dataset list- should only show public datasetsnemar dataset list --mine- should show only their datasetsnemar dataset list- should show all datasetsPublication Workflow
nemar dataset listvisibilityupdated to'public'nemar dataset listImpact
Before:
After:
--mine)--mine)Deployment
Deploy migration:
Deploy backend:
cd backend npm run deployVerify all existing datasets are private:
wrangler d1 execute nemar-db --remote --command "SELECT dataset_id, visibility FROM datasets LIMIT 10"Built with Claude Code