A comprehensive container-based tool for automated rotation of Harness API tokens with seamless secret management integration. This plugin automatically rotates service account tokens, updates corresponding secrets, and maintains security best practices by removing expired tokens.
The Harness Token Rotation Plugin provides automated lifecycle management for Harness API tokens by:
The plugin is designed to run as part of scheduled pipelines or triggered workflows, ensuring your service account tokens remain fresh and secure without manual intervention.
amd64 and arm64 architecturesThese variables are required for all operations:
| Variable | Description | Required | Default | Example |
|---|---|---|---|---|
PLUGIN_SWITCH | Operation mode: main and rotate | No | main | main |
PLUGIN_HARNESS_URI | Harness platform API base URL | Yes | https://app.harness.io | |
PLUGIN_HARNESS_ACCT | Harness account identifier | Yes | HT1234569XFhhslllddd12 | |
PLUGIN_HARNESS_API_KEY | Harness API token with service read permissions | Yes | pat.example123... | |
PLUGIN_DEBUG_MODE | Enable debug logging for troubleshooting | No | false | true |
SSL_VERIFY_X509_STRICT | Enforce strict adherance to the SSL RFC5280 | String | all |
Controls token rotation behavior:
| Variable | Description | Required | Default | Example |
|---|---|---|---|---|
PLUGIN_API_KEY_TYPE | API key type: SERVICE_ACCOUNT or USER | Yes | SERVICE_ACCOUNT | |
PLUGIN_PARENT_ID | Parent RBAC identifier (service account or user identifier) | Yes | harness_platform_manager | |
PLUGIN_API_KEY_ID | API Key identifier under the service account | Yes | platform_manager | |
PLUGIN_NEW_TOKEN_REFERENCE | Unique identifier for the new token | Yes | auto_token_123 | |
PLUGIN_TOKEN_ORG_ID | Organization ID containing the token | No | Harness_Platform_Management | |
PLUGIN_TOKEN_PROJECT_ID | Project ID containing the token | No | Solutions_Factory |
Controls secret update behavior:
| Variable | Description | Required | Default | Example |
|---|---|---|---|---|
PLUGIN_SECRET_ID | Secret ID to update with new token | Yes | hsf_platform_api_key | |
PLUGIN_SECRET_ORG_ID | Organization ID containing the secret | No | Harness_Platform_Management | |
PLUGIN_SECRET_PROJECT_ID | Project ID containing the secret | No | Solutions_Factory | |
UPDATE_SELF | Should the new token be used once the rotation is complete to then delete old token. Requires 'core_secret_edit' and 'core_serviceaccount_manageapikey' permissions on the token. | No | false | true |
This image supports the Harness plugin configuration
steps:
- step:
type: Plugin
name: Rotate Token
identifier: Rotate_Token
spec:
connectorRef: account.harnessImage
image: harnesssolutionfactory/harness-token-rotation:latest
settings:
SWITCH: rotate
HARNESS_URI: https://app.harness.io
HARNESS_ACCT: <+pipeline.variables.hsf_account>
HARNESS_API_KEY: <+secrets.getValue("HARNESS_API_SECRET")>
API_KEY_TYPE: SERVICE_ACCOUNT
PARENT_ID: harness_platform_management
API_KEY_ID: platform_automation
NEW_TOKEN_REFERENCE: auto_token_<+pipeline.sequenceId>
SECRET_ID: hsf_platform_api_key
UPDATE_SELF: true
steps:
- step:
type: Plugin
name: Rotate Token
identifier: Rotate_Token
spec:
connectorRef: account.harnessImage
image: harnesssolutionfactory/harness-token-rotation:latest
settings:
SWITCH: rotate
HARNESS_URI: https://app.harness.io
HARNESS_ACCT: <+pipeline.variables.hsf_account>
HARNESS_API_KEY: <+secrets.getValue("HARNESS_API_SECRET")>
API_KEY_TYPE: SERVICE_ACCOUNT
PARENT_ID: harness_platform_management
API_KEY_ID: platform_automation
NEW_TOKEN_REFERENCE: auto_token_<+pipeline.sequenceId>
SECRET_ID: hsf_platform_api_key
SECRET_ORG_ID: Lab
UPDATE_SELF: false
steps:
- step:
type: Plugin
name: Rotate Token
identifier: Rotate_Token
spec:
connectorRef: account.harnessImage
image: harnesssolutionfactory/harness-token-rotation:latest
settings:
SWITCH: rotate
HARNESS_URI: https://app.harness.io
HARNESS_ACCT: <+pipeline.variables.hsf_account>
HARNESS_API_KEY: <+secrets.getValue("HARNESS_API_SECRET")>
API_KEY_TYPE: SERVICE_ACCOUNT
PARENT_ID: harness_platform_management
API_KEY_ID: platform_automation
TOKEN_ORG_ID: Lab
TOKEN_PROJECT_ID: workshop
NEW_TOKEN_REFERENCE: auto_token_<+pipeline.sequenceId>
SECRET_ID: hsf_platform_api_key
SECRET_ORG_ID: Lab
SECRET_PROJECT_ID: workshop
UPDATE_SELF: false
Content type
Image
Digest
sha256:30b92c6e8…
Size
66.4 MB
Last updated
1 day ago
docker pull harnesssolutionfactory/harness-token-rotation