Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: session token is not being injected into app URIs #17704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
f0ssel opened this issue May 7, 2025 · 4 comments · Fixed by #17708
Closed
1 task done

bug: session token is not being injected into app URIs #17704

f0ssel opened this issue May 7, 2025 · 4 comments · Fixed by #17708
Labels
regression Something that used to work but no longer works s1 Bugs that break core workflows. Only humans may set this.

Comments

@f0ssel
Copy link
Contributor

f0ssel commented May 7, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I think we have a regression somewhere related to parsing and injecting the coder session token into the URIs we link to in our coder app buttons on the dashboard.

Here's an example URI link:

cursor://coder.coder-remote/open?owner=f0ssel&workspace=doom&folder=/home/coder/coder&url=https://dev.coder.com&token=$SESSION_TOKEN

Image

Relevant Log Output

Expected Behavior

The linked URI contains a valid session token.

Steps to Reproduce

  1. Go to workspace with Coder on Coder template
  2. Right click Cursor or Goland button and Copy Link Address

Environment

Additional Context

No response

@f0ssel f0ssel added the needs-triage Issue that require triage label May 7, 2025
@matifali matifali added regression Something that used to work but no longer works s1 Bugs that break core workflows. Only humans may set this. and removed needs-triage Issue that require triage labels May 7, 2025
@matifali
Copy link
Member

matifali commented May 7, 2025

Same issue with Cursor. Looks like the frontend is not populating the $SESSION_TOKEN variable.

@BrunoQuaresma
Copy link
Collaborator

Just confirming, is it happening only when copying the link with the right click, correct? Does it work when clicking in the app button? I'm asking that because after taking a look into the code I see we only replace the session token during the click event and it has been like that for awhile.

@BrunoQuaresma
Copy link
Collaborator

But this still a bug and I'm going to fix that asap. Probably I will have a PR for it tomorrow, is it ok?

@matifali
Copy link
Member

matifali commented May 7, 2025

Just confirming, is it happening only when copying the link with the right click, correct? Does it work when clicking in the app button? I'm asking that because after taking a look into the code I see we only replace the session token during the click event and it has been like that for awhile.

No it does not work when clicking too.

Yes, tomorrow is fine. We have not released this yet.

BrunoQuaresma added a commit that referenced this issue May 7, 2025
Fix #17704

During the [refactoring of WorkspaceApp response
type](https://github.com/coder/coder/pull/17700/files#diff-a7e67944708c3c914a24a02d515a89ecd414bfe61890468dac08abde55ba8e96R112),
I updated the logic to check if the session token should be injected
causing external apps to not load correctly.

To also avoid future confusions, we are only going to rely on the
`app.external` prop to open apps externally instead of verifying if the
URL does not use the HTTP protocol. I did some research and I didn't
find out a use case where it would be a problem.

I'm going to refactor this code very soon to allow opening apps from the
workspaces page, so I will write the tests to cover this use case there.

**Not included:**
During my next refactoring I'm also going to change the code to support
token injections directly in the HREF instead of making it happen during
the click event.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something that used to work but no longer works s1 Bugs that break core workflows. Only humans may set this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants