Skip to content

feat(plugins): add managed authType to Corsair-managed oauth2 providers - #571

Open
yuvrxj-afk wants to merge 2 commits into
corsairdev:mainfrom
yuvrxj-afk:managed-authtype
Open

feat(plugins): add managed authType to Corsair-managed oauth2 providers#571
yuvrxj-afk wants to merge 2 commits into
corsairdev:mainfrom
yuvrxj-afk:managed-authtype

Conversation

@yuvrxj-afk

@yuvrxj-afk yuvrxj-afk commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Declares the managed authType on the 13 plugins Corsair has registered a managed OAuth app for, so tenant end-users can connect them without bringing their own OAuth credentials.

Each plugin gains 'managed' in its authType union, a managed: authConfig block mirroring its oauth_2 account fields, and a keyBuilder branch that resolves the tenant token from the Hub.

Scoped on purpose: managed only enters the union of registered providers, so the SDK never offers it where Corsair doesn't own the OAuth app — authType: 'managed' on an unregistered plugin is a compile error.

Plugins: asana, dropbox, gitlab, hubspot, linear, notion, onedrive, outlook, sharepoint, slack, spotify, teams, zohomail.

Excluded: airtable + jira (api_key-only, need oauth2 support first); google + stripe (not published yet).

Summary by CodeRabbit

  • New Features
    • Added managed authentication support across Asana, Dropbox, GitLab, HubSpot, Linear, Notion, OneDrive, Outlook, SharePoint, Slack, Spotify, Teams, and Zoho Mail.
    • Managed authentication now automatically obtains and refreshes access tokens.
    • Added clear errors when required connection settings are missing.
  • Bug Fixes
    • Prevented unsupported webhook signing operations when using managed authentication.
    • Restricted managed GitLab connections to valid GitLab.com hosts.

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@yuvrxj-afk is attempting to deploy a commit to the corsair Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the plugin Changes inside a plugin package label Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yuvrxj-afk, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4330b2a4-f0bd-44ad-8111-dcef0038662f

📥 Commits

Reviewing files that changed from the base of the PR and between c6f41e0 and 8acdebb.

📒 Files selected for processing (2)
  • packages/gitlab/client.test.ts
  • packages/gitlab/client.ts
📝 Walkthrough

Walkthrough

Managed authentication is added to thirteen plugins. Each plugin declares managed account fields, accepts the managed auth type, retrieves tokens through the Hub, attaches refresh behavior, and applies explicit webhook restrictions where required.

Changes

Managed authentication

Layer / File(s) Summary
Managed authentication contracts
packages/{asana,dropbox,gitlab,hubspot,linear,notion,onedrive,outlook,sharepoint,slack,spotify,teams,zohomail}/index.ts
Authentication options and exported configurations now include managed authentication with plugin-specific account fields.
Managed endpoint token flow
packages/{asana,dropbox,gitlab,hubspot,linear,notion,onedrive,outlook,sharepoint,slack,spotify,teams,zohomail}/index.ts, packages/*/jest.config.cjs
Endpoint key builders validate Hub configuration, retrieve managed tokens, attach refresh behavior, and return the token. Jest aliases resolve Hub imports during package tests.
Webhook authentication boundaries
packages/{dropbox,gitlab,onedrive,outlook,teams,zohomail}/index.ts
Webhook key generation rejects managed authentication when OAuth signatures or explicit webhook secrets are required.
GitLab host validation
packages/gitlab/client.ts, packages/gitlab/client.test.ts
isManagedGitlabHost accepts normalized gitlab.com URLs and rejects invalid or deceptive hosts. Tests cover the accepted and rejected URL forms.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

  • corsairdev/corsair#575: Both PRs update plugin authentication flows. That PR also changes managed webhook subscription and verification behavior.

Suggested labels: core

Suggested reviewers: devjain32

Sequence Diagram(s)

sequenceDiagram
  participant PluginKeyBuilder
  participant CorsairHub
  participant ManagedRefreshAuth
  PluginKeyBuilder->>CorsairHub: retrieve managed access token
  CorsairHub-->>PluginKeyBuilder: return access token
  PluginKeyBuilder->>ManagedRefreshAuth: attach refresh behavior
  ManagedRefreshAuth-->>PluginKeyBuilder: return authenticated key
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the addition of managed authType support to Corsair-managed OAuth2 providers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds managed OAuth authentication to thirteen provider plugins.

  • Extends each supported plugin’s authentication types and account-field configuration with managed.
  • Retrieves tenant access tokens from the Hub and installs managed refresh behavior.
  • Adds managed-webhook handling and a GitLab.com destination guard with normalization tests.

Confidence Score: 4/5

This PR is not yet safe to merge because managed GitLab credentials can still be sent to a noncanonical port and the previously reported managed-webhook paths remain broken.

The GitLab hostname-only check accepts and preserves arbitrary ports in authenticated request URLs, while the OneDrive, Outlook, Teams, Dropbox, SharePoint, and Zoho Mail key builders continue to reject managed webhook deliveries without separately supplied signing configuration.

Files Needing Attention: packages/gitlab/client.ts, packages/onedrive/index.ts, packages/outlook/index.ts, packages/teams/index.ts, packages/dropbox/index.ts, packages/sharepoint/index.ts, packages/zohomail/index.ts

Security Review

The GitLab destination guard remains origin-incomplete because it accepts arbitrary ports, allowing a managed bearer token to be sent to a noncanonical service on gitlab.com.

Important Files Changed

Filename Overview
packages/gitlab/client.ts Adds hostname normalization for managed GitLab authentication, but accepts non-default ports that are preserved in authenticated requests.
packages/gitlab/index.ts Adds managed authentication and a GitLab.com guard; its safety depends on the incomplete helper validation.
packages/onedrive/index.ts Adds managed authentication while retaining unconditional rejection of managed webhook verification without an explicit plugin secret.
packages/dropbox/index.ts Adds managed authentication while retaining managed webhook rejection without separately configured signing data.
packages/sharepoint/index.ts Adds managed authentication, but managed webhook processing without explicit client state still falls through to an authentication error.
packages/zohomail/index.ts Adds managed authentication while retaining managed webhook rejection without an explicit signing secret.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Plugin configured with managed auth] --> B[Key builder]
  B --> C[Fetch tenant token from Hub]
  C --> D[Attach managed refresh handler]
  D --> E[Call provider endpoint]
  B --> F{Webhook request?}
  F -->|Yes| G[Use explicit signing option or reject]
  B --> H{GitLab host accepted?}
  H -->|Hostname is gitlab.com| I[Send token to configured GitLab URL]
Loading

Reviews (3): Last reviewed commit: "feat(plugins): add managed authType to C..." | Re-trigger Greptile

Comment thread packages/gitlab/index.ts
Comment thread packages/onedrive/index.ts
Comment thread packages/dropbox/index.ts
Comment on lines +304 to +306
if (ctx.authType !== 'oauth_2') {
throw new AuthMissingError('dropbox', 'oauth_2');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Managed webhook keys are rejected

When a Dropbox, SharePoint, or Zoho Mail webhook is processed for a managed tenant without separately configured signing data, the key builder rejects managed mode or falls through to an OAuth auth-missing error, causing the incoming event to be dropped instead of verified and delivered.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Plugin PR scorecard — packages/asana

Check Status Notes
R1 — Scope: one plugin per PR This PR touches: asana, dropbox, gitlab, hubspot, linear, notion, onedrive, outlook, sharepoint, slack, spotify, teams, zohomail
R2 — Tests with assertions
R3 — Description Description section is empty or placeholder
R3 — Linked issue / claim ⚠️ No "Fixes #…" or claim link — add one if this PR has a claim or issue
R4 — Demo video / recording Required in "Screenshots / Demos" before a maintainer reviews

Rules: PLUGIN_PR_RULES.md · re-runs on every push

@github-actions github-actions Bot added the gate:failed Plugin PR gate checks failing label Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Hey @yuvrxj-afk, thanks for the contribution! 🏴‍☠️ Before a maintainer reviews, please fix the items below — the review re-runs automatically on your next push.

Must fix

  • P1 packages/gitlab/client.ts:29Managed tokens cross GitLab ports
    When managed authentication uses a non-default port such as https://gitlab.com:8443, this hostname-only check accepts the URL and the request builder preserves port 8443, causing the managed bearer token to be sent to a noncanonical service where authentication fails or the credential is disclosed.

How this was verified: The guard ignores the parsed port while the API URL retains the configured port for authenticated requests.

PR requirements (rules)

  • R1 — This PR touches: asana, dropbox, gitlab, hubspot, linear, notion, onedrive, outlook, sharepoint, slack, spotify, teams, zohomail
  • R3 — Description section is empty or placeholder
  • R4 — Required in "Screenshots / Demos" before a maintainer reviews

If anything remains after your next push, a bot commit will clean it up; a maintainer always does the final review and merge.

@github-actions github-actions Bot added the bot:round-1 Review bot posted consolidated findings label Aug 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
packages/asana/index.ts (1)

1104-1121: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Extract the duplicated managed-auth branch into a Hub helper. The identical eighteen-line block appears in all seven files and, per the PR description, in thirteen plugins. Only the plugin id changes. A single exported helper in corsair/hub, for example resolveManagedAuth(ctx, 'asana'), keeps the Hub-missing message, the context shape, and the refresh attachment in one place. This also keeps each plugin self-contained, because the shared logic stays in packages/corsair.

  • packages/asana/index.ts#L1104-L1121: replace the block with return (await resolveManagedAuth(ctx, 'asana')).accessToken;.
  • packages/dropbox/index.ts#L385-L402: replace the block with the helper call using the plugin id 'dropbox'.
  • packages/gitlab/index.ts#L922-L939: replace the block with the helper call using the plugin id 'gitlab'.
  • packages/hubspot/index.ts#L689-L706: replace the block with the helper call using the plugin id 'hubspot'.
  • packages/spotify/index.ts#L613-L630: replace the block with the helper call using the plugin id 'spotify'.
  • packages/teams/index.ts#L526-L543: replace the block with the helper call using the plugin id 'teams'.
  • packages/zohomail/index.ts#L439-L456: replace the block with the helper call using the plugin id 'zohomail'.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/asana/index.ts` around lines 1104 - 1121, The managed-auth branch is
duplicated across seven plugin files; extract it into one exported corsair/hub
helper, such as resolveManagedAuth, preserving Hub validation, managed context
construction, token resolution, and refresh attachment. Update
packages/asana/index.ts lines 1104-1121, packages/dropbox/index.ts lines
385-402, packages/gitlab/index.ts lines 922-939, packages/hubspot/index.ts lines
689-706, packages/spotify/index.ts lines 613-630, packages/teams/index.ts lines
526-543, and packages/zohomail/index.ts lines 439-456 to call the helper with
their respective plugin ids and return its access token.

Source: Coding guidelines

packages/linear/index.ts (1)

525-543: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated managed-auth boilerplate into a shared corsair/hub helper. Each plugin repeats the same ~15-line block — check ctx.hub, build managedContext, call getManagedAccessToken, call attachManagedRefreshAuth, return the token — differing only by the plugin: literal and the return-value formatting (Bearer prefix or plain token).

  • packages/linear/index.ts#L525-L543: replace the block with a shared helper call, e.g. resolveManagedAuth(ctx, 'linear'), keeping the Bearer ${token} formatting local to this plugin.
  • packages/notion/index.ts#L404-L422: replace the block with the same shared helper call using 'notion'.
  • packages/onedrive/index.ts#L917-L935: replace the block with the same shared helper call using 'onedrive'.
  • packages/outlook/index.ts#L684-L702: replace the block with the same shared helper call using 'outlook'.
  • packages/sharepoint/index.ts#L1459-L1481: replace the block with the same shared helper call using 'sharepoint', keeping the existing source === 'endpoint' guard around the call.
  • packages/slack/index.ts#L796-L814: replace the block with the same shared helper call using 'slack'.

Centralizing this in packages/corsair/hub is consistent with the plugin self-containment rule, since that path is excluded from the per-plugin package requirement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/linear/index.ts` around lines 525 - 543, Extract the repeated
managed-auth flow into a shared resolveManagedAuth helper under
packages/corsair/hub, centralizing hub validation, managedContext construction,
token retrieval, and refresh-auth attachment. Update packages/linear/index.ts
(525-543), packages/notion/index.ts (404-422), packages/onedrive/index.ts
(917-935), packages/outlook/index.ts (684-702), packages/sharepoint/index.ts
(1459-1481), and packages/slack/index.ts (796-814) to call it with their
respective plugin names; preserve Linear’s Bearer formatting, each plugin’s
token formatting, and SharePoint’s source === 'endpoint' guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/gitlab/index.ts`:
- Around line 922-939: Update the GitLab webhook secret retrieval path to
explicitly reject managed authentication when no stored signature is available,
rather than returning an empty string. Use the existing auth-type/context
symbols near the webhook handler and preserve normal secret handling for
non-managed tenants; ensure verification fails closed consistently with the
other managed integrations.

In `@packages/spotify/index.ts`:
- Line 57: Inspect the Spotify plugin definition and Hub auth-resolution path to
confirm whether managed account fields require an exported auth config. If
required, add a spotifyAuthConfig with a managed entry mirroring Spotify’s OAuth
account fields and assign it to the plugin object’s authConfig; otherwise
preserve the current declaration and ensure managed resolution works without it.

In `@packages/teams/index.ts`:
- Around line 475-479: Update the managed Teams onboarding flow associated with
teamsSubscribe to require and set an explicit options.clientState before webhook
key requests reach the authType === 'managed' validation. Document that managed
Teams tenants must configure clientState, while preserving the existing error
for any managed configuration that remains unset.

---

Nitpick comments:
In `@packages/asana/index.ts`:
- Around line 1104-1121: The managed-auth branch is duplicated across seven
plugin files; extract it into one exported corsair/hub helper, such as
resolveManagedAuth, preserving Hub validation, managed context construction,
token resolution, and refresh attachment. Update packages/asana/index.ts lines
1104-1121, packages/dropbox/index.ts lines 385-402, packages/gitlab/index.ts
lines 922-939, packages/hubspot/index.ts lines 689-706,
packages/spotify/index.ts lines 613-630, packages/teams/index.ts lines 526-543,
and packages/zohomail/index.ts lines 439-456 to call the helper with their
respective plugin ids and return its access token.

In `@packages/linear/index.ts`:
- Around line 525-543: Extract the repeated managed-auth flow into a shared
resolveManagedAuth helper under packages/corsair/hub, centralizing hub
validation, managedContext construction, token retrieval, and refresh-auth
attachment. Update packages/linear/index.ts (525-543), packages/notion/index.ts
(404-422), packages/onedrive/index.ts (917-935), packages/outlook/index.ts
(684-702), packages/sharepoint/index.ts (1459-1481), and packages/slack/index.ts
(796-814) to call it with their respective plugin names; preserve Linear’s
Bearer formatting, each plugin’s token formatting, and SharePoint’s source ===
'endpoint' guard.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 498cc5e5-b2e4-4414-9b0d-fddb4f5bd4b4

📥 Commits

Reviewing files that changed from the base of the PR and between 709940c and 0b6c9dd.

📒 Files selected for processing (13)
  • packages/asana/index.ts
  • packages/dropbox/index.ts
  • packages/gitlab/index.ts
  • packages/hubspot/index.ts
  • packages/linear/index.ts
  • packages/notion/index.ts
  • packages/onedrive/index.ts
  • packages/outlook/index.ts
  • packages/sharepoint/index.ts
  • packages/slack/index.ts
  • packages/spotify/index.ts
  • packages/teams/index.ts
  • packages/zohomail/index.ts

Comment thread packages/gitlab/index.ts
Comment thread packages/spotify/index.ts
Comment thread packages/teams/index.ts
Comment on lines +475 to +479
if (ctx.authType === 'managed') {
throw new Error(
'[auth-missing:teams:managed]: webhook signature is not available in managed mode',
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Managed tenants now require an explicit clientState.

The plugin registers subscribe: teamsSubscribe, and Microsoft Graph notifications carry a clientState value. With authType: 'managed' and no options.clientState, every webhook key request throws. Confirm that the managed onboarding path sets clientState, and document this requirement for managed Teams tenants.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/teams/index.ts` around lines 475 - 479, Update the managed Teams
onboarding flow associated with teamsSubscribe to require and set an explicit
options.clientState before webhook key requests reach the authType === 'managed'
validation. Document that managed Teams tenants must configure clientState,
while preserving the existing error for any managed configuration that remains
unset.

@yuvrxj-afk

Copy link
Copy Markdown
Collaborator Author

@greptileai

Comment thread packages/gitlab/index.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/gitlab/client.test.ts (1)

5-26: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add negative cases for non-HTTPS schemes.

URL.hostname is independent of the URL protocol, so hostname equality alone accepts http://gitlab.com and ftp://gitlab.com. (url.spec.whatwg.org) Add these inputs to the rejected list after the implementation requires https:. This prevents regressions in managed-token transport validation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/gitlab/client.test.ts` around lines 5 - 26, Update the managed
GitLab host validation used by isManagedGitlabHost to require the URL protocol
to be https: in addition to the existing hostname checks, then add
http://gitlab.com and ftp://gitlab.com to the rejected test inputs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/gitlab/client.ts`:
- Around line 23-31: Update isManagedGitlabHost in packages/gitlab/client.ts to
require both hostname gitlab.com and url.protocol === 'https:'; continue
returning false for invalid URLs. In packages/gitlab/client.test.ts lines 5-26,
add coverage asserting http://gitlab.com and ftp://gitlab.com are rejected while
the HTTPS host remains accepted.

---

Nitpick comments:
In `@packages/gitlab/client.test.ts`:
- Around line 5-26: Update the managed GitLab host validation used by
isManagedGitlabHost to require the URL protocol to be https: in addition to the
existing hostname checks, then add http://gitlab.com and ftp://gitlab.com to the
rejected test inputs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a20a4d5-fefe-4d3d-8e3a-31e222506fd7

📥 Commits

Reviewing files that changed from the base of the PR and between 064f1d9 and c6f41e0.

📒 Files selected for processing (28)
  • packages/asana/index.ts
  • packages/asana/jest.config.cjs
  • packages/dropbox/index.ts
  • packages/dropbox/jest.config.cjs
  • packages/gitlab/client.test.ts
  • packages/gitlab/client.ts
  • packages/gitlab/index.ts
  • packages/gitlab/jest.config.cjs
  • packages/hubspot/index.ts
  • packages/hubspot/jest.config.cjs
  • packages/linear/index.ts
  • packages/linear/jest.config.cjs
  • packages/notion/index.ts
  • packages/notion/jest.config.cjs
  • packages/onedrive/index.ts
  • packages/onedrive/jest.config.cjs
  • packages/outlook/index.ts
  • packages/outlook/jest.config.cjs
  • packages/sharepoint/index.ts
  • packages/sharepoint/jest.config.cjs
  • packages/slack/index.ts
  • packages/slack/jest.config.cjs
  • packages/spotify/index.ts
  • packages/spotify/jest.config.cjs
  • packages/teams/index.ts
  • packages/teams/jest.config.cjs
  • packages/zohomail/index.ts
  • packages/zohomail/jest.config.cjs
🚧 Files skipped from review as they are similar to previous changes (26)
  • packages/gitlab/jest.config.cjs
  • packages/hubspot/jest.config.cjs
  • packages/teams/jest.config.cjs
  • packages/dropbox/jest.config.cjs
  • packages/linear/jest.config.cjs
  • packages/notion/jest.config.cjs
  • packages/sharepoint/jest.config.cjs
  • packages/outlook/jest.config.cjs
  • packages/slack/jest.config.cjs
  • packages/asana/jest.config.cjs
  • packages/zohomail/jest.config.cjs
  • packages/onedrive/index.ts
  • packages/gitlab/index.ts
  • packages/outlook/index.ts
  • packages/asana/index.ts
  • packages/spotify/jest.config.cjs
  • packages/spotify/index.ts
  • packages/notion/index.ts
  • packages/dropbox/index.ts
  • packages/onedrive/jest.config.cjs
  • packages/hubspot/index.ts
  • packages/linear/index.ts
  • packages/zohomail/index.ts
  • packages/teams/index.ts
  • packages/slack/index.ts
  • packages/sharepoint/index.ts

Comment thread packages/gitlab/client.ts
@yuvrxj-afk

Copy link
Copy Markdown
Collaborator Author

@greptileai

Comment thread packages/gitlab/client.ts Outdated
Comment on lines +26 to +29
new URL(baseUrl).hostname.replace(/\.$/, '').toLowerCase() ===
'gitlab.com'
);
} catch {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Managed tokens cross GitLab ports

When managed authentication uses a non-default port such as https://gitlab.com:8443, this hostname-only check accepts the URL and the request builder preserves port 8443, causing the managed bearer token to be sent to a noncanonical service where authentication fails or the credential is disclosed.

How this was verified: The guard ignores the parsed port while the API URL retains the configured port for authenticated requests.

isManagedGitlabHost compared only the hostname, so https://gitlab.com:8443
passed and Corsair's managed bearer token (valid only for canonical gitlab.com)
would be sent to a noncanonical service. Require https on the default port, so a
custom port or scheme is treated as a custom host and rejected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:round-1 Review bot posted consolidated findings gate:failed Plugin PR gate checks failing plugin Changes inside a plugin package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants