Skip to content

Commit e70c8bc

Browse files
zimegClaude
andauthored
feat: add app_level_token_rotation_enabled setting to app manifest (#682)
Co-authored-by: Claude <svc-devxp-claude@slack-corp.com>
1 parent b519906 commit e70c8bc

2 files changed

Lines changed: 46 additions & 10 deletions

File tree

‎internal/shared/types/app_manifest.go‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,17 @@ type OAuthConfig struct {
115115
}
116116

117117
type AppSettings struct {
118-
SocketModeEnabled *bool `json:"socket_mode_enabled,omitempty" yaml:"socket_mode_enabled,omitempty"`
119-
OrgDeployEnabled *bool `json:"org_deploy_enabled,omitempty" yaml:"org_deploy_enabled,omitempty"`
120-
Interactivity *ManifestInteractivity `json:"interactivity,omitempty" yaml:"interactivity,omitempty"`
121-
IncomingWebhooks *IncomingWebhooks `json:"incoming_webhooks,omitempty" yaml:"incoming_webhooks,flow,omitempty"`
122-
EventSubscriptions *ManifestEventSubscriptions `json:"event_subscriptions,omitempty" yaml:"event_subscriptions,flow,omitempty"`
123-
AllowedIPAddressRanges []string `json:"allowed_ip_address_ranges,omitempty" yaml:"allowed_ip_address_ranges,flow,omitempty"`
124-
FunctionRuntime FunctionRuntime `json:"function_runtime,omitempty" yaml:"function_runtime,flow,omitempty"`
125-
TokenRotationEnabled *bool `json:"token_rotation_enabled,omitempty" yaml:"token_rotation_enabled,omitempty"`
126-
SiwsLinks *SiwsLinks `json:"siws_links,omitempty" yaml:"siws_links,flow,omitempty"`
127-
IsMCPEnabled *bool `json:"is_mcp_enabled,omitempty" yaml:"is_mcp_enabled,omitempty"`
118+
SocketModeEnabled *bool `json:"socket_mode_enabled,omitempty" yaml:"socket_mode_enabled,omitempty"`
119+
OrgDeployEnabled *bool `json:"org_deploy_enabled,omitempty" yaml:"org_deploy_enabled,omitempty"`
120+
Interactivity *ManifestInteractivity `json:"interactivity,omitempty" yaml:"interactivity,omitempty"`
121+
IncomingWebhooks *IncomingWebhooks `json:"incoming_webhooks,omitempty" yaml:"incoming_webhooks,flow,omitempty"`
122+
EventSubscriptions *ManifestEventSubscriptions `json:"event_subscriptions,omitempty" yaml:"event_subscriptions,flow,omitempty"`
123+
AllowedIPAddressRanges []string `json:"allowed_ip_address_ranges,omitempty" yaml:"allowed_ip_address_ranges,flow,omitempty"`
124+
FunctionRuntime FunctionRuntime `json:"function_runtime,omitempty" yaml:"function_runtime,flow,omitempty"`
125+
TokenRotationEnabled *bool `json:"token_rotation_enabled,omitempty" yaml:"token_rotation_enabled,omitempty"`
126+
AppLevelTokenRotationEnabled *bool `json:"app_level_token_rotation_enabled,omitempty" yaml:"app_level_token_rotation_enabled,omitempty"`
127+
SiwsLinks *SiwsLinks `json:"siws_links,omitempty" yaml:"siws_links,flow,omitempty"`
128+
IsMCPEnabled *bool `json:"is_mcp_enabled,omitempty" yaml:"is_mcp_enabled,omitempty"`
128129
}
129130

130131
type WorkflowStep struct {

‎internal/shared/types/app_manifest_test.go‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,41 @@ func Test_AppManifest_AppSettings_IsMCPEnabled(t *testing.T) {
355355
}
356356
}
357357

358+
func Test_AppManifest_AppSettings_AppLevelTokenRotationEnabled(t *testing.T) {
359+
truth := true
360+
tests := map[string]struct {
361+
settings *AppSettings
362+
expectedRotationValue *bool
363+
expectedJSON string
364+
}{
365+
"undefined setting has no value": {
366+
settings: &AppSettings{},
367+
expectedRotationValue: nil,
368+
expectedJSON: `{}`,
369+
},
370+
"defined setting has a value": {
371+
settings: &AppSettings{AppLevelTokenRotationEnabled: &truth},
372+
expectedRotationValue: &truth,
373+
expectedJSON: `{"app_level_token_rotation_enabled":true}`,
374+
},
375+
}
376+
for name, tc := range tests {
377+
t.Run(name, func(t *testing.T) {
378+
manifest := AppManifest{
379+
Settings: tc.settings,
380+
}
381+
if tc.settings != nil {
382+
actualJSON, err := json.Marshal(tc.settings)
383+
require.NoError(t, err)
384+
assert.Equal(t, tc.expectedJSON, string(actualJSON))
385+
assert.Equal(t, tc.expectedRotationValue, manifest.Settings.AppLevelTokenRotationEnabled)
386+
} else {
387+
assert.Nil(t, manifest.Settings)
388+
}
389+
})
390+
}
391+
}
392+
358393
func Test_AppManifest_AppSettings_IncomingWebhooks(t *testing.T) {
359394
falsity := false
360395
expectedIncomingWebhooks := IncomingWebhooks{

0 commit comments

Comments
 (0)