Skip to content

[CDTOOL-1144] Let profile accept service-limited tokens - #1856

Merged
jedisct1 merged 6 commits into
mainfrom
fdenis/profilecreate
Jul 29, 2026
Merged

jedisct1 merged 6 commits into
mainfrom
fdenis/profilecreate

Conversation

@jedisct1

Copy link
Copy Markdown
Contributor

Change summary

fastly profile create, profile update and auth login validate a static token by looking up the current user, but that endpoint was recently made unavailable to service-limited tokens (a recent change), so these commands failed even with a valid token.

Fix that: tokens are now accepted as long as either /current_user or /tokens/self succeeds.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

User Impact

No behavior change for full-access tokens. Profiles created from a service-limited token won't display an email or account ID, but this is expected.

Are there any considerations that need to be addressed for release?

None. No breaking changes, no config format change.

jedisct1 added 2 commits July 29, 2026 15:05
When the "fastly profile create" command is run and provided an
existing (static) token, and that token is service-limited, the
GET /user/:id operation invoked by the CLI to validate the token
failed because that endpoint is now unavailable to service-limited
tokens.

This was a recent behavior change.

Fix that by reusing what we already did for the "profile update"
command.
A token is now accepted whenever /current_user or /tokens/self
responds successfully.

In service-limited tokens the email and account ID are empty,
so handle that properly.
@jedisct1
jedisct1 requested a review from a team as a code owner July 29, 2026 13:22
@jedisct1
jedisct1 requested a review from rcaril July 29, 2026 13:22

@rcaril rcaril left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, great refactor with two minor / optional nits. Please also add a changelog entry :)

(nit): the both-fail test only checks the error message - consider also verifying the token isn't saved to the config when validation fails (e.g. a Validator asserting GetAuthToken(...) is nil)

Comment thread pkg/app/run.go Resolved
Comment thread pkg/commands/auth/login.go Resolved
@jedisct1

Copy link
Copy Markdown
Contributor Author

(nit): the both-fail test only checks the error message - consider also verifying the token isn't saved to the config when validation fails (e.g. a Validator asserting GetAuthToken(...) is nil)

Done :)

@jedisct1

Copy link
Copy Markdown
Contributor Author

ChangeLog entry added. Not sure if that should be in "Enhancements" or "Bug fixes" (since it doesn't really fix a bug in the CLI itself).

Comment thread CHANGELOG.md Resolved

@rcaril rcaril left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One suggestion for the changelog, otherwise looks good!

@jedisct1
jedisct1 merged commit 8e7de0a into main Jul 29, 2026
14 checks passed
@jedisct1
jedisct1 deleted the fdenis/profilecreate branch July 29, 2026 16:00
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
fastly 15.5.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## [v15.5.0](https://github.com/fastly/cli/releases/tag/v15.5.0) (2026-08-04)

### Bug Fixes:

- fix(service-version): support autoclone when staging a service version. ([#1850](fastly/cli#1850))
- fix(logging): the `placement` flag for all loggging commands can now be reset back to `null` by setting it's value to `""` when it was previously set to another value ([#1855](fastly/cli#1855))
- fix(profile): profiles can now be created and updated with service-limited tokens, which cannot access `/current_user` ([#1856](fastly/cli#1856))

### Enhancements:

- feat(compute/init): add support for Python language ([#1811](fastly/cli#1811))
- feat(integrations): Add support for Notification Service Integrations ([#1868](fastly/cli#1868))

### Dependencies:

- build(deps): `golang.org/x/crypto` from 0.53.0 to 0.54.0 ([#1847](fastly/cli#1847))
- build(deps): `github.com/bodgit/sevenzip` from 1.6.4 to 1.6.5 ([#1847](fastly/cli#1847))
- build(deps): `github.com/minio/minlz` from 1.1.1 to 1.2.0 ([#1847](fastly/cli#1847))
- build(deps): `github.com/coreos/go-oidc/v3` from 3.19.0 to 3.20.0 ([#1847](fastly/cli#1847))
- build(deps): `golang.org/x/net` from 0.56.0 to 0.57.0 ([#1847](fastly/cli#1847))
- build(deps): `github.com/fastly/go-fastly` from 16.0.1 to 17.0.0 ([#1855](fastly/cli#1855))
- build(deps): `github.com/mattn/go-isatty` from 0.0.23 to 0.0.24 ([#1857](fastly/cli#1857))
- build(deps): `github.com/nwaples/rardecode/v2` from 2.2.5 to 2.3.0 ([#1857](fastly/cli#1857))
- build(deps): `github.com/mattn/go-runewidth` from 0.0.24 to 0.0.27 ([#1857](fastly/cli#1857))
- build(deps): `github.com/fastly/go-fastly/v17` from 17.0.0 to 17.1.0 ([#1862](https://github.com/fastly/cli/pull/1862))</pre>
  <p>View the full release notes at <a href="https://github.com/fastly/cli/releases/tag/v15.5.0">https://github.com/fastly/cli/releases/tag/v15.5.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!15863
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants