Commit 53b033b4 authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak

Deprecate GrafanaIntegration graphql token field

After making #token in GrafanaIntegration model private,
we have to depricate graphql filed and make it always return nil.
parent 8d13b44b
...@@ -10,14 +10,19 @@ module Types ...@@ -10,14 +10,19 @@ module Types
description: 'Internal ID of the Grafana integration' description: 'Internal ID of the Grafana integration'
field :grafana_url, GraphQL::STRING_TYPE, null: false, field :grafana_url, GraphQL::STRING_TYPE, null: false,
description: 'Url for the Grafana host for the Grafana integration' description: 'Url for the Grafana host for the Grafana integration'
field :token, GraphQL::STRING_TYPE, null: false,
description: 'API token for the Grafana integration'
field :enabled, GraphQL::BOOLEAN_TYPE, null: false, field :enabled, GraphQL::BOOLEAN_TYPE, null: false,
description: 'Indicates whether Grafana integration is enabled' description: 'Indicates whether Grafana integration is enabled'
field :created_at, Types::TimeType, null: false, field :created_at, Types::TimeType, null: false,
description: 'Timestamp of the issue\'s creation' description: 'Timestamp of the issue\'s creation'
field :updated_at, Types::TimeType, null: false, field :updated_at, Types::TimeType, null: false,
description: 'Timestamp of the issue\'s last activity' description: 'Timestamp of the issue\'s last activity'
field :token, GraphQL::STRING_TYPE, null: false,
deprecation_reason: 'Plain text token has been masked for security reasons',
description: 'API token for the Grafana integration. Field is permanently masked.'
def token
object.masked_token
end
end end
end end
--- ---
title: Prevent gafana integration token from being displayed as a plain text to other project maintainers, by only displaying a masked version of it. title: Prevent gafana integration token from being displayed as a plain text to other project maintainers, by only displaying a masked version of it. GraphQL api deprecate token field in GrafanaIntegration type.
merge_request: merge_request:
author: author:
type: security type: security
...@@ -2658,9 +2658,9 @@ type GrafanaIntegration { ...@@ -2658,9 +2658,9 @@ type GrafanaIntegration {
id: ID! id: ID!
""" """
API token for the Grafana integration API token for the Grafana integration. Field is permanently masked.
""" """
token: String! token: String! @deprecated(reason: "Plain text token has been masked for security reasons")
""" """
Timestamp of the issue's last activity Timestamp of the issue's last activity
......
...@@ -17275,7 +17275,7 @@ ...@@ -17275,7 +17275,7 @@
}, },
{ {
"name": "token", "name": "token",
"description": "API token for the Grafana integration", "description": "API token for the Grafana integration. Field is permanently masked.",
"args": [ "args": [
], ],
...@@ -17288,8 +17288,8 @@ ...@@ -17288,8 +17288,8 @@
"ofType": null "ofType": null
} }
}, },
"isDeprecated": false, "isDeprecated": true,
"deprecationReason": null "deprecationReason": "Plain text token has been masked for security reasons"
}, },
{ {
"name": "updatedAt", "name": "updatedAt",
......
...@@ -403,7 +403,7 @@ Autogenerated return type of EpicTreeReorder ...@@ -403,7 +403,7 @@ Autogenerated return type of EpicTreeReorder
| `enabled` | Boolean! | Indicates whether Grafana integration is enabled | | `enabled` | Boolean! | Indicates whether Grafana integration is enabled |
| `grafanaUrl` | String! | Url for the Grafana host for the Grafana integration | | `grafanaUrl` | String! | Url for the Grafana host for the Grafana integration |
| `id` | ID! | Internal ID of the Grafana integration | | `id` | ID! | Internal ID of the Grafana integration |
| `token` | String! | API token for the Grafana integration | | `token` | String! | API token for the Grafana integration. Field is permanently masked. |
| `updatedAt` | Time! | Timestamp of the issue's last activity | | `updatedAt` | Time! | Timestamp of the issue's last activity |
## Group ## Group
......
...@@ -45,7 +45,7 @@ describe 'Getting Grafana Integration' do ...@@ -45,7 +45,7 @@ describe 'Getting Grafana Integration' do
it_behaves_like 'a working graphql query' it_behaves_like 'a working graphql query'
it { expect(integration_data['token']).to eql grafana_integration.token } it { expect(integration_data['token']).to eql grafana_integration.masked_token }
it { expect(integration_data['grafanaUrl']).to eql grafana_integration.grafana_url } it { expect(integration_data['grafanaUrl']).to eql grafana_integration.grafana_url }
it do it do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment