Skip to content
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

Unable to opt-out of DataExport token scope #3531

Open
fradaschin opened this issue Jul 24, 2024 · 6 comments
Open

Unable to opt-out of DataExport token scope #3531

fradaschin opened this issue Jul 24, 2024 · 6 comments

Comments

@fradaschin
Copy link

Is your feature request related to a problem? Please describe.
Our customers are trying to update the Dynatrace-operator and they are receiving the following message:
token 'apiToken' is missing the following scopes: [ DataExport ]

We are a Service Provider for Dynatrace and cannot hand over tokens with all the permissions specified in the official public documentation.

One of our colleagues has proposed this PR #670 a while ago , but we see the latest version of the code reveals this was reverted/removed.

Describe the solution you'd like
Is there any possibility to add this back?

@chrismuellner
Copy link
Collaborator

This token scope is now always required since the feature flag to disable host requests was removed with v1.0.0.

We're working on additional changes to make these scopes no longer needed in the future, but we don't have an ETA at this time.

@fradaschin
Copy link
Author

Hi @chrismuellner,

Thank you very much for your reply.

@chrismuellner chrismuellner changed the title Missing functionality added in the past Unable to opt-out of DataExport token scope Aug 26, 2024
@ernstvonoelsen
Copy link
Contributor

Hi @chrismuellner

I'd like to return to this topic, since I think I figured out a feasible path to a least-privilege approach:

we currently have to provide an apiToken to all of our users with the following permissions:

  • PaaS - Installer (Installer download)
  • Access problem and event feed, metrics, and topology (API v1 - DataExport)
  • Read settings (API v2 - settings.read)
  • Write settings (API v2 - settings.write)
  • Read entities (API v2 - entities.read)

Lacking the officially required Create ActiveGate token (API v2 - activeGateTokenManagement.create) permission is actually not an issue as long as no activeGate section is provided in the dynakube.yaml file.

Checking from the source code which endpoints are predefined, I find the following inside pkg/clients/dynatrace/endpoints.go:

  • /v1/deployment
  • /v1/events
  • /v1/entity/infrastructure/hosts

Apart from /v1/deployment, all of those endpoints are marked as deprecated, and all of them have a replacement on the /api/v2/ side; the replacements furthermore support the usage of Personal Access Tokens.

This yields the idea to implement the following changes:
Replace all /v1/ endpoint calls (except for /v1/deployment/) with their /v2/ counterparts (including the processing of the response, of course).
Those changes in place, we would be able to provide our users with a paasToken only, and the apiToken can be provided by them using a PAT.

This approach automatically limits the entities.read, settings.read and settings.write operations to the personal scope of the PAT owner.

In case that this approach looks promising to you, I would be more than happy to provide a feature PR.

@chrismuellner
Copy link
Collaborator

We've deprecated the "Mark for termination" event with v1.4.0 (release notes) and will remove it in a future release of the Operator. Since Oneagent 301 the shutdown information is directly sent by the Host agent (release notes).

When the Operator no longer sends this event the following token scopes and endpoints will no longer be used:

  • Access problem and event feed, metrics, and topology (API v1 - DataExport)
    • /v1/events
    • /v1/entity/infrastructure/hosts

@ernstvonoelsen
Copy link
Contributor

Thank you for this update @chrismuellner .

@wb-ts
Copy link

wb-ts commented Jan 27, 2025

I have the same issue and would like to get solved as correct.

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

No branches or pull requests

4 participants