Skip to content

Commit 2161da8

Browse files
feat: Removed scope app-engine:functions:run as it's not needed (#227)
1 parent d4b8aab commit 2161da8

9 files changed

+16
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased Changes
44

5+
### Scopes
6+
7+
- Removed scope `app-engine:functions:run` as it's not needed
58
- Breaking: Changed default HTTP server host binding from `0.0.0.0` to `127.0.0.1` for improved security
69

710
## 0.11.0

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ Depending on the features you are using, the following scopes are needed:
324324
**Available for both Platform Tokens and OAuth Clients:**
325325

326326
- `app-engine:apps:run` - needed for almost all tools
327-
- `app-engine:functions:run` - needed for for almost all tools
328327
- `environment-api:entities:read` - for retrieving ownership details from monitored entities (_currently not available for Platform Tokens_)
329328
- `automation:workflows:read` - read Workflows
330329
- `automation:workflows:write` - create and update Workflows
@@ -347,9 +346,12 @@ Depending on the features you are using, the following scopes are needed:
347346
- `email:emails:send` - needed for `send_email` tool to send emails
348347
- `settings:objects:read` - needed for reading ownership information and Guardians (SRG) from settings
349348

350-
**Note**: Please ensure that `settings:objects:read` is used, and _not_ the similarly named scope `app-settings:objects:read`.
349+
**Notes**:
351350

352-
**Important**: Some features requiring `environment-api:entities:read` will only work with OAuth Clients. For most use cases, Platform Tokens provide all necessary functionality.
351+
- Please ensure that `settings:objects:read` is used, and _not_ the similarly named scope `app-settings:objects:read`.
352+
- Versions before 0.12.0 required the scope `app-engine:functions:run`, which is no longer required.
353+
354+
**Important**: Some features requiring `environment-api:entities:read` will not work with Platform Tokens.
353355

354356
## ✨ Example prompts ✨
355357

@@ -531,7 +533,7 @@ In most cases, authentication issues are related to missing scopes or invalid to
531533
**For OAuth Clients:**
532534
In case of OAuth-related problems, you can troubleshoot SSO/OAuth issues based on our [Dynatrace Developer Documentation](https://developer.dynatrace.com/develop/access-platform-apis-from-outside/#get-bearer-token-and-call-app-function).
533535

534-
It is recommended to test access with the following API (which requires minimal scopes `app-engine:apps:run` and `app-engine:functions:run`):
536+
It is recommended to test access with the following API (which requires minimal scopes `app-engine:apps:run` and, e.g., `storage:logs:read`):
535537

536538
1. Use OAuth Client ID and Secret to retrieve a Bearer Token (only valid for a couple of minutes):
537539

@@ -541,7 +543,7 @@ curl --request POST 'https://sso.dynatrace.com/sso/oauth2/token' \
541543
--data-urlencode 'grant_type=client_credentials' \
542544
--data-urlencode 'client_id={your-client-id}' \
543545
--data-urlencode 'client_secret={your-client-secret}' \
544-
--data-urlencode 'scope=app-engine:apps:run app-engine:functions:run'
546+
--data-urlencode 'scope=app-engine:apps:run storage:logs:read'
545547
```
546548

547549
2. Use `access_token` from the response of the above call as the bearer-token in the next call:

integration-tests/davis-copilot-explain-dql.integration.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ config();
1515

1616
const scopesBase = [
1717
'app-engine:apps:run', // needed for environmentInformationClient
18-
'app-engine:functions:run', // needed for environmentInformationClient
1918
];
2019

2120
describe('DQL Explanation Integration Tests', () => {

integration-tests/dynatrace-clients.integration.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const API_RATE_LIMIT_DELAY = 100; // Delay in milliseconds to avoid hitting API
2121

2222
const scopesBase = [
2323
'app-engine:apps:run', // needed for environmentInformationClient
24-
'app-engine:functions:run', // needed for environmentInformationClient
2524
];
2625

2726
describe('Dynatrace Clients Integration Tests', () => {

integration-tests/execute-dql.integration.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const API_RATE_LIMIT_DELAY = 100; // Delay in milliseconds to avoid hitting API
1717

1818
const scopesBase = [
1919
'app-engine:apps:run', // needed for environmentInformationClient
20-
'app-engine:functions:run', // needed for environmentInformationClient
2120
];
2221

2322
const scopesDqlExecution = [

integration-tests/find-monitored-entity-by-name.integration.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const API_RATE_LIMIT_DELAY = 100; // Delay in milliseconds to avoid hitting API
1818

1919
const scopesBase = [
2020
'app-engine:apps:run', // needed for environmentInformationClient
21-
'app-engine:functions:run', // needed for environmentInformationClient
2221
];
2322

2423
const scopesEntitySearch = [

integration-tests/send-email.integration.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This test verifies the email sending functionality by making actual API calls
55
* to the Dynatrace environment. These tests require valid authentication credentials
66
* and the email:emails:send scope.
7-
*
7+
*
88
* IMPORTANT: Update the TEST_EMAIL_* variables below with your own email addresses
99
* be subject: '[Integration Test] Invalid Email Test',
1010
body: {
@@ -25,7 +25,6 @@ const API_RATE_LIMIT_DELAY = 100; // Delay in milliseconds to avoid hitting API
2525

2626
const scopesBase = [
2727
'app-engine:apps:run', // needed for environmentInformationClient
28-
'app-engine:functions:run', // needed for environmentInformationClient
2928
];
3029

3130
const scopesEmail = [
@@ -156,7 +155,7 @@ fetch logs
156155
This email was sent to multiple recipients to test the TO, CC, and BCC functionality:
157156
158157
- **TO**: ${TEST_EMAIL_TO}, ${TEST_EMAIL_TO}
159-
- **CC**: ${TEST_EMAIL_CC}
158+
- **CC**: ${TEST_EMAIL_CC}
160159
- **BCC**: ${TEST_EMAIL_BCC}
161160
162161
All recipients should receive this message according to their designation.`,

src/authentication/dynatrace-oauth-auth-code-flow.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('OAuth Authorization Code Flow', () => {
66
const mockConfig: OAuthAuthorizationConfig = {
77
clientId: 'dt0s08.mocked-client',
88
redirectUri: 'http://localhost:5343/auth/login',
9-
scopes: ['app-engine:apps:run', 'app-engine:functions:run', 'storage:logs:read'], // Basic Example scopes
9+
scopes: ['app-engine:apps:run', 'storage:logs:read'], // Basic Example scopes
1010
};
1111

1212
test('createAuthorizationUrl generates valid URL with PKCE', () => {
@@ -22,7 +22,7 @@ describe('OAuth Authorization Code Flow', () => {
2222
expect(url.searchParams.get('response_type')).toBe('code');
2323
expect(url.searchParams.get('client_id')).toBe('dt0s08.mocked-client');
2424
expect(url.searchParams.get('redirect_uri')).toBe('http://localhost:5343/auth/login');
25-
expect(url.searchParams.get('scope')).toBe('app-engine:apps:run app-engine:functions:run storage:logs:read');
25+
expect(url.searchParams.get('scope')).toBe('app-engine:apps:run storage:logs:read');
2626
expect(url.searchParams.get('code_challenge_method')).toBe('S256');
2727
expect(url.searchParams.get('code_challenge')).toMatch(/^[A-Za-z0-9_-]{43}$/); // SHA256 base64url = 43 chars
2828
expect(url.searchParams.get('state')).toBe(result.state);
@@ -32,21 +32,18 @@ describe('OAuth Authorization Code Flow', () => {
3232
const result = createAuthorizationUrl('https://sso.dynatrace.com', mockConfig);
3333

3434
// Check that the raw URL string contains %20 for spaces, not +
35-
expect(result.authorizationUrl).toMatch(
36-
/scope=app-engine%3Aapps%3Arun%20app-engine%3Afunctions%3Arun%20storage%3Alogs%3Aread/,
37-
);
35+
expect(result.authorizationUrl).toMatch(/scope=app-engine%3Aapps%3Arun%20storage%3Alogs%3Aread/);
3836

3937
// Verify that + is not used for space encoding in scopes
4038
expect(result.authorizationUrl).not.toMatch(/scope=.*\+.*(?=&|$)/);
4139

4240
// Verify that colons are properly encoded as %3A
4341
expect(result.authorizationUrl).toMatch(/app-engine%3Aapps%3Arun/);
44-
expect(result.authorizationUrl).toMatch(/app-engine%3Afunctions%3Arun/);
4542
expect(result.authorizationUrl).toMatch(/storage%3Alogs%3Aread/);
4643

4744
// Double-check by parsing the URL and verifying the decoded scope
4845
const url = new URL(result.authorizationUrl);
49-
expect(url.searchParams.get('scope')).toBe('app-engine:apps:run app-engine:functions:run storage:logs:read');
46+
expect(url.searchParams.get('scope')).toBe('app-engine:apps:run storage:logs:read');
5047
});
5148

5249
test('startOAuthRedirectServer returns server configuration', async () => {

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const DT_MCP_AUTH_CODE_FLOW_OAUTH_CLIENT_ID = 'dt0s08.dt-app-local'; // ToDo: Re
7171
// Base Scopes for MCP Server tools
7272
let scopesBase = [
7373
'app-engine:apps:run', // needed for environmentInformationClient
74-
'app-engine:functions:run', // needed for environmentInformationClient
7574
];
7675

7776
// All scopes needed by the MCP server tools

0 commit comments

Comments
 (0)