Files
gt-ai-os-community/apps/tenant-app/src/lib/access-helpers.ts
HackWeasel b9dfb86260 GT AI OS Community Edition v2.0.33
Security hardening release addressing CodeQL and Dependabot alerts:

- Fix stack trace exposure in error responses
- Add SSRF protection with DNS resolution checking
- Implement proper URL hostname validation (replaces substring matching)
- Add centralized path sanitization to prevent path traversal
- Fix ReDoS vulnerability in email validation regex
- Improve HTML sanitization in validation utilities
- Fix capability wildcard matching in auth utilities
- Update glob dependency to address CVE
- Add CodeQL suppression comments for verified false positives

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 17:04:45 -05:00

42 lines
1.3 KiB
TypeScript

/**
* Access Level Display Helpers
*
* Provides consistent display mapping for access levels across the application.
* Backend uses 'individual', 'team', 'organization' but UX displays 'Myself', 'Team', 'Organization'.
*/
export type AccessLevel = 'individual' | 'team' | 'organization';
/**
* Get user-friendly display name for access level
*/
export function getAccessLevelDisplay(level: AccessLevel): string {
const displayMap: Record<AccessLevel, string> = {
'individual': 'Myself',
'team': 'Team',
'organization': 'Organization'
};
return displayMap[level] || level;
}
/**
* Get access level description for UI
*/
export function getAccessLevelDescription(level: AccessLevel, context: 'agent' | 'dataset'): string {
const descriptions: Record<AccessLevel, Record<string, string>> = {
'individual': {
'agent': 'Only you can access this Agent',
'dataset': 'Only you can access this dataset'
},
'team': {
'agent': 'Share with specific Team members',
'dataset': 'Share with a group of users'
},
'organization': {
'agent': 'Available to all Organization users',
'dataset': 'This dataset is available to all users in your Organization'
}
};
return descriptions[level]?.[context] || '';
}