Repository navigation
Conversation
What was broken
Users who have the Talent Manager role and also the copilot role could not
see a member's email on the member profile, even though Talent Managers are
allowed to see it. Phone numbers were still shown. The bug only showed up
for some of these users, depending on which members they had worked with.
Root cause
copilotEmailAccess.shouldLimitCopilotEmailAccess limits email access for any
caller with the copilot role unless they are an admin. Talent Manager was not
exempt, so a TM who is also a copilot was treated like a plain copilot. They
could only see the email of members who share a challenge resource with
them. getMember then removed the email that omitMemberAttributes had already
allowed for the Talent Manager role. The same rule applied to member search.
What was changed
- shouldLimitCopilotEmailAccess now skips the copilot restriction for any
sensitive data role (helper.hasSensitiveDataRole, which covers admin,
administrator and Talent Manager) instead of only admin roles. This
matches the role check omitMemberAttributes already uses for email and
phones.
- Added JSDoc for shouldLimitCopilotEmailAccess.
- Copilots without the admin or Talent Manager role still only see emails of
members they share a challenge with.
Added/updated tests
- New test/unit/CopilotEmailAccess.test.js:
- a plain copilot is still limited;
- a Talent Manager + copilot (the role set from the ticket) is not
limited and keeps member emails in getMember and search filtering;
- an administrator + copilot is not limited.
The Talent Manager case fails without this fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Jira: PM-4010
What was broken
Users who have the Talent Manager role and also the copilot role could not see a member's email on the member profile, even though Talent Managers are allowed to see it. Phone numbers were still shown.
The bug only showed up for some of these users. For example,
hentry_copilotcould seemess's email butsathyajan9could not, even with the exact same roles.Root cause
copilotEmailAccess.shouldLimitCopilotEmailAccesslimits email access for any caller with the copilot role unless they are an admin. Talent Manager was not exempt, so a TM who is also a copilot was treated like a plain copilot. They could only see the email of members who share a challenge resource with them.getMemberthen removed the email thatomitMemberAttributeshad already allowed for the Talent Manager role. That explains why results differed between users with the same roles: it depended on which challenges each one had copiloted. The same rule also applied to member search.What was changed
shouldLimitCopilotEmailAccessnow skips the copilot restriction for any sensitive data role. It useshelper.hasSensitiveDataRole(admin, administrator, Talent Manager) instead ofhelper.hasAdminRole. This matches the role checkomitMemberAttributesalready uses for email and phones.shouldLimitCopilotEmailAccess.No UI change is needed. The profiles app already shows the email to Talent Managers whenever the API returns it.
Added/updated tests
New
test/unit/CopilotEmailAccess.test.js, which stubs the resources Prisma client:canCopilotAccessMemberEmailandstripUnauthorizedCopilotEmails;The Talent Manager case fails without this fix.
Unit suite with placeholder DB env vars: 195 passing, 4 failing. Clean
developgives 192 passing, 4 failing. The 4 failures are the same in both: thebefore all/after allhooks of the MemberService and MemberTraitService suites, which need a live Postgres (Can't reach database server at 127.0.0.1:5432). Lint (eslinton*.ts,src/**/*.ts,prisma/**/*.ts) andnest buildboth pass.🤖 Generated with Claude Code