Skip to content

Conversation

@dennis-bilson-port
Copy link
Member

@dennis-bilson-port dennis-bilson-port commented Oct 24, 2025

User description

Handle bot user identifiers (which have [] in their names) which break the relationship between the pull requests and their respective users.

Updated docs pages

Please also include the path for the updated docs

  • Quickstart (/)
  • Blueprint (/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/)

PR Type

Enhancement, Bug fix


Description

  • Sanitize GitHub user identifiers to handle special characters

  • Replace .user.login with .creator.login in pull request mappings

  • Apply regex substitution to remove square brackets from usernames

  • Update team member and pull request reviewer identifier mappings


Diagram Walkthrough

flowchart LR
  A["GitHub User Data<br/>with special chars"] -- "Apply gsub regex<br/>sanitization" --> B["Sanitized Identifiers<br/>without brackets"]
  B --> C["Pull Request<br/>Mappings"]
  B --> D["Team Member<br/>Mappings"]
Loading

File Walkthrough

Relevant files
Bug fix
_github_exporter_example_port_app_config.mdx
Sanitize pull request user identifiers with regex               

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/_github_exporter_example_port_app_config.mdx

  • Changed creator field from .user.login to .creator.login
  • Added regex sanitization to remove square brackets from creator,
    assignees, and reviewers
  • Applied three-step gsub pattern to handle leading brackets, middle
    brackets, and trailing brackets
+3/-3     
_github_team_member_port_app_config.mdx
Sanitize team member identifiers with regex                           

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/example-team-members/_github_team_member_port_app_config.mdx

  • Added regex sanitization to team member login identifiers in relations
    mapping
  • Applied gsub pattern to remove square brackets from team member
    identifiers
  • Updated team member entity identifier mapping with bracket removal
    logic
+2/-2     

Signed-off-by: Dennis Bilson <dennis.bilson@port.io>
@dennis-bilson-port dennis-bilson-port self-assigned this Oct 24, 2025
@aws-amplify-eu-west-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-2944.d2ngvl90zqbob8.amplifyapp.com

@dennis-bilson-port dennis-bilson-port marked this pull request as ready for review October 28, 2025 06:50
@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Oct 28, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Identifier collision risk

Description: Sanitizing by removing brackets from usernames may cause identifier collisions (e.g.,
'[bot]' vs 'bot' or different names differing only by brackets) leading to incorrect user
associations.
_github_exporter_example_port_app_config.mdx [33-35]

Referred Code
creator: .creator.login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")
assignees: "[.assignees[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]"
reviewers: "[.requested_reviewers[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]"
Identifier collision risk

Description: Removing brackets from team member logins for identifiers may produce non-unique IDs
across members whose only difference is bracket placement, enabling unintended overwrites
or mis-links.
_github_team_member_port_app_config.mdx [22-32]

Referred Code
          team_member: '[.members.nodes[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]'
- kind: team
  selector:
    query: 'true'
    members: true
  port:
    itemsToParse: .members.nodes
    entity:
      mappings:
        identifier: .login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")
        title: .login
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No logging context: The added mappings focus on identifier sanitization in configuration docs and do not add
or modify any audit logging for critical actions, leaving it unclear whether audit trail
requirements are met elsewhere.

Referred Code
creator: .creator.login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")
assignees: "[.assignees[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]"
reviewers: "[.requested_reviewers[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]"
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
No error handling: The new regex-based sanitization in mappings lacks explicit error handling or fallbacks
for null/empty logins or unexpected formats, which may cause failures depending on the
runtime evaluator.

Referred Code
          team_member: '[.members.nodes[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]'
- kind: team
  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Oct 28, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Simplify complex sanitization logic

Simplify the complex three-step gsub chain for sanitizing usernames. Replace it
with a two-step chain that replaces [ with - and removes ].

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/_github_exporter_example_port_app_config.mdx [33-35]

-creator: .creator.login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")
-assignees: "[.assignees[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]"
-reviewers: "[.requested_reviewers[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]"
+creator: .creator.login | gsub("\\["; "-") | gsub("\\]"; "")
+assignees: "[.assignees[].login | gsub("\\["; "-") | gsub("\\]"; "")]"
+reviewers: "[.requested_reviewers[].login | gsub("\\["; "-") | gsub("\\]"; "")]"
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that the three-step gsub chain is overly complex and proposes a simpler, more readable alternative that achieves the same primary goal of sanitizing bot user names like app[bot].

Low
Organization
best practice
Add line numbers to code blocks
Suggestion Impact:The YAML code block was updated to include the showLineNumbers flag.

code diff:

 ```yaml showLineNumbers

Add the showLineNumbers flag to multi-line YAML code blocks to improve
readability and align with docs standards.

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/example-team-members/_github_team_member_port_app_config.mdx [1-36]

-```yaml
+```yaml showLineNumbers
 ...
         team_member: '[.members.nodes[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]'
 ...
         identifier: .login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")
 ...



`[To ensure code accuracy, apply this suggestion manually]`


<details><summary>Suggestion importance[1-10]: 6</summary>

__

Why: 
Relevant best practice - Code examples with multiple lines should enable line numbers for clarity.

</details></details></td><td align=center>Low

</td></tr>
<tr><td align="center" colspan="2">

- [ ] Update <!-- /improve_multi --more_suggestions=true -->

</td><td></td></tr></tbody></table>

@hadar-co hadar-co added the awaiting dev review Reviewed by technical content, awaiting review from relevant dev label Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting dev review Reviewed by technical content, awaiting review from relevant dev Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants