From bbad9bffdc9d1f4ef0ebc6d840e0770149c168da Mon Sep 17 00:00:00 2001 From: Ilija Matoski Date: Fri, 11 Oct 2024 23:44:52 +0200 Subject: [PATCH 1/4] Allow you to patch every config property as needed --- README.md | 23 ++- backend.go | 24 +-- entry_config.go | 155 +++++++++++--- entry_config_merge_test.go | 153 ++++++++++++++ entry_config_update_form_field_data_test.go | 99 +++++++++ entry_role.go | 22 +- gitlab_type.go | 2 +- gitlab_type_test.go | 2 +- go.sum | 4 - path_config.go | 189 ++++++++++-------- path_config_rotate.go | 2 +- path_config_test.go | 134 ++++++++++++- path_role.go | 10 +- path_token_role.go | 4 +- .../16.11.6/TestPathConfig_invalid_token.yaml | 62 ++++++ .../TestPathConfig_patch_a_config.yaml | 133 ++++++++++++ ...tPathConfig_patch_a_config_no_backend.yaml | 3 + ...Config_patch_a_config_with_no_storage.yaml | 3 + 18 files changed, 863 insertions(+), 161 deletions(-) create mode 100644 entry_config_merge_test.go create mode 100644 entry_config_update_form_field_data_test.go create mode 100644 testdata/fixtures/16.11.6/TestPathConfig_invalid_token.yaml create mode 100644 testdata/fixtures/16.11.6/TestPathConfig_patch_a_config.yaml create mode 100644 testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_no_backend.yaml create mode 100644 testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_with_no_storage.yaml diff --git a/README.md b/README.md index 502e0e9..dda4543 100644 --- a/README.md +++ b/README.md @@ -174,12 +174,31 @@ Key Value auto_rotate_before 48h0m0s auto_rotate_token false base_url https://gitlab.example.com -token_id 107 +token_id 1 token_expires_at 2025-03-29T00:00:00Z -token_sha1_hash 1014647cd9bbf359d926fcacdf78e184db9dbedc +token_sha1_hash 9441e6e07d77a2d5601ab5d7cac5868d358d885c type self-managed ``` +After initial setup should you wish to change any value you can do so by using the patch command for example + +```shell +$ vault patch gitlab/config type=saas auto_rotate_token=true auto_rotate_before=64h token=glpat-secret-admin-token +Key Value +--- ----- +auto_rotate_before 64h0m0s +auto_rotate_token true +base_url https://gitlab.example.com +scopes api, read_api, read_user, sudo, admin_mode, create_runner, k8s_proxy, read_repository, write_repository, ai_features, read_service_ping +token_created_at 2024-07-11T18:53:26Z +token_expires_at 2025-07-11T00:00:00Z +token_id 2 +token_sha1_hash c6e762667cadb936f0c8439b0d240661a270eba1 +type saas +``` + +All the config properties as defined above in the Config section can be patched. + You may also need to configure the Max/Default TTL for a token that can be issued by setting: Max TTL: `1 year` diff --git a/backend.go b/backend.go index bf5e690..3ef6071 100644 --- a/backend.go +++ b/backend.go @@ -93,19 +93,17 @@ func (b *Backend) periodicFunc(ctx context.Context, request *logical.Request) er var err error b.lockClientMutex.Lock() - if config, err = getConfig(ctx, request.Storage); err != nil { - b.lockClientMutex.Unlock() - return err - } - b.lockClientMutex.Unlock() - - if config == nil { - return nil - } - - // If we need to autorotate the token, initiate the procedure to autorotate the token - if config.AutoRotateToken { - err = errors.Join(err, b.checkAndRotateConfigToken(ctx, request, config)) + unlockLockClientMutex := sync.OnceFunc(func() { b.lockClientMutex.Unlock() }) + defer unlockLockClientMutex() + if config, err = getConfig(ctx, request.Storage); err == nil { + unlockLockClientMutex() + if config == nil { + return nil + } + // If we need to autorotate the token, initiate the procedure to autorotate the token + if config.AutoRotateToken { + err = errors.Join(err, b.checkAndRotateConfigToken(ctx, request, config)) + } } return err diff --git a/entry_config.go b/entry_config.go index 2069157..c17f4cc 100644 --- a/entry_config.go +++ b/entry_config.go @@ -4,25 +4,138 @@ import ( "context" "crypto/sha1" "fmt" + "strconv" "strings" "time" + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" ) type EntryConfig struct { TokenId int `json:"token_id" yaml:"token_id" mapstructure:"token_id"` BaseURL string `json:"base_url" structs:"base_url" mapstructure:"base_url"` - Token string `json:"token" structs:"token" mapstructure:"token"` + Token string `json:"token" structs:"token" mapstructure:"token" validate:"min=10,max=40"` AutoRotateToken bool `json:"auto_rotate_token" structs:"auto_rotate_token" mapstructure:"auto_rotate_token"` AutoRotateBefore time.Duration `json:"auto_rotate_before" structs:"auto_rotate_before" mapstructure:"auto_rotate_before"` TokenCreatedAt time.Time `json:"token_created_at" structs:"token_created_at" mapstructure:"token_created_at"` TokenExpiresAt time.Time `json:"token_expires_at" structs:"token_expires_at" mapstructure:"token_expires_at"` Scopes []string `json:"scopes" structs:"scopes" mapstructure:"scopes"` - Type Type `json:"type" structs:"type" mapstructure:"type"` + Type Type `json:"type" structs:"type" mapstructure:"type" validate:"gitlab-type"` } -func (e EntryConfig) Response() *logical.Response { +func (e *EntryConfig) Merge(data *framework.FieldData) (warnings []string, changes map[string]string, err error) { + var er error + if data == nil { + return warnings, changes, multierror.Append(fmt.Errorf("data: %w", ErrNilValue)) + } + + if err = data.Validate(); err != nil { + return warnings, changes, multierror.Append(err) + } + + changes = make(map[string]string) + + if val, ok := data.GetOk("auto_rotate_token"); ok { + e.AutoRotateToken = val.(bool) + changes["auto_rotate_token"] = strconv.FormatBool(e.AutoRotateToken) + } + + if typ, ok := data.GetOk("type"); ok { + var pType Type + if pType, er = TypeParse(typ.(string)); er != nil { + err = multierror.Append(err, er) + } else { + e.Type = pType + changes["type"] = pType.String() + } + } + + if _, ok := data.GetOk("auto_rotate_before"); ok { + w, er := e.updateAutoRotateBefore(data) + if er != nil { + err = multierror.Append(err, er.Errors...) + } else { + changes["auto_rotate_before"] = e.AutoRotateBefore.String() + } + warnings = append(warnings, w...) + } + + if val, ok := data.GetOk("base_url"); ok && len(val.(string)) > 0 { + e.BaseURL = val.(string) + changes["base_url"] = e.BaseURL + } + + if val, ok := data.GetOk("token"); ok && len(val.(string)) > 0 { + e.Token = val.(string) + changes["token"] = strings.Repeat("*", len(e.Token)) + } + + return warnings, changes, err +} + +func (e *EntryConfig) updateAutoRotateBefore(data *framework.FieldData) (warnings []string, err *multierror.Error) { + if val, ok := data.GetOk("auto_rotate_before"); ok { + atr, _ := convertToInt(val) + if atr > int(DefaultAutoRotateBeforeMaxTTL.Seconds()) { + err = multierror.Append(err, fmt.Errorf("auto_rotate_token can not be bigger than %s: %w", DefaultAutoRotateBeforeMaxTTL, ErrInvalidValue)) + } else if atr <= int(DefaultAutoRotateBeforeMinTTL.Seconds())-1 { + err = multierror.Append(err, fmt.Errorf("auto_rotate_token can not be less than %s: %w", DefaultAutoRotateBeforeMinTTL, ErrInvalidValue)) + } else { + e.AutoRotateBefore = time.Duration(atr) * time.Second + } + } else { + e.AutoRotateBefore = DefaultAutoRotateBeforeMinTTL + warnings = append(warnings, fmt.Sprintf("auto_rotate_token not specified setting to %s", DefaultAutoRotateBeforeMinTTL)) + } + return warnings, err +} + +func (e *EntryConfig) UpdateFromFieldData(data *framework.FieldData) (warnings []string, err error) { + if data == nil { + return warnings, multierror.Append(fmt.Errorf("data: %w", ErrNilValue)) + } + + if err = data.Validate(); err != nil { + return warnings, multierror.Append(err) + } + + var er error + e.AutoRotateToken = data.Get("auto_rotate_token").(bool) + + if token, ok := data.GetOk("token"); ok && len(token.(string)) > 0 { + e.Token = token.(string) + } else { + err = multierror.Append(err, fmt.Errorf("token: %w", ErrFieldRequired)) + } + + if typ, ok := data.GetOk("type"); ok { + if e.Type, er = TypeParse(typ.(string)); er != nil { + err = multierror.Append(err, er) + } + } else { + err = multierror.Append(err, fmt.Errorf("gitlab type: %w", ErrFieldRequired)) + } + + if baseUrl, ok := data.GetOk("base_url"); ok && len(baseUrl.(string)) > 0 { + e.BaseURL = baseUrl.(string) + } else { + err = multierror.Append(err, fmt.Errorf("base_url: %w", ErrFieldRequired)) + } + + { + w, er := e.updateAutoRotateBefore(data) + if er != nil { + err = multierror.Append(err, er.Errors...) + } + warnings = append(warnings, w...) + } + + return warnings, err +} + +func (e *EntryConfig) Response() *logical.Response { return &logical.Response{ Secret: &logical.Secret{ LeaseOptions: logical.LeaseOptions{}, @@ -35,7 +148,7 @@ func (e EntryConfig) Response() *logical.Response { } } -func (e EntryConfig) LogicalResponseData() map[string]any { +func (e *EntryConfig) LogicalResponseData() map[string]any { var tokenExpiresAt, tokenCreatedAt = "", "" if !e.TokenExpiresAt.IsZero() { tokenExpiresAt = e.TokenExpiresAt.Format(time.RFC3339) @@ -57,33 +170,25 @@ func (e EntryConfig) LogicalResponseData() map[string]any { } } -func getConfig(ctx context.Context, s logical.Storage) (*EntryConfig, error) { +func getConfig(ctx context.Context, s logical.Storage) (cfg *EntryConfig, err error) { if s == nil { return nil, fmt.Errorf("%w: local.Storage", ErrNilValue) } - entry, err := s.Get(ctx, PathConfigStorage) - if err != nil { - return nil, err + var entry *logical.StorageEntry + if entry, err = s.Get(ctx, PathConfigStorage); err == nil { + if entry == nil { + return nil, nil + } + cfg = new(EntryConfig) + _ = entry.DecodeJSON(cfg) } - - if entry == nil { - return nil, nil - } - - cfg := new(EntryConfig) - if err := entry.DecodeJSON(cfg); err != nil { - return nil, err - } - return cfg, nil + return cfg, err } -func saveConfig(ctx context.Context, config EntryConfig, s logical.Storage) error { - var err error +func saveConfig(ctx context.Context, config EntryConfig, s logical.Storage) (err error) { var storageEntry *logical.StorageEntry - storageEntry, err = logical.StorageEntryJSON(PathConfigStorage, config) - if err != nil { - return nil + if storageEntry, err = logical.StorageEntryJSON(PathConfigStorage, config); err == nil { + err = s.Put(ctx, storageEntry) } - - return s.Put(ctx, storageEntry) + return err } diff --git a/entry_config_merge_test.go b/entry_config_merge_test.go new file mode 100644 index 0000000..33ce6d3 --- /dev/null +++ b/entry_config_merge_test.go @@ -0,0 +1,153 @@ +package gitlab_test + +import ( + "testing" + "time" + + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/vault/sdk/framework" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + gitlab "github.com/ilijamt/vault-plugin-secrets-gitlab" +) + +func TestEntryConfigMerge(t *testing.T) { + t.Run("nil data", func(t *testing.T) { + e := new(gitlab.EntryConfig) + warnings, changes, err := e.Merge(nil) + require.Empty(t, warnings) + require.Empty(t, changes) + require.ErrorIs(t, err, gitlab.ErrNilValue) + }) + + t.Run("unconvertible data type", func(t *testing.T) { + e := new(gitlab.EntryConfig) + warnings, changes, err := e.Merge(&framework.FieldData{ + Raw: map[string]interface{}{"token": struct{}{}}, + Schema: gitlab.FieldSchemaConfig, + }) + require.Empty(t, warnings) + require.Empty(t, changes) + require.ErrorContains(t, err, "got unconvertible type") + }) + + var tests = []struct { + name string + originalConfig *gitlab.EntryConfig + expectedConfig *gitlab.EntryConfig + raw map[string]interface{} + warnings []string + changes map[string]string + err bool + errMap map[string]int + }{ + { + name: "update type only", + originalConfig: &gitlab.EntryConfig{Type: gitlab.TypeSelfManaged}, + expectedConfig: &gitlab.EntryConfig{Type: gitlab.TypeSaaS}, + raw: map[string]interface{}{"type": gitlab.TypeSaaS}, + changes: map[string]string{"type": gitlab.TypeSaaS.String()}, + }, + { + name: "auto rotate token set to false", + originalConfig: &gitlab.EntryConfig{}, + expectedConfig: &gitlab.EntryConfig{}, + raw: map[string]interface{}{"auto_rotate_token": false}, + changes: map[string]string{"auto_rotate_token": "false"}, + }, + { + name: "auto rotate token set to true", + originalConfig: &gitlab.EntryConfig{AutoRotateToken: false}, + expectedConfig: &gitlab.EntryConfig{AutoRotateToken: true}, + raw: map[string]interface{}{"auto_rotate_token": true}, + changes: map[string]string{"auto_rotate_token": "true"}, + }, + { + name: "update type with invalid type", + originalConfig: &gitlab.EntryConfig{Type: gitlab.TypeSelfManaged}, + expectedConfig: &gitlab.EntryConfig{Type: gitlab.TypeSelfManaged}, + raw: map[string]interface{}{"type": "test"}, + err: true, + errMap: map[string]int{ + gitlab.ErrUnknownType.Error(): 1, + }, + }, + { + name: "set base url to a non empty value", + originalConfig: &gitlab.EntryConfig{}, + expectedConfig: &gitlab.EntryConfig{BaseURL: "https://gitlab.com/"}, + raw: map[string]interface{}{"base_url": "https://gitlab.com/"}, + changes: map[string]string{"base_url": "https://gitlab.com/"}, + }, + { + name: "set base url to an empty value should fail", + originalConfig: &gitlab.EntryConfig{BaseURL: "https://gitlab.com/"}, + expectedConfig: &gitlab.EntryConfig{BaseURL: "https://gitlab.com/"}, + raw: map[string]interface{}{"base_url": ""}, + }, + + { + name: "auto rotate before invalid value lower than min", + originalConfig: &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL + time.Hour}, + expectedConfig: &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL + time.Hour}, + raw: map[string]interface{}{"auto_rotate_before": "1h"}, + err: true, + errMap: map[string]int{gitlab.ErrInvalidValue.Error(): 1}, + }, + { + name: "auto rotate before invalid value higher than min", + originalConfig: &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL + time.Hour}, + expectedConfig: &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL + time.Hour}, + raw: map[string]interface{}{"auto_rotate_before": (gitlab.DefaultAutoRotateBeforeMaxTTL + time.Hour).String()}, + err: true, + errMap: map[string]int{gitlab.ErrInvalidValue.Error(): 1}, + }, + { + name: "auto rotate with a valid value", + originalConfig: &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL + time.Hour}, + expectedConfig: &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL + time.Hour*2}, + raw: map[string]interface{}{"auto_rotate_before": (gitlab.DefaultAutoRotateBeforeMinTTL + time.Hour*2).String()}, + err: false, + changes: map[string]string{"auto_rotate_before": "26h0m0s"}, + }, + { + name: "token a valid value", + originalConfig: &gitlab.EntryConfig{Token: "token1"}, + expectedConfig: &gitlab.EntryConfig{Token: "token"}, + raw: map[string]interface{}{"token": "token"}, + err: false, + changes: map[string]string{"token": "*****"}, + }, + { + name: "token an empty value", + originalConfig: &gitlab.EntryConfig{Token: "token"}, + expectedConfig: &gitlab.EntryConfig{Token: "token"}, + raw: map[string]interface{}{"token": ""}, + err: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + warnings, changes, err := test.originalConfig.Merge(&framework.FieldData{ + Raw: test.raw, + Schema: gitlab.FieldSchemaConfig, + }) + assert.EqualValues(t, test.warnings, warnings) + if test.changes == nil { + test.changes = make(map[string]string) + } + assert.EqualValues(t, test.changes, changes) + assert.EqualValues(t, test.expectedConfig, test.originalConfig) + if test.err { + assert.Error(t, err) + if len(test.errMap) > 0 { + assert.EqualValues(t, countErrByName(err.(*multierror.Error)), test.errMap) + } + } else { + assert.NoError(t, err) + } + }) + } +} diff --git a/entry_config_update_form_field_data_test.go b/entry_config_update_form_field_data_test.go new file mode 100644 index 0000000..0497f8c --- /dev/null +++ b/entry_config_update_form_field_data_test.go @@ -0,0 +1,99 @@ +package gitlab_test + +import ( + "testing" + + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/vault/sdk/framework" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + gitlab "github.com/ilijamt/vault-plugin-secrets-gitlab" +) + +func TestEntryConfigUpdateFromFieldData(t *testing.T) { + t.Run("nil data", func(t *testing.T) { + e := new(gitlab.EntryConfig) + _, err := e.UpdateFromFieldData(nil) + require.ErrorIs(t, err, gitlab.ErrNilValue) + }) + + var tests = []struct { + name string + raw map[string]interface{} + expectedConfig *gitlab.EntryConfig + warnings []string + err bool + errMap map[string]int + }{ + { + name: "no data should fail", + raw: map[string]interface{}{}, + err: true, + warnings: []string{"auto_rotate_token not specified setting to 24h0m0s"}, + errMap: map[string]int{ + gitlab.ErrFieldRequired.Error(): 3, + }, + }, + { + name: "empty token and invalid type", + raw: map[string]interface{}{ + "base_url": "https://gitlab.com", + "type": "type", + }, + expectedConfig: &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL, BaseURL: "https://gitlab.com"}, + warnings: []string{"auto_rotate_token not specified setting to 24h0m0s"}, + err: true, + errMap: map[string]int{ + gitlab.ErrFieldRequired.Error(): 1, + gitlab.ErrUnknownType.Error(): 1, + }, + }, + { + name: "unconvertible data type", + expectedConfig: &gitlab.EntryConfig{}, + raw: map[string]interface{}{ + "token": struct{}{}, + }, + err: true, + errMap: map[string]int{}, + }, + { + name: "valid config", + expectedConfig: &gitlab.EntryConfig{ + Token: "token", + Type: gitlab.TypeSelfManaged, + AutoRotateToken: false, + AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL, + BaseURL: "https://gitlab.com", + }, + warnings: []string{"auto_rotate_token not specified setting to 24h0m0s"}, + raw: map[string]interface{}{ + "token": "token", + "type": gitlab.TypeSelfManaged.String(), + "base_url": "https://gitlab.com", + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + e := new(gitlab.EntryConfig) + assert.Empty(t, e) + warnings, err := e.UpdateFromFieldData(&framework.FieldData{Raw: test.raw, Schema: gitlab.FieldSchemaConfig}) + assert.Equal(t, test.warnings, warnings) + if test.expectedConfig == nil { + test.expectedConfig = &gitlab.EntryConfig{AutoRotateBefore: gitlab.DefaultAutoRotateBeforeMinTTL} + } + assert.EqualValues(t, test.expectedConfig, e) + if test.err { + assert.Error(t, err) + if len(test.errMap) > 0 { + assert.Equal(t, countErrByName(err.(*multierror.Error)), test.errMap) + } + } else { + assert.NoError(t, err) + } + }) + } +} diff --git a/entry_role.go b/entry_role.go index 7ef9e61..4687e0b 100644 --- a/entry_role.go +++ b/entry_role.go @@ -34,19 +34,15 @@ func (e EntryRole) LogicalResponseData() map[string]any { } } -func getRole(ctx context.Context, name string, s logical.Storage) (*EntryRole, error) { - entry, err := s.Get(ctx, fmt.Sprintf("%s/%s", PathRoleStorage, name)) - if err != nil { - return nil, err +func getRole(ctx context.Context, name string, s logical.Storage) (role *EntryRole, err error) { + var entry *logical.StorageEntry + if entry, err = s.Get(ctx, fmt.Sprintf("%s/%s", PathRoleStorage, name)); err == nil { + if entry == nil { + return nil, nil + } + role = new(EntryRole) + _ = entry.DecodeJSON(role) } + return role, err - if entry == nil { - return nil, nil - } - - role := new(EntryRole) - if err := entry.DecodeJSON(role); err != nil { - return nil, err - } - return role, nil } diff --git a/gitlab_type.go b/gitlab_type.go index f103ccb..c8c998e 100644 --- a/gitlab_type.go +++ b/gitlab_type.go @@ -21,7 +21,7 @@ var ( validGitlabTypes = []string{ TypeSaaS.String(), TypeSelfManaged.String(), - // TypeDedicated.String(), + TypeDedicated.String(), } ) diff --git a/gitlab_type_test.go b/gitlab_type_test.go index c5b5eb2..8f04b21 100644 --- a/gitlab_type_test.go +++ b/gitlab_type_test.go @@ -27,7 +27,7 @@ func TestType(t *testing.T) { { expected: gitlab.TypeDedicated, input: gitlab.TypeDedicated.String(), - err: true, + err: false, }, { expected: gitlab.TypeUnknown, diff --git a/go.sum b/go.sum index fa67e2d..c6dda80 100644 --- a/go.sum +++ b/go.sum @@ -334,10 +334,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/dnaeon/go-vcr.v4 v4.0.1 h1:dIFuOqqDZIJ9BTcK+DXmElzypQ6PV9fBQZSIwY+J1yM= -gopkg.in/dnaeon/go-vcr.v4 v4.0.1/go.mod h1:65yxh9goQVrudqofKtHA4JNFWd6XZRkWfKN4YpMx7KI= -gopkg.in/dnaeon/go-vcr.v4 v4.0.2-0.20241010085657-e544a7e468e5 h1:3Jec1lOXw4aVJvrbWc0wqeDjmlZJOibp/AAiqvIqQGc= -gopkg.in/dnaeon/go-vcr.v4 v4.0.2-0.20241010085657-e544a7e468e5/go.mod h1:65yxh9goQVrudqofKtHA4JNFWd6XZRkWfKN4YpMx7KI= gopkg.in/dnaeon/go-vcr.v4 v4.0.2-0.20241011125548-e0eabf67b136 h1:7pmtnz32uO55UeO2PHUTukG8FybY6tJ94WRa3B9t+Q4= gopkg.in/dnaeon/go-vcr.v4 v4.0.2-0.20241011125548-e0eabf67b136/go.mod h1:65yxh9goQVrudqofKtHA4JNFWd6XZRkWfKN4YpMx7KI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/path_config.go b/path_config.go index 9bc356c..b117908 100644 --- a/path_config.go +++ b/path_config.go @@ -8,7 +8,6 @@ import ( "strings" "time" - "github.com/hashicorp/go-multierror" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" ) @@ -18,7 +17,7 @@ const ( ) var ( - fieldSchemaConfig = map[string]*framework.FieldSchema{ + FieldSchemaConfig = map[string]*framework.FieldSchema{ "token": { Type: framework.TypeString, Description: "The API access token required for authenticating requests to the GitLab API. This token must be a valid personal access token or any other type of token supported by GitLab for API access.", @@ -69,103 +68,95 @@ var ( ) func (b *Backend) pathConfigDelete(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) { - b.lockClientMutex.RLock() - defer b.lockClientMutex.RUnlock() - - config, err := getConfig(ctx, req.Storage) - if err != nil { - return nil, err - } + b.lockClientMutex.Lock() + defer b.lockClientMutex.Unlock() + var err error - if config == nil { - return logical.ErrorResponse(ErrBackendNotConfigured.Error()), nil - } + if config, err := getConfig(ctx, req.Storage); err == nil { + if config == nil { + return logical.ErrorResponse(ErrBackendNotConfigured.Error()), nil + } - if err = req.Storage.Delete(ctx, PathConfigStorage); err != nil { - return nil, err + if err = req.Storage.Delete(ctx, PathConfigStorage); err == nil { + event(ctx, b.Backend, "config-delete", map[string]string{ + "path": "config", + }) + b.SetClient(nil) + } } - event(ctx, b.Backend, "config-delete", map[string]string{ - "path": "config", - }) - - return nil, nil + return nil, err } -func (b *Backend) pathConfigRead(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) { +func (b *Backend) pathConfigRead(ctx context.Context, req *logical.Request, data *framework.FieldData) (lResp *logical.Response, err error) { b.lockClientMutex.RLock() defer b.lockClientMutex.RUnlock() - config, err := getConfig(ctx, req.Storage) - if err != nil { - return nil, err - } - - if config == nil { - return logical.ErrorResponse(ErrBackendNotConfigured.Error()), nil + var config *EntryConfig + if config, err = getConfig(ctx, req.Storage); err == nil { + if config == nil { + return logical.ErrorResponse(ErrBackendNotConfigured.Error()), nil + } + lrd := config.LogicalResponseData() + b.Logger().Debug("Reading configuration info", "info", lrd) + lResp = &logical.Response{Data: config.LogicalResponseData()} } - - lrd := config.LogicalResponseData() - b.Logger().Debug("Reading configuration info", "info", lrd) - return &logical.Response{ - Data: config.LogicalResponseData(), - }, nil + return lResp, err } -func (b *Backend) pathConfigWrite(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) { +func (b *Backend) pathConfigPatch(ctx context.Context, req *logical.Request, data *framework.FieldData) (lResp *logical.Response, err error) { var warnings []string - var autoTokenRotateRaw, autoTokenRotateTtlOk = data.GetOk("auto_rotate_before") - var token, tokenOk = data.GetOk("token") - var gitlabType, gitlabTypeOk = data.GetOk("type") - var err error - - if !tokenOk { - err = multierror.Append(err, fmt.Errorf("token: %w", ErrFieldRequired)) + var changes = make(map[string]string) + var config *EntryConfig + config, err = getConfig(ctx, req.Storage) + if err != nil { + return nil, err } - - if !gitlabTypeOk { - err = multierror.Append(err, fmt.Errorf("gitlab type: %w", ErrFieldRequired)) + if config == nil { + return logical.ErrorResponse(ErrBackendNotConfigured.Error()), nil } - var config = EntryConfig{ - BaseURL: data.Get("base_url").(string), - AutoRotateToken: data.Get("auto_rotate_token").(bool), + warnings, changes, err = config.Merge(data) + if err != nil { + return nil, err } - if autoTokenRotateTtlOk { - atr, _ := convertToInt(autoTokenRotateRaw) - if atr > int(DefaultAutoRotateBeforeMaxTTL.Seconds()) { - err = multierror.Append(err, fmt.Errorf("auto_rotate_token can not be bigger than %s: %w", DefaultAutoRotateBeforeMaxTTL, ErrInvalidValue)) - } else if atr <= int(DefaultAutoRotateBeforeMinTTL.Seconds())-1 { - err = multierror.Append(err, fmt.Errorf("auto_rotate_token can not be less than %s: %w", DefaultAutoRotateBeforeMinTTL, ErrInvalidValue)) - } else { - config.AutoRotateBefore = time.Duration(atr) * time.Second + if _, ok := data.GetOk("token"); ok { + var et *EntryToken + if err = b.updateConfigClientInfo(ctx, et, config); err != nil { + return nil, err } - } else { - config.AutoRotateBefore = DefaultAutoRotateBeforeMinTTL - warnings = append(warnings, fmt.Sprintf("auto_rotate_token not specified setting to %s", DefaultAutoRotateBeforeMinTTL)) } - if err != nil { - return nil, err + b.lockClientMutex.Lock() + defer b.lockClientMutex.Unlock() + if err = saveConfig(ctx, *config, req.Storage); err == nil { + lrd := config.LogicalResponseData() + event(ctx, b.Backend, "config-patch", changes) + b.SetClient(nil) + b.Logger().Debug("Patched config", "lrd", lrd, "warnings", warnings) + lResp = &logical.Response{Data: lrd, Warnings: warnings} } - config.Token = token.(string) - config.Type = Type(gitlabType.(string)) + return lResp, err +} + +func (b *Backend) updateConfigClientInfo(ctx context.Context, et *EntryToken, config *EntryConfig) (err error) { var httpClient *http.Client var client Client httpClient, _ = HttpClientFromContext(ctx) if client, _ = GitlabClientFromContext(ctx); client == nil { - if client, err = NewGitlabClient(&config, httpClient, b.Logger()); err == nil { + if client, err = NewGitlabClient(config, httpClient, b.Logger()); err == nil { b.SetClient(client) } + } else { + b.SetClient(client) } - var et *EntryToken et, err = client.CurrentTokenInfo() if err != nil { - return nil, fmt.Errorf("token cannot be validated: %s", ErrInvalidValue) + return fmt.Errorf("token cannot be validated: %s", ErrInvalidValue) } config.TokenCreatedAt = *et.CreatedAt @@ -173,33 +164,45 @@ func (b *Backend) pathConfigWrite(ctx context.Context, req *logical.Request, dat config.TokenId = et.TokenID config.Scopes = et.Scopes - b.lockClientMutex.Lock() - defer b.lockClientMutex.Unlock() - err = saveConfig(ctx, config, req.Storage) + return nil +} + +func (b *Backend) pathConfigWrite(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) { + var config = new(EntryConfig) + var warnings, err = config.UpdateFromFieldData(data) if err != nil { return nil, err } - event(ctx, b.Backend, "config-write", map[string]string{ - "path": "config", - "auto_rotate_token": strconv.FormatBool(config.AutoRotateToken), - "auto_rotate_before": config.AutoRotateBefore.String(), - "base_url": config.BaseURL, - "token_id": strconv.Itoa(config.TokenId), - "created_at": config.TokenCreatedAt.Format(time.RFC3339), - "expires_at": config.TokenExpiresAt.Format(time.RFC3339), - "scopes": strings.Join(config.Scopes, ", "), - "type": config.Type.String(), - }) + var et *EntryToken + if err = b.updateConfigClientInfo(ctx, et, config); err != nil { + return nil, err + } - b.SetClient(nil) - lrd := config.LogicalResponseData() - b.Logger().Debug("Wrote new config", "lrd", lrd, "warnings", warnings) - return &logical.Response{ - Data: lrd, - Warnings: warnings, - }, nil + b.lockClientMutex.Lock() + defer b.lockClientMutex.Unlock() + var lResp *logical.Response + + if err = saveConfig(ctx, *config, req.Storage); err == nil { + event(ctx, b.Backend, "config-write", map[string]string{ + "path": "config", + "auto_rotate_token": strconv.FormatBool(config.AutoRotateToken), + "auto_rotate_before": config.AutoRotateBefore.String(), + "base_url": config.BaseURL, + "token_id": strconv.Itoa(config.TokenId), + "created_at": config.TokenCreatedAt.Format(time.RFC3339), + "expires_at": config.TokenExpiresAt.Format(time.RFC3339), + "scopes": strings.Join(config.Scopes, ", "), + "type": config.Type.String(), + }) + + b.SetClient(nil) + lrd := config.LogicalResponseData() + b.Logger().Debug("Wrote new config", "lrd", lrd, "warnings", warnings) + lResp = &logical.Response{Data: lrd, Warnings: warnings} + } + return lResp, err } func pathConfig(b *Backend) *framework.Path { @@ -207,11 +210,21 @@ func pathConfig(b *Backend) *framework.Path { HelpSynopsis: strings.TrimSpace(pathConfigHelpSynopsis), HelpDescription: strings.TrimSpace(pathConfigHelpDescription), Pattern: fmt.Sprintf("%s$", PathConfigStorage), - Fields: fieldSchemaConfig, + Fields: FieldSchemaConfig, DisplayAttrs: &framework.DisplayAttributes{ OperationPrefix: operationPrefixGitlabAccessTokens, }, Operations: map[logical.Operation]framework.OperationHandler{ + logical.PatchOperation: &framework.PathOperation{ + Callback: b.pathConfigPatch, + DisplayAttrs: &framework.DisplayAttributes{OperationVerb: "configure"}, + Summary: "Configure Backend level settings that are applied to all credentials.", + Responses: map[int][]framework.Response{ + http.StatusNoContent: {{ + Description: http.StatusText(http.StatusNoContent), + }}, + }, + }, logical.UpdateOperation: &framework.PathOperation{ Callback: b.pathConfigWrite, DisplayAttrs: &framework.DisplayAttributes{OperationVerb: "configure"}, @@ -232,7 +245,7 @@ func pathConfig(b *Backend) *framework.Path { Responses: map[int][]framework.Response{ http.StatusOK: {{ Description: http.StatusText(http.StatusOK), - Fields: fieldSchemaConfig, + Fields: FieldSchemaConfig, }}, }, }, diff --git a/path_config_rotate.go b/path_config_rotate.go index f96daa2..18b47f8 100644 --- a/path_config_rotate.go +++ b/path_config_rotate.go @@ -16,7 +16,7 @@ func pathConfigTokenRotate(b *Backend) *framework.Path { HelpSynopsis: strings.TrimSpace(pathConfigHelpSynopsis), HelpDescription: strings.TrimSpace(pathConfigHelpDescription), Pattern: fmt.Sprintf("%s/rotate$", PathConfigStorage), - Fields: fieldSchemaConfig, + Fields: FieldSchemaConfig, DisplayAttrs: &framework.DisplayAttributes{ OperationPrefix: operationPrefixGitlabAccessTokens, }, diff --git a/path_config_test.go b/path_config_test.go index c7fbe17..5c5aeaa 100644 --- a/path_config_test.go +++ b/path_config_test.go @@ -93,13 +93,32 @@ func TestPathConfig(t *testing.T) { require.Error(t, resp.Error()) events.expectEvents(t, []expectedEvent{ - { - eventType: "gitlab/config-write", - }, - { - eventType: "gitlab/config-delete", + {eventType: "gitlab/config-write"}, + {eventType: "gitlab/config-delete"}, + }) + }) + + t.Run("invalid token", func(t *testing.T) { + httpClient, url := getClient(t) + ctx := gitlab.HttpClientNewContext(context.Background(), httpClient) + + b, l, events, err := getBackendWithEvents(ctx) + require.NoError(t, err) + + resp, err := b.HandleRequest(ctx, &logical.Request{ + Operation: logical.UpdateOperation, + Path: gitlab.PathConfigStorage, Storage: l, + Data: map[string]any{ + "token": "invalid-token", + "base_url": url, + "type": gitlab.TypeSelfManaged.String(), }, }) + + require.Error(t, err) + require.Nil(t, resp) + + events.expectEvents(t, []expectedEvent{}) }) t.Run("missing token from the request", func(t *testing.T) { @@ -117,7 +136,110 @@ func TestPathConfig(t *testing.T) { require.Nil(t, resp) var errorMap = countErrByName(err.(*multierror.Error)) - assert.EqualValues(t, 2, errorMap[gitlab.ErrFieldRequired.Error()]) + assert.EqualValues(t, 3, errorMap[gitlab.ErrFieldRequired.Error()]) require.Len(t, errorMap, 1) }) + + t.Run("patch a config with no storage", func(t *testing.T) { + httpClient, url := getClient(t) + ctx := gitlab.HttpClientNewContext(context.Background(), httpClient) + + b, _, err := getBackend(ctx) + require.NoError(t, err) + + resp, err := b.HandleRequest(ctx, &logical.Request{ + Operation: logical.PatchOperation, + Path: gitlab.PathConfigStorage, Storage: nil, + Data: map[string]any{ + "token": "glpat-secret-random-token", + "base_url": url, + "type": gitlab.TypeSelfManaged.String(), + }, + }) + + require.ErrorIs(t, err, gitlab.ErrNilValue) + require.Nil(t, resp) + }) + + t.Run("patch a config no backend", func(t *testing.T) { + httpClient, url := getClient(t) + ctx := gitlab.HttpClientNewContext(context.Background(), httpClient) + + b, l, err := getBackend(ctx) + require.NoError(t, err) + + resp, err := b.HandleRequest(ctx, &logical.Request{ + Operation: logical.PatchOperation, + Path: gitlab.PathConfigStorage, Storage: l, + Data: map[string]any{ + "token": "glpat-secret-random-token", + "base_url": url, + "type": gitlab.TypeSelfManaged.String(), + }, + }) + + require.NoError(t, err) + require.NotNil(t, resp) + require.EqualValues(t, resp.Error(), gitlab.ErrBackendNotConfigured) + }) + + t.Run("patch a config", func(t *testing.T) { + httpClient, url := getClient(t) + ctx := gitlab.HttpClientNewContext(context.Background(), httpClient) + + b, l, events, err := getBackendWithEvents(ctx) + require.NoError(t, err) + + resp, err := b.HandleRequest(ctx, &logical.Request{ + Operation: logical.UpdateOperation, + Path: gitlab.PathConfigStorage, Storage: l, + Data: map[string]any{ + "token": "glpat-secret-random-token", + "base_url": url, + "type": gitlab.TypeSelfManaged.String(), + }, + }) + + require.NoError(t, err) + require.NotNil(t, resp) + require.NoError(t, resp.Error()) + + resp, err = b.HandleRequest(ctx, &logical.Request{ + Operation: logical.ReadOperation, + Path: gitlab.PathConfigStorage, Storage: l, + }) + + require.NoError(t, err) + require.NotNil(t, resp) + require.NoError(t, resp.Error()) + tokenOriginalSha1Hash := resp.Data["token_sha1_hash"].(string) + require.NotEmpty(t, tokenOriginalSha1Hash) + require.Equal(t, gitlab.TypeSelfManaged.String(), resp.Data["type"]) + require.NotNil(t, b.GetClient().GitlabClient()) + + resp, err = b.HandleRequest(ctx, &logical.Request{ + Operation: logical.PatchOperation, + Path: gitlab.PathConfigStorage, Storage: l, + Data: map[string]interface{}{ + "type": gitlab.TypeSaaS.String(), + "token": "glpat-secret-admin-token", + }, + }) + require.NoError(t, err) + require.NotNil(t, resp) + require.NoError(t, resp.Error()) + tokenNewSha1Hash := resp.Data["token_sha1_hash"].(string) + require.NotEmpty(t, tokenNewSha1Hash) + require.NotEqual(t, tokenOriginalSha1Hash, tokenNewSha1Hash) + + require.Equal(t, gitlab.TypeSaaS.String(), resp.Data["type"]) + require.NotNil(t, b.GetClient().GitlabClient()) + + events.expectEvents(t, []expectedEvent{ + {eventType: "gitlab/config-write"}, + {eventType: "gitlab/config-patch"}, + }) + + }) + } diff --git a/path_role.go b/path_role.go index dfb5ec7..be57641 100644 --- a/path_role.go +++ b/path_role.go @@ -22,7 +22,7 @@ const ( ) var ( - fieldSchemaRoles = map[string]*framework.FieldSchema{ + FieldSchemaRoles = map[string]*framework.FieldSchema{ "role_name": { Type: framework.TypeString, Description: "Role name", @@ -131,7 +131,7 @@ func pathListRoles(b *Backend) *framework.Path { http.StatusOK: {{ Description: http.StatusText(http.StatusOK), Fields: map[string]*framework.FieldSchema{ - "role_name": fieldSchemaRoles["role_name"], + "role_name": FieldSchemaRoles["role_name"], }, }}, }, @@ -270,7 +270,7 @@ func (b *Backend) pathRolesWrite(ctx context.Context, req *logical.Request, data } // check if all required fields are set - for name, field := range fieldSchemaRoles { + for name, field := range FieldSchemaRoles { if slices.Contains(skipFields, name) { continue } @@ -378,7 +378,7 @@ func pathRoles(b *Backend) *framework.Path { HelpSynopsis: strings.TrimSpace(pathRolesHelpSyn), HelpDescription: strings.TrimSpace(pathRolesHelpDesc), Pattern: fmt.Sprintf("%s/%s", PathRoleStorage, framework.GenericNameWithAtRegex("role_name")), - Fields: fieldSchemaRoles, + Fields: FieldSchemaRoles, DisplayAttrs: &framework.DisplayAttributes{ OperationPrefix: operationPrefixGitlabAccessTokens, OperationSuffix: "role", @@ -419,7 +419,7 @@ func pathRoles(b *Backend) *framework.Path { Description: http.StatusText(http.StatusNotFound), }}, http.StatusOK: {{ - Fields: fieldSchemaRoles, + Fields: FieldSchemaRoles, }}, }, }, diff --git a/path_token_role.go b/path_token_role.go index a97c830..21990e0 100644 --- a/path_token_role.go +++ b/path_token_role.go @@ -23,7 +23,7 @@ whose parameters are used to generate an access token based on a predefined role ) var ( - fieldSchemaTokenRole = map[string]*framework.FieldSchema{ + FieldSchemaTokenRole = map[string]*framework.FieldSchema{ "role_name": { Type: framework.TypeString, Description: "Role name", @@ -157,7 +157,7 @@ func pathTokenRoles(b *Backend) *framework.Path { HelpSynopsis: strings.TrimSpace(pathTokenRolesHelpSyn), HelpDescription: strings.TrimSpace(pathTokenRolesHelpDesc), Pattern: fmt.Sprintf("%s/%s", PathTokenRoleStorage, framework.GenericNameWithAtRegex("role_name")), - Fields: fieldSchemaTokenRole, + Fields: FieldSchemaTokenRole, DisplayAttrs: &framework.DisplayAttributes{ OperationPrefix: operationPrefixGitlabAccessTokens, OperationSuffix: "generate", diff --git a/testdata/fixtures/16.11.6/TestPathConfig_invalid_token.yaml b/testdata/fixtures/16.11.6/TestPathConfig_invalid_token.yaml new file mode 100644 index 0000000..6477852 --- /dev/null +++ b/testdata/fixtures/16.11.6/TestPathConfig_invalid_token.yaml @@ -0,0 +1,62 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 30 + uncompressed: false + body: '{"message":"401 Unauthorized"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Length: + - "30" + Content-Type: + - application/json + Date: + - Fri, 11 Oct 2024 20:05:33 GMT + Server: + - nginx + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01J9YJZF6AR8JEMZ5QHRQE3YHJ","version":"1"}' + X-Request-Id: + - 01J9YJZF6AR8JEMZ5QHRQE3YHJ + X-Runtime: + - "0.071607" + status: 401 Unauthorized + code: 401 + duration: 92.349083ms diff --git a/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config.yaml b/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config.yaml new file mode 100644 index 0000000..72fc53b --- /dev/null +++ b/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config.yaml @@ -0,0 +1,133 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":1,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:26.792Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":1,"last_used_at":"2024-10-11T21:24:01.214Z","active":true,"expires_at":"2025-07-11"}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Fri, 11 Oct 2024 21:29:41 GMT + Etag: + - W/"083925b09d4956ac797ea0970dfc7f50" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01J9YQSGDQPHF7WDQDZCRGN8PD","version":"1"}' + X-Request-Id: + - 01J9YQSGDQPHF7WDQDZCRGN8PD + X-Runtime: + - "0.028470" + status: 200 OK + code: 200 + duration: 36.183166ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-11T21:27:47.430Z","active":true,"expires_at":"2025-07-11"}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Fri, 11 Oct 2024 21:29:41 GMT + Etag: + - W/"63975863f113ecc7a6091cb11877af93" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01J9YQSGFZ23C14W5MYJ6R3RHB","version":"1"}' + X-Request-Id: + - 01J9YQSGFZ23C14W5MYJ6R3RHB + X-Runtime: + - "0.011879" + status: 200 OK + code: 200 + duration: 14.551916ms diff --git a/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_no_backend.yaml b/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_no_backend.yaml new file mode 100644 index 0000000..2797c38 --- /dev/null +++ b/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_no_backend.yaml @@ -0,0 +1,3 @@ +--- +version: 2 +interactions: [] diff --git a/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_with_no_storage.yaml b/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_with_no_storage.yaml new file mode 100644 index 0000000..2797c38 --- /dev/null +++ b/testdata/fixtures/16.11.6/TestPathConfig_patch_a_config_with_no_storage.yaml @@ -0,0 +1,3 @@ +--- +version: 2 +interactions: [] From 8ab574ac4a99e19ff8ed926ec927185256c75d2e Mon Sep 17 00:00:00 2001 From: Ilija Matoski Date: Fri, 11 Oct 2024 23:48:54 +0200 Subject: [PATCH 2/4] Fixed golangci-lint issues --- path_config.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/path_config.go b/path_config.go index b117908..11ac048 100644 --- a/path_config.go +++ b/path_config.go @@ -106,7 +106,7 @@ func (b *Backend) pathConfigRead(ctx context.Context, req *logical.Request, data func (b *Backend) pathConfigPatch(ctx context.Context, req *logical.Request, data *framework.FieldData) (lResp *logical.Response, err error) { var warnings []string - var changes = make(map[string]string) + var changes map[string]string var config *EntryConfig config, err = getConfig(ctx, req.Storage) if err != nil { @@ -122,8 +122,7 @@ func (b *Backend) pathConfigPatch(ctx context.Context, req *logical.Request, dat } if _, ok := data.GetOk("token"); ok { - var et *EntryToken - if err = b.updateConfigClientInfo(ctx, et, config); err != nil { + if _, err = b.updateConfigClientInfo(ctx, config); err != nil { return nil, err } } @@ -142,7 +141,7 @@ func (b *Backend) pathConfigPatch(ctx context.Context, req *logical.Request, dat } -func (b *Backend) updateConfigClientInfo(ctx context.Context, et *EntryToken, config *EntryConfig) (err error) { +func (b *Backend) updateConfigClientInfo(ctx context.Context, config *EntryConfig) (et *EntryToken, err error) { var httpClient *http.Client var client Client httpClient, _ = HttpClientFromContext(ctx) @@ -156,7 +155,7 @@ func (b *Backend) updateConfigClientInfo(ctx context.Context, et *EntryToken, co et, err = client.CurrentTokenInfo() if err != nil { - return fmt.Errorf("token cannot be validated: %s", ErrInvalidValue) + return et, fmt.Errorf("token cannot be validated: %s", ErrInvalidValue) } config.TokenCreatedAt = *et.CreatedAt @@ -164,7 +163,7 @@ func (b *Backend) updateConfigClientInfo(ctx context.Context, et *EntryToken, co config.TokenId = et.TokenID config.Scopes = et.Scopes - return nil + return et, nil } func (b *Backend) pathConfigWrite(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) { @@ -174,8 +173,7 @@ func (b *Backend) pathConfigWrite(ctx context.Context, req *logical.Request, dat return nil, err } - var et *EntryToken - if err = b.updateConfigClientInfo(ctx, et, config); err != nil { + if _, err = b.updateConfigClientInfo(ctx, config); err != nil { return nil, err } From 1aed48519d6648fc295650dabcda953516e78018 Mon Sep 17 00:00:00 2001 From: Ilija Matoski Date: Fri, 11 Oct 2024 23:55:28 +0200 Subject: [PATCH 3/4] Removed unnecesseary SetClient --- path_config.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/path_config.go b/path_config.go index 11ac048..2f3983e 100644 --- a/path_config.go +++ b/path_config.go @@ -149,8 +149,6 @@ func (b *Backend) updateConfigClientInfo(ctx context.Context, config *EntryConfi if client, err = NewGitlabClient(config, httpClient, b.Logger()); err == nil { b.SetClient(client) } - } else { - b.SetClient(client) } et, err = client.CurrentTokenInfo() From 1861aa915f9886b976bb2e4f48bf4ced870a4db9 Mon Sep 17 00:00:00 2001 From: Ilija Matoski Date: Sat, 12 Oct 2024 09:14:13 +0200 Subject: [PATCH 4/4] Regenerate the test data --- ...abClient_CreateAccessToken_And_Revoke.yaml | 92 ++++++------ .../TestGitlabClient_RotateCurrentToken.yaml | 44 +++--- ...User_PAT_AdminUser_GitlabRevokesToken.yaml | 68 ++++----- ...nUser_PAT_AdminUser_VaultRevokesToken.yaml | 80 +++++----- .../TestWithGitlabUser_RotateToken.yaml | 138 +++++++++--------- .../16.11.6/TestWithNormalUser_GAT.yaml | 66 ++++----- .../TestWithNormalUser_PersonalAT_Fails.yaml | 36 ++--- .../16.11.6/TestWithNormalUser_ProjectAT.yaml | 74 +++++----- .../16.11.6/TestWithServiceAccountGroup.yaml | 104 ++++++------- .../16.11.6/TestWithServiceAccountUser.yaml | 104 ++++++------- 10 files changed, 403 insertions(+), 403 deletions(-) diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml index 0ad1698..0d52b31 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml @@ -12,7 +12,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","scopes":["read_api"],"access_level":10,"expires_at":"2024-10-11"}' + body: '{"name":"name","scopes":["read_api"],"access_level":10,"expires_at":"2024-10-12"}' form: {} headers: Accept: @@ -31,22 +31,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 229 + content_length: 230 uncompressed: false - body: '{"id":43,"name":"name","revoked":false,"created_at":"2024-10-11T09:11:08.621Z","scopes":["read_api"],"user_id":4,"last_used_at":null,"active":false,"expires_at":"2024-10-11","access_level":10,"token":"glpat-7gPvN2gvCyq-Tx_ddK7q"}' + body: '{"id":57,"name":"name","revoked":false,"created_at":"2024-10-12T07:06:07.977Z","scopes":["read_api"],"user_id":15,"last_used_at":null,"active":false,"expires_at":"2024-10-12","access_level":10,"token":"glpat-_qFUvELnkVDX7y82uE3m"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "229" + - "230" Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:08 GMT + - Sat, 12 Oct 2024 07:06:08 GMT Etag: - - W/"bdbca0c111da4ae4762614bc316c33ec" + - W/"bb3712a091f99d106128bd2b2feefa08" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -60,14 +60,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH697PGW1P1YEMAVBHG3P","version":"1"}' + - '{"correlation_id":"01J9ZRS0C4VPX3E7RPV7D1D5XD","version":"1"}' X-Request-Id: - - 01J9XDH697PGW1P1YEMAVBHG3P + - 01J9ZRS0C4VPX3E7RPV7D1D5XD X-Runtime: - - "0.300631" + - "0.383336" status: 201 Created code: 201 - duration: 304.176541ms + duration: 394.514167ms - id: 1 request: proto: HTTP/1.1 @@ -88,7 +88,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/groups/example/access_tokens/43 + url: http://localhost:8080/api/v4/groups/example/access_tokens/57 method: DELETE response: proto: HTTP/1.1 @@ -105,7 +105,7 @@ interactions: Connection: - keep-alive Date: - - Fri, 11 Oct 2024 09:11:09 GMT + - Sat, 12 Oct 2024 07:06:08 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -119,14 +119,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH6W8XXEXXY5JMY2TKTFC","version":"1"}' + - '{"correlation_id":"01J9ZRS14PEHCNN4H5W2G6J5ZG","version":"1"}' X-Request-Id: - - 01J9XDH6W8XXEXXY5JMY2TKTFC + - 01J9ZRS14PEHCNN4H5W2G6J5ZG X-Runtime: - - "0.101757" + - "0.251326" status: 204 No Content code: 204 - duration: 105.912208ms + duration: 260.777417ms - id: 2 request: proto: HTTP/1.1 @@ -138,7 +138,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","scopes":["read_api"],"access_level":30,"expires_at":"2024-10-11"}' + body: '{"name":"name","scopes":["read_api"],"access_level":30,"expires_at":"2024-10-12"}' form: {} headers: Accept: @@ -157,22 +157,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 229 + content_length: 230 uncompressed: false - body: '{"id":44,"name":"name","revoked":false,"created_at":"2024-10-11T09:11:09.285Z","scopes":["read_api"],"user_id":5,"last_used_at":null,"active":false,"expires_at":"2024-10-11","access_level":30,"token":"glpat-jyznp-dLtWj_sGuDrird"}' + body: '{"id":58,"name":"name","revoked":false,"created_at":"2024-10-12T07:06:09.085Z","scopes":["read_api"],"user_id":16,"last_used_at":null,"active":false,"expires_at":"2024-10-12","access_level":30,"token":"glpat-2qeH8Wtkkk2s__dMgzmR"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "229" + - "230" Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:09 GMT + - Sat, 12 Oct 2024 07:06:09 GMT Etag: - - W/"086033e4f8d41c6e824c73402e40dc84" + - W/"7b19175c8bc1bda9de666310c1b3eb72" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -186,14 +186,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH72YW5PN2WTVZQBMGFAM","version":"1"}' + - '{"correlation_id":"01J9ZRS1N1855PN3ZEA29Z3W2B","version":"1"}' X-Request-Id: - - 01J9XDH72YW5PN2WTVZQBMGFAM + - 01J9ZRS1N1855PN3ZEA29Z3W2B X-Runtime: - - "0.139833" + - "0.158302" status: 201 Created code: 201 - duration: 143.029125ms + duration: 164.414542ms - id: 3 request: proto: HTTP/1.1 @@ -214,7 +214,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/44 + url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/58 method: DELETE response: proto: HTTP/1.1 @@ -231,7 +231,7 @@ interactions: Connection: - keep-alive Date: - - Fri, 11 Oct 2024 09:11:09 GMT + - Sat, 12 Oct 2024 07:06:09 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -245,14 +245,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH7BZE0NXW333X8EPYBG8","version":"1"}' + - '{"correlation_id":"01J9ZRS1ZD2EE07SDA7GMNXV9K","version":"1"}' X-Request-Id: - - 01J9XDH7BZE0NXW333X8EPYBG8 + - 01J9ZRS1ZD2EE07SDA7GMNXV9K X-Runtime: - - "0.165336" + - "0.086262" status: 204 No Content code: 204 - duration: 169.433708ms + duration: 90.848834ms - id: 4 request: proto: HTTP/1.1 @@ -264,7 +264,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","expires_at":"2024-10-11","scopes":["read_api"]}' + body: '{"name":"name","expires_at":"2024-10-12","scopes":["read_api"]}' form: {} headers: Accept: @@ -285,7 +285,7 @@ interactions: trailer: {} content_length: 211 uncompressed: false - body: '{"id":45,"name":"name","revoked":false,"created_at":"2024-10-11T09:11:09.813Z","scopes":["read_api"],"user_id":1,"last_used_at":null,"active":false,"expires_at":"2024-10-11","token":"glpat-UMUVGw-5rbZezxBBRmwh"}' + body: '{"id":59,"name":"name","revoked":false,"created_at":"2024-10-12T07:06:09.599Z","scopes":["read_api"],"user_id":1,"last_used_at":null,"active":false,"expires_at":"2024-10-12","token":"glpat-P4_aJeMpW_HPf2R9ZUT-"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -296,9 +296,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:09 GMT + - Sat, 12 Oct 2024 07:06:09 GMT Etag: - - W/"f208feb56b518e0e4bd81eeca43a636d" + - W/"4767568b391be8a6046e467822bfd1c3" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -312,14 +312,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH7PMZQP9W7VR8Q9TDR4N","version":"1"}' + - '{"correlation_id":"01J9ZRS254TCFG21964W9NEMMT","version":"1"}' X-Request-Id: - - 01J9XDH7PMZQP9W7VR8Q9TDR4N + - 01J9ZRS254TCFG21964W9NEMMT X-Runtime: - - "0.089693" + - "0.213275" status: 201 Created code: 201 - duration: 93.497084ms + duration: 216.850292ms - id: 5 request: proto: HTTP/1.1 @@ -340,7 +340,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/personal_access_tokens/45 + url: http://localhost:8080/api/v4/personal_access_tokens/59 method: DELETE response: proto: HTTP/1.1 @@ -357,7 +357,7 @@ interactions: Connection: - keep-alive Date: - - Fri, 11 Oct 2024 09:11:09 GMT + - Sat, 12 Oct 2024 07:06:09 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -371,11 +371,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH7WHBXKDKBT0CGMZN15G","version":"1"}' + - '{"correlation_id":"01J9ZRS2JSEZ3TBKRV6NTWWFTV","version":"1"}' X-Request-Id: - - 01J9XDH7WHBXKDKBT0CGMZN15G + - 01J9ZRS2JSEZ3TBKRV6NTWWFTV X-Runtime: - - "0.019153" + - "0.070906" status: 204 No Content code: 204 - duration: 21.62525ms + duration: 75.209959ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml index 2959cee..c8bb96c 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":6,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-07-11T18:55:07.266Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-11T09:11:10.028Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":6,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-07-11T18:55:07.266Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:10:20.890Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:10 GMT + - Sat, 12 Oct 2024 07:10:20 GMT Etag: - - W/"24aa4b8dcbe830bee78bfd39fd471f2d" + - W/"689dbad88defd51245c35eadab14fb89" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH7Y1E4KDQJ5TMW44J05T","version":"1"}' + - '{"correlation_id":"01J9ZS0QKC3CXKDPMGH2XEYA8K","version":"1"}' X-Request-Id: - - 01J9XDH7Y1E4KDQJ5TMW44J05T + - 01J9ZS0QKC3CXKDPMGH2XEYA8K X-Runtime: - - "0.067585" + - "0.211059" status: 200 OK code: 200 - duration: 69.991041ms + duration: 248.555666ms - id: 1 request: proto: HTTP/1.1 @@ -97,7 +97,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-11","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null,"highest_role":0,"current_sign_in_ip":null,"last_sign_in_ip":null,"sign_in_count":0}' + body: '{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-12","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null,"highest_role":0,"current_sign_in_ip":null,"last_sign_in_ip":null,"sign_in_count":0}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -106,9 +106,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:10 GMT + - Sat, 12 Oct 2024 07:10:21 GMT Etag: - - W/"6b86d827645c0d5e3ab8c13613a52b99" + - W/"46e2356788e4d5caa0216e74cc32fb89" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -123,14 +123,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH82GW5Q5F54WEB2RT818","version":"1"}' + - '{"correlation_id":"01J9ZS0R28C3D1PT31RJ5K5XQN","version":"1"}' X-Request-Id: - - 01J9XDH82GW5Q5F54WEB2RT818 + - 01J9ZS0R28C3D1PT31RJ5K5XQN X-Runtime: - - "0.070617" + - "0.208720" status: 200 OK code: 200 - duration: 73.934833ms + duration: 214.30075ms - id: 2 request: proto: HTTP/1.1 @@ -142,7 +142,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"expires_at":"2025-10-11"}' + body: '{"expires_at":"2025-10-12"}' form: {} headers: Accept: @@ -164,7 +164,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":46,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-10-11T09:11:10.348Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2025-10-11","token":"glpat-g7bASkbDVk_U5qnHXHwK"}' + body: '{"id":43,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-10-12T07:10:21.728Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2025-10-12","token":"glpat-ZF-X3ix3qmkMhKAXnF6x"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -173,9 +173,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:10 GMT + - Sat, 12 Oct 2024 07:10:21 GMT Etag: - - W/"aa09f7fd79177fa99159c6a272a38717" + - W/"e7570a30768f2cb477d6eeb0aa2c7157" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -190,11 +190,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH877ZGBK3XE7A5M40X8Q","version":"1"}' + - '{"correlation_id":"01J9ZS0RFTQYMXAP3NW9YHZ792","version":"1"}' X-Request-Id: - - 01J9XDH877ZGBK3XE7A5M40X8Q + - 01J9ZS0RFTQYMXAP3NW9YHZ792 X-Runtime: - - "0.044978" + - "0.047269" status: 200 OK code: 200 - duration: 48.247667ms + duration: 51.81225ms diff --git a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml index 74e9942..d916534 100644 --- a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml +++ b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-11T09:11:11.407Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:08:01.710Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:01 GMT Etag: - - W/"eb477f9d4eb572b4bdce53a530bd37c9" + - W/"5defe635c9d71d60f6df25bf5fd948f3" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH996D1Y3K86T0C3VCNTA","version":"1"}' + - '{"correlation_id":"01J9ZRWFQP3X3BYWJMPYZDEFPA","version":"1"}' X-Request-Id: - - 01J9XDH996D1Y3K86T0C3VCNTA + - 01J9ZRWFQP3X3BYWJMPYZDEFPA X-Runtime: - - "0.013222" + - "0.157427" status: 200 OK code: 200 - duration: 15.389792ms + duration: 170.138958ms - id: 1 request: proto: HTTP/1.1 @@ -106,7 +106,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:02 GMT Etag: - W/"25fe2b64ac6604f6b3a8740f4910a720" Link: @@ -125,7 +125,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9A8RHP3PY3PP6Q46D1E","version":"1"}' + - '{"correlation_id":"01J9ZRWG2AJRP09Y4BZWS59KJJ","version":"1"}' X-Next-Page: - "" X-Page: @@ -135,16 +135,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDH9A8RHP3PY3PP6Q46D1E + - 01J9ZRWG2AJRP09Y4BZWS59KJJ X-Runtime: - - "0.134546" + - "0.268702" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 137.700583ms + duration: 272.622416ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"personal","expires_at":"2024-10-17","scopes":["read_api"]}' + body: '{"name":"personal","expires_at":"2024-10-18","scopes":["read_api"]}' form: {} headers: Accept: @@ -177,7 +177,7 @@ interactions: trailer: {} content_length: 214 uncompressed: false - body: '{"id":47,"name":"personal","revoked":false,"created_at":"2024-10-11T09:11:11.745Z","scopes":["read_api"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-10-17","token":"glpat-okk36KzPkS461UqiLFY8"}' + body: '{"id":60,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:02.667Z","scopes":["read_api"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-10-18","token":"glpat-qA4C1LRq38HbvP7z7Y_K"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -188,9 +188,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:02 GMT Etag: - - W/"345ce077844078b8c1cea59502a6ccc2" + - W/"a344d2fc8c42eb292649713f44a19757" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -204,14 +204,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9JZD3CCREAP02AMRTWQ","version":"1"}' + - '{"correlation_id":"01J9ZRWGKEJX4VPX3GJ9PTFPKN","version":"1"}' X-Request-Id: - - 01J9XDH9JZD3CCREAP02AMRTWQ + - 01J9ZRWGKEJX4VPX3GJ9PTFPKN X-Runtime: - - "0.048286" + - "0.191464" status: 201 Created code: 201 - duration: 52.122917ms + duration: 195.074583ms - id: 3 request: proto: HTTP/1.1 @@ -242,7 +242,7 @@ interactions: trailer: {} content_length: 199 uncompressed: false - body: '{"id":47,"name":"personal","revoked":false,"created_at":"2024-10-11T09:11:11.745Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-11T09:11:11.824Z","active":true,"expires_at":"2024-10-17"}' + body: '{"id":60,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:02.667Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-12T07:08:02.965Z","active":true,"expires_at":"2024-10-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -253,9 +253,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Etag: - - W/"e062945c2d257c4d8d5239260ad5983e" + - W/"7593a1f970623775e0a29ef779ecf0ff" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -269,14 +269,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9P9T7N98VMF4FEG7F9A","version":"1"}' + - '{"correlation_id":"01J9ZRWGZRGWGSKS2DYGX1PR0M","version":"1"}' X-Request-Id: - - 01J9XDH9P9T7N98VMF4FEG7F9A + - 01J9ZRWGZRGWGSKS2DYGX1PR0M X-Runtime: - - "0.011698" + - "0.065304" status: 200 OK code: 200 - duration: 14.525791ms + duration: 68.96675ms - id: 4 request: proto: HTTP/1.1 @@ -307,7 +307,7 @@ interactions: trailer: {} content_length: 199 uncompressed: false - body: '{"id":47,"name":"personal","revoked":false,"created_at":"2024-10-11T09:11:11.745Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-11T09:11:11.824Z","active":true,"expires_at":"2024-10-17"}' + body: '{"id":60,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:02.667Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-12T07:08:02.965Z","active":true,"expires_at":"2024-10-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -318,9 +318,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Etag: - - W/"e062945c2d257c4d8d5239260ad5983e" + - W/"7593a1f970623775e0a29ef779ecf0ff" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -334,11 +334,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9Q8JMCSGPBKAY590YVD","version":"1"}' + - '{"correlation_id":"01J9ZRWH45S1GWK3NZPPYNYCB5","version":"1"}' X-Request-Id: - - 01J9XDH9Q8JMCSGPBKAY590YVD + - 01J9ZRWH45S1GWK3NZPPYNYCB5 X-Runtime: - - "0.009722" + - "0.012113" status: 200 OK code: 200 - duration: 12.273625ms + duration: 14.934875ms diff --git a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml index 9d5c97b..2530941 100644 --- a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml +++ b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-11T09:11:11.407Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:08:01.710Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Etag: - - W/"eb477f9d4eb572b4bdce53a530bd37c9" + - W/"5defe635c9d71d60f6df25bf5fd948f3" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9RC55FCKE8YP01CTPGX","version":"1"}' + - '{"correlation_id":"01J9ZRWH5HYTYEXMVV2PZR8GK5","version":"1"}' X-Request-Id: - - 01J9XDH9RC55FCKE8YP01CTPGX + - 01J9ZRWH5HYTYEXMVV2PZR8GK5 X-Runtime: - - "0.009317" + - "0.012560" status: 200 OK code: 200 - duration: 11.239625ms + duration: 15.24425ms - id: 1 request: proto: HTTP/1.1 @@ -97,7 +97,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '[{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-11","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null}]' + body: '[{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-12","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -106,9 +106,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Etag: - - W/"2429e7b0734d28e38a7271e7fa975d47" + - W/"4f7bac1106e5f7fb8072db43e1305b0b" Link: - ; rel="first", ; rel="last" Referrer-Policy: @@ -125,7 +125,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9S6QWM1QVJ5GZKEC61K","version":"1"}' + - '{"correlation_id":"01J9ZRWH6JP7VCAPYVVRACS7NB","version":"1"}' X-Next-Page: - "" X-Page: @@ -135,16 +135,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDH9S6QWM1QVJ5GZKEC61K + - 01J9ZRWH6JP7VCAPYVVRACS7NB X-Runtime: - - "0.023962" + - "0.127098" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 26.273ms + duration: 130.0885ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"personal","expires_at":"2024-10-12","scopes":["read_api"]}' + body: '{"name":"personal","expires_at":"2024-10-13","scopes":["read_api"]}' form: {} headers: Accept: @@ -177,7 +177,7 @@ interactions: trailer: {} content_length: 214 uncompressed: false - body: '{"id":48,"name":"personal","revoked":false,"created_at":"2024-10-11T09:11:11.979Z","scopes":["read_api"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2024-10-12","token":"glpat-GcWrEbpWqYgRCsLvvWak"}' + body: '{"id":61,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:03.456Z","scopes":["read_api"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2024-10-13","token":"glpat-JxBosQLxKgsQ-B1CMqqB"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -188,9 +188,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:11 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Etag: - - W/"5e59836dcc32663e3e4408ffb5354b86" + - W/"b65e9b2b3e0f44d796e2e5d39133cdc8" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -204,14 +204,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9TXPFHJHP5T655VJXFS","version":"1"}' + - '{"correlation_id":"01J9ZRWHEV27KGA9FGH5TP7CEQ","version":"1"}' X-Request-Id: - - 01J9XDH9TXPFHJHP5T655VJXFS + - 01J9ZRWHEV27KGA9FGH5TP7CEQ X-Runtime: - - "0.019056" + - "0.044625" status: 201 Created code: 201 - duration: 22.043583ms + duration: 49.055291ms - id: 3 request: proto: HTTP/1.1 @@ -242,7 +242,7 @@ interactions: trailer: {} content_length: 199 uncompressed: false - body: '{"id":48,"name":"personal","revoked":false,"created_at":"2024-10-11T09:11:11.979Z","scopes":["read_api"],"user_id":2,"last_used_at":"2024-10-11T09:11:12.018Z","active":true,"expires_at":"2024-10-12"}' + body: '{"id":61,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:03.456Z","scopes":["read_api"],"user_id":2,"last_used_at":"2024-10-12T07:08:03.529Z","active":true,"expires_at":"2024-10-13"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -253,9 +253,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Etag: - - W/"0aacc8d37ac1f466ab3a4f1a9a5eef25" + - W/"f38e2aa37082adf08598ce78aaacdeb1" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -269,14 +269,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9WBR6T18PC6MGEK3HT2","version":"1"}' + - '{"correlation_id":"01J9ZRWHJ0ZQVW4J3M1D0E3PAE","version":"1"}' X-Request-Id: - - 01J9XDH9WBR6T18PC6MGEK3HT2 + - 01J9ZRWHJ0ZQVW4J3M1D0E3PAE X-Runtime: - - "0.011041" + - "0.018336" status: 200 OK code: 200 - duration: 13.168ms + duration: 21.143333ms - id: 4 request: proto: HTTP/1.1 @@ -297,7 +297,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/personal_access_tokens/48 + url: http://localhost:8080/api/v4/personal_access_tokens/61 method: DELETE response: proto: HTTP/1.1 @@ -314,7 +314,7 @@ interactions: Connection: - keep-alive Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -328,14 +328,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9X7QKRZCHMRAB8EKYNY","version":"1"}' + - '{"correlation_id":"01J9ZRWHKBT344N6ST85SD6XKY","version":"1"}' X-Request-Id: - - 01J9XDH9X7QKRZCHMRAB8EKYNY + - 01J9ZRWHKBT344N6ST85SD6XKY X-Runtime: - - "0.018647" + - "0.071987" status: 204 No Content code: 204 - duration: 21.122541ms + duration: 74.618333ms - id: 5 request: proto: HTTP/1.1 @@ -377,7 +377,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:03 GMT Server: - nginx Vary: @@ -385,11 +385,11 @@ interactions: Www-Authenticate: - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9YMJX1KKFSXJC49H8M3","version":"1"}' + - '{"correlation_id":"01J9ZRWHR25J0WGGQ3JTX4PZSQ","version":"1"}' X-Request-Id: - - 01J9XDH9YMJX1KKFSXJC49H8M3 + - 01J9ZRWHR25J0WGGQ3JTX4PZSQ X-Runtime: - - "0.007646" + - "0.011782" status: 401 Unauthorized code: 401 - duration: 10.253875ms + duration: 14.681125ms diff --git a/testdata/fixtures/16.11.6/TestWithGitlabUser_RotateToken.yaml b/testdata/fixtures/16.11.6/TestWithGitlabUser_RotateToken.yaml index 372cdd1..8078185 100644 --- a/testdata/fixtures/16.11.6/TestWithGitlabUser_RotateToken.yaml +++ b/testdata/fixtures/16.11.6/TestWithGitlabUser_RotateToken.yaml @@ -31,24 +31,24 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":10918303,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-11T09:24:02.260Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-11T09:25:17.333Z","active":true,"expires_at":"2025-10-11"}' + body: '{"id":10926727,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:11:02.977Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-12T07:12:00.639Z","active":true,"expires_at":"2024-11-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate Cf-Cache-Status: - MISS Cf-Ray: - - 8d0dcd4eab8441ce-AMS + - 8d15477379e51e9d-AMS Content-Security-Policy: - default-src 'none' Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:25:17 GMT + - Sat, 12 Oct 2024 07:12:00 GMT Etag: - - W/"9a96616cac5f4bc9ff6e8be0bfab6069" + - W/"eb8c6a58e7ef9a81455d40394cc921c0" Gitlab-Lb: - - haproxy-main-44-lb-gprd + - haproxy-main-47-lb-gprd Gitlab-Sv: - api-gke-us-east1-d Nel: @@ -56,11 +56,11 @@ interactions: Referrer-Policy: - strict-origin-when-cross-origin Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=vVYvV2ZiNm4ioBdl4pLRK%2BSE4%2BNtJ5RldvAGRa1a%2FMXeafpHvslzTt52HRgrNfcT5B%2FP37%2FQGwJwMZYY4i5xtSH3AdnSpFOCtB%2FQsL3JXPk%2Fh5yGbdllxgZEDBY%3D"}],"group":"cf-nel","max_age":604800}' + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=QwHC6%2BGYltSi32LYuov%2FPCQBqfhW4S4CtOe%2Bfgesbqk%2FMVjhWm39TBL2YEdc1X26a2ZAzdmu09McaeKtWbjJTHqCZc8u%2B%2BmK0O0kTlzWz%2Fl2YHa7qPFd5ERLpYs%3D"}],"group":"cf-nel","max_age":604800}' Server: - cloudflare Set-Cookie: - - _cfuvid=snbnEqd4._3U_2WaTtgT1xe5ClsyVF_Tka3s1p05_mk-1728638717419-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None + - _cfuvid=pps4bgezwihp4YSkJ1i31CEuwqAOlR3JsVBLZBV92Qc-1728717120727-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000 Vary: @@ -70,14 +70,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"53e54ff893745800523d3a20770a3ba5","version":"1"}' + - '{"correlation_id":"d9f31ea160d5a3b1437c1ed361036332","version":"1"}' X-Request-Id: - - 53e54ff893745800523d3a20770a3ba5 + - d9f31ea160d5a3b1437c1ed361036332 X-Runtime: - - "0.031657" + - "0.034907" status: 200 OK code: 200 - duration: 246.249625ms + duration: 246.743792ms - id: 1 request: proto: HTTP/1.1 @@ -108,36 +108,36 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":10918303,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-11T09:24:02.260Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-11T09:25:17.333Z","active":true,"expires_at":"2025-10-11"}' + body: '{"id":10926727,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:11:02.977Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-12T07:12:00.639Z","active":true,"expires_at":"2024-11-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate Cf-Cache-Status: - MISS Cf-Ray: - - 8d0dcd518e2841ce-AMS + - 8d1547763b7a1e9d-AMS Content-Security-Policy: - default-src 'none' Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:25:17 GMT + - Sat, 12 Oct 2024 07:12:01 GMT Etag: - - W/"9a96616cac5f4bc9ff6e8be0bfab6069" + - W/"eb8c6a58e7ef9a81455d40394cc921c0" Gitlab-Lb: - - haproxy-main-06-lb-gprd + - haproxy-main-50-lb-gprd Gitlab-Sv: - - api-gke-us-east1-b + - gke-cny-api Nel: - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' Referrer-Policy: - strict-origin-when-cross-origin Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=YPNZnw9bK%2FpBJ0muTIfX%2BcDGYytxCRSYLHw87w48dEIg%2FTj6pfjI%2B8byDIUXCcfh5QGmWmKi3AwBvx2aNvnd4PALbHyUkBWpL%2FqpMsHIYB2SCcWKsqPXfjDEmZ4%3D"}],"group":"cf-nel","max_age":604800}' + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=5xjXLYIMD%2FnsXioaH5biNyn9S%2FOaANmsSAnbo%2FZnr1%2F9alVCTaXvj1qKOFV1Y3tnt%2BHLhZMjnxT8UqEefm8r3B4u9H8cvEud0j3itXFYNy7n0JXsM3mOAY3K5uI%3D"}],"group":"cf-nel","max_age":604800}' Server: - cloudflare Set-Cookie: - - _cfuvid=O1Jr7vSqHp3uN3y3gRrQgv7oD8TPVxf3m2FKB5oqyeM-1728638717843-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None + - _cfuvid=y00OhfNJsPq_nK80esK8keTOe9voQEp5sIurFuxzMDw-1728717121151-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000 Vary: @@ -147,14 +147,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"a0c28b326e07423cb3ad1c036e1e4b52","version":"1"}' + - '{"correlation_id":"15633d6b4e57e547a32bc534ceb06607","version":"1"}' X-Request-Id: - - a0c28b326e07423cb3ad1c036e1e4b52 + - 15633d6b4e57e547a32bc534ceb06607 X-Runtime: - - "0.030970" + - "0.026121" status: 200 OK code: 200 - duration: 174.888708ms + duration: 177.210708ms - id: 2 request: proto: HTTP/1.1 @@ -185,24 +185,24 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":32923,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://gitlab.com/ilijamt","created_at":"2014-05-19T14:51:54.441Z","bio":"","location":"","public_email":"","skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":"9:25 AM"}' + body: '{"id":32923,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://gitlab.com/ilijamt","created_at":"2014-05-19T14:51:54.441Z","bio":"","location":"","public_email":"","skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":"7:12 AM"}' headers: Cache-Control: - max-age=0, private, must-revalidate Cf-Cache-Status: - MISS Cf-Ray: - - 8d0dcd53b80241ce-AMS + - 8d1547786c661e9d-AMS Content-Security-Policy: - default-src 'none' Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:25:18 GMT + - Sat, 12 Oct 2024 07:12:01 GMT Etag: - - W/"42f2d9fcab5391421f767ea9fe544269" + - W/"6be37df22a2eca9ad06347f5e193f804" Gitlab-Lb: - - haproxy-main-42-lb-gprd + - haproxy-main-54-lb-gprd Gitlab-Sv: - api-gke-us-east1-b Nel: @@ -210,11 +210,11 @@ interactions: Referrer-Policy: - strict-origin-when-cross-origin Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=YlsNM1nVbGBtHT3wAgraHq1V3VBZ0Rs4YFV%2FfrP663euaQE32bDM8T8%2BW7C4mE7nTFDLf%2FziN%2FHx7%2FL%2FjfZqbX%2BqTu1nh53%2Fm1g5BUM6H86uGvqrpTvTAUj19BM%3D"}],"group":"cf-nel","max_age":604800}' + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=nqNLGU098cNhDE%2FiYNzVCt4hxBSfIkUD72bdx1MHvzLeJHVHIpw4DQwoFPkoFcUaRZWRQyFVvCCOJvKhiP90DiLYQUl46kTyldC%2FmDGciZqJtLE1WGEsrt76B4k%3D"}],"group":"cf-nel","max_age":604800}' Server: - cloudflare Set-Cookie: - - _cfuvid=A_i.TjUuAuP3TzmTLLmQ6kUdpdtn3AW_n..tCQddmg0-1728638718207-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None + - _cfuvid=V_4IV2SZQNSF8n4tb85_gISISbsoKQ2ajNVAgGjsjSI-1728717121547-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000 Vary: @@ -224,14 +224,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"63d34cd31cc3ee15e6933624ebe071df","version":"1"}' + - '{"correlation_id":"876d805e1a60a6e6fbb3ecc18db599e7","version":"1"}' X-Request-Id: - - 63d34cd31cc3ee15e6933624ebe071df + - 876d805e1a60a6e6fbb3ecc18db599e7 X-Runtime: - - "0.038039" + - "0.069151" status: 200 OK code: 200 - duration: 187.452208ms + duration: 213.577417ms - id: 3 request: proto: HTTP/1.1 @@ -243,7 +243,7 @@ interactions: host: gitlab.com remote_addr: "" request_uri: "" - body: '{"expires_at":"2025-10-11"}' + body: '{"expires_at":"2024-11-12"}' form: {} headers: Accept: @@ -254,7 +254,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://gitlab.com/api/v4/personal_access_tokens/10918303/rotate + url: https://gitlab.com/api/v4/personal_access_tokens/10926727/rotate method: POST response: proto: HTTP/2.0 @@ -264,36 +264,36 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":10918315,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-11T09:25:18.521Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":null,"active":true,"expires_at":"2025-10-11","token":"glpat-8oyQTsAazgWtCG6Ezf43"}' + body: '{"id":10926736,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:01.911Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":null,"active":true,"expires_at":"2024-11-12","token":"glpat-nsMtXz-LoSz8ib4MznxH"}' headers: Cache-Control: - max-age=0, private, must-revalidate Cf-Cache-Status: - DYNAMIC Cf-Ray: - - 8d0dcd56095841ce-AMS + - 8d15477b1ddf1e9d-AMS Content-Security-Policy: - default-src 'none' Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:25:18 GMT + - Sat, 12 Oct 2024 07:12:01 GMT Etag: - - W/"e4d6cf52e74bbfe1a98543e4b91921e6" + - W/"5eeae513145d150baf0cd54bcc1bd6b4" Gitlab-Lb: - - haproxy-main-33-lb-gprd + - haproxy-main-38-lb-gprd Gitlab-Sv: - - api-gke-us-east1-b + - api-gke-us-east1-d Nel: - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' Referrer-Policy: - strict-origin-when-cross-origin Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=My%2BO4cTmQCVruB764mp4FgHRndQZ9fOPWOs%2Bte7yxkrHvGvP3uyVU0xm%2BXGpeu0D0hW9UhfPYNbNcuPUOnpvmH1yEcqAw6sZFubOlRn71tlgPGnU2yBYFEHsPU8%3D"}],"group":"cf-nel","max_age":604800}' + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=2eRkbx6QQMSpElFGuVqxmXWwgumech4hZL5QID34wgPn%2FbFqbZVjuvc7Xp%2F3LOBCnUFH4%2Brp9G7Zt%2B9h4d8I%2FmfSlOlJrH4B%2BV4sLhJK%2B7UEsEIBD1FTckO0VuY%3D"}],"group":"cf-nel","max_age":604800}' Server: - cloudflare Set-Cookie: - - _cfuvid=BXHspUWKhDk32H5mOR7DdouGHvTk6KzFB.AqWO7d9I8-1728638718584-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None + - _cfuvid=ivD7yco6cZcE.EGCu.9Jt.jnFaLF1h_fl6eoVxpFTfk-1728717121978-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000 Vary: @@ -303,14 +303,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"db13311710a0b8d8d5638ff216cebaff","version":"1"}' + - '{"correlation_id":"70b685b07efe479e22cd7fe28cf0c1f3","version":"1"}' X-Request-Id: - - db13311710a0b8d8d5638ff216cebaff + - 70b685b07efe479e22cd7fe28cf0c1f3 X-Runtime: - - "0.064630" + - "0.074974" status: 200 OK code: 200 - duration: 187.697208ms + duration: 312.304167ms - id: 4 request: proto: HTTP/1.1 @@ -348,7 +348,7 @@ interactions: Cf-Cache-Status: - MISS Cf-Ray: - - 8d0dcd586b0241ce-AMS + - 8d15477f0ff21e9d-AMS Content-Length: - "106" Content-Security-Policy: @@ -356,9 +356,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:25:18 GMT + - Sat, 12 Oct 2024 07:12:02 GMT Gitlab-Lb: - - haproxy-main-10-lb-gprd + - haproxy-main-22-lb-gprd Gitlab-Sv: - api-gke-us-east1-c Nel: @@ -366,11 +366,11 @@ interactions: Referrer-Policy: - strict-origin-when-cross-origin Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=vvdnqMlxqh0tJd%2BjUsqgkEhNZfmhFX3d08c1ss%2BIsXV5hEvcAwMjx4wsuzR%2BBTYocTINUeWvt8INR%2B3D4OFkPM%2F%2BJpehuZbYv9tS8So%2BDFF5Kgo6iXMkueIYnl0%3D"}],"group":"cf-nel","max_age":604800}' + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=n%2BJPY1qsMeUIr9kcb4Kouox3f1Z%2BH%2FFlfb5htBPGIUAKSyNAmm7ueeF0qxYsbf7ZpFxKEsaWIaCfjFXgW3CnEoNS%2BsDhy2jMZFLCBtPxlADzfcCQZhdC1Xz%2FsD0%3D"}],"group":"cf-nel","max_age":604800}' Server: - cloudflare Set-Cookie: - - _cfuvid=BSdZYot.dRoZc4RL843MUwofyYu1ARLrzVrU8M1VSk8-1728638718947-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None + - _cfuvid=4HBEOLX3hywL2WBLYcnArTHE8F9eAC4VBoSB4y938dA-1728717122561-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000 Vary: @@ -380,14 +380,14 @@ interactions: X-Content-Type-Options: - nosniff X-Gitlab-Meta: - - '{"correlation_id":"8f5c0e5f741900298dd49060fd05acaa","version":"1"}' + - '{"correlation_id":"36989736767ccf36f9e086e7cf2a65a2","version":"1"}' X-Request-Id: - - 8f5c0e5f741900298dd49060fd05acaa + - 36989736767ccf36f9e086e7cf2a65a2 X-Runtime: - - "0.024963" + - "0.022621" status: 401 Unauthorized code: 401 - duration: 172.017208ms + duration: 170.916583ms - id: 5 request: proto: HTTP/1.1 @@ -418,36 +418,36 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":10918315,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-11T09:25:18.521Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-11T09:25:19.209Z","active":true,"expires_at":"2025-10-11"}' + body: '{"id":10926736,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:01.911Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-12T07:12:02.826Z","active":true,"expires_at":"2024-11-12"}' headers: Cache-Control: - max-age=0, private, must-revalidate Cf-Cache-Status: - MISS Cf-Ray: - - 8d0dcd5a9cba41ce-AMS + - 8d15478128da1e9d-AMS Content-Security-Policy: - default-src 'none' Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:25:19 GMT + - Sat, 12 Oct 2024 07:12:02 GMT Etag: - - W/"676536deed6726fb2c216d558ec8ac54" + - W/"d13226ad8c7d864b97d95937b0bf4611" Gitlab-Lb: - - haproxy-main-37-lb-gprd + - haproxy-main-47-lb-gprd Gitlab-Sv: - - api-gke-us-east1-c + - api-gke-us-east1-d Nel: - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' Referrer-Policy: - strict-origin-when-cross-origin Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=hLGH3HgYrqBgd6sUykZyMZh7yz4htfeRrPQLZOqHdEjLT8hfInqQOCWJLF9U5xjscsWis49fhohR%2BefAD%2FwAYbnUjZt49UE0mBtVLKVJqkhpbCsVi1T9zhE6Ye4%3D"}],"group":"cf-nel","max_age":604800}' + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=tT9kCcJjesQcb42wGjvYCybpQMn6mA3TqY8pFYzK7VsrQIdpYxwop8V3e1VxBQrqNnvX6ydvtsV9qnTTSxc%2Bgg1M%2F4JBzZRsxAnRgJ5iX%2F9NsHWE02L2bsHObA8%3D"}],"group":"cf-nel","max_age":604800}' Server: - cloudflare Set-Cookie: - - _cfuvid=UiKJV42NEd9BdLtKGMYfXHifkaMyplbslasIXdl0My4-1728638719343-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None + - _cfuvid=7b2mxUIJsK7r6yeW_Yyms1m3c.yU4TPg0FaPJGuEzHw-1728717122945-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000 Vary: @@ -457,11 +457,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"57a26ee867c681d25025c2f8ddaa07c3","version":"1"}' + - '{"correlation_id":"7093da2c7f24e5300693c6432453c083","version":"1"}' X-Request-Id: - - 57a26ee867c681d25025c2f8ddaa07c3 + - 7093da2c7f24e5300693c6432453c083 X-Runtime: - - "0.082367" + - "0.064506" status: 200 OK code: 200 - duration: 223.568792ms + duration: 210.568084ms diff --git a/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml b/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml index 3716036..39c55bb 100644 --- a/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml +++ b/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-11T09:26:21.398Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-12T07:08:04.484Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:26:21 GMT + - Sat, 12 Oct 2024 07:08:41 GMT Etag: - - W/"6abd1ad9cdb797cce3951621f8a25fa0" + - W/"882521c09243ae1cedf2ba0b451a8b14" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XED1Y22GA8QRMT54NJCJAT","version":"1"}' + - '{"correlation_id":"01J9ZRXPRZ0V9XVJNXEPKD07Q2","version":"1"}' X-Request-Id: - - 01J9XED1Y22GA8QRMT54NJCJAT + - 01J9ZRXPRZ0V9XVJNXEPKD07Q2 X-Runtime: - - "0.027721" + - "0.014012" status: 200 OK code: 200 - duration: 38.083917ms + duration: 19.567458ms - id: 1 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"gat-token","scopes":["read_api"],"access_level":40,"expires_at":"2024-10-17"}' + body: '{"name":"gat-token","scopes":["read_api"],"access_level":40,"expires_at":"2024-10-18"}' form: {} headers: Accept: @@ -98,7 +98,7 @@ interactions: trailer: {} content_length: 234 uncompressed: false - body: '{"id":56,"name":"gat-token","revoked":false,"created_at":"2024-10-11T09:26:21.560Z","scopes":["read_api"],"user_id":14,"last_used_at":null,"active":true,"expires_at":"2024-10-17","access_level":40,"token":"glpat-k9i6S3at98MrxKsqEsFT"}' + body: '{"id":62,"name":"gat-token","revoked":false,"created_at":"2024-10-12T07:08:41.897Z","scopes":["read_api"],"user_id":17,"last_used_at":null,"active":true,"expires_at":"2024-10-18","access_level":40,"token":"glpat-Qvtx2op9HeVJiLMrWP-2"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -109,9 +109,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:26:21 GMT + - Sat, 12 Oct 2024 07:08:41 GMT Etag: - - W/"9e04a04b4942150461e0fb15855d4376" + - W/"cde6de0a1f38d63242148ca51f3ab446" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -125,14 +125,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XED20D1VD4JPK3ZC6QYMQA","version":"1"}' + - '{"correlation_id":"01J9ZRXPT8CPKE6PJB88YSGBDD","version":"1"}' X-Request-Id: - - 01J9XED20D1VD4JPK3ZC6QYMQA + - 01J9ZRXPT8CPKE6PJB88YSGBDD X-Runtime: - - "0.110909" + - "0.230218" status: 201 Created code: 201 - duration: 115.466459ms + duration: 233.492042ms - id: 2 request: proto: HTTP/1.1 @@ -163,7 +163,7 @@ interactions: trailer: {} content_length: 201 uncompressed: false - body: '{"id":56,"name":"gat-token","revoked":false,"created_at":"2024-10-11T09:26:21.560Z","scopes":["read_api"],"user_id":14,"last_used_at":"2024-10-11T09:26:21.695Z","active":true,"expires_at":"2024-10-17"}' + body: '{"id":62,"name":"gat-token","revoked":false,"created_at":"2024-10-12T07:08:41.897Z","scopes":["read_api"],"user_id":17,"last_used_at":"2024-10-12T07:08:42.186Z","active":true,"expires_at":"2024-10-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -174,9 +174,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:26:21 GMT + - Sat, 12 Oct 2024 07:08:42 GMT Etag: - - W/"22d5e30d690a91a020ab5e31c069180a" + - W/"b67876e7daf49e13b5af88d175613fe8" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -190,14 +190,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XED27N34SZXHQVF7NGV2X7","version":"1"}' + - '{"correlation_id":"01J9ZRXQ8ZHVYMFPDMVZQQHW4F","version":"1"}' X-Request-Id: - - 01J9XED27N34SZXHQVF7NGV2X7 + - 01J9ZRXQ8ZHVYMFPDMVZQQHW4F X-Runtime: - - "0.021150" + - "0.052851" status: 200 OK code: 200 - duration: 24.451083ms + duration: 60.288375ms - id: 3 request: proto: HTTP/1.1 @@ -218,7 +218,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/groups/example/access_tokens/56 + url: http://localhost:8080/api/v4/groups/example/access_tokens/62 method: DELETE response: proto: HTTP/1.1 @@ -235,7 +235,7 @@ interactions: Connection: - keep-alive Date: - - Fri, 11 Oct 2024 09:26:21 GMT + - Sat, 12 Oct 2024 07:08:42 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -249,14 +249,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XED298T4C0RP51CYGSMZAQ","version":"1"}' + - '{"correlation_id":"01J9ZRXQCSPJ8QHST1PA6QS2BX","version":"1"}' X-Request-Id: - - 01J9XED298T4C0RP51CYGSMZAQ + - 01J9ZRXQCSPJ8QHST1PA6QS2BX X-Runtime: - - "0.083375" + - "0.143387" status: 204 No Content code: 204 - duration: 86.304916ms + duration: 147.257708ms - id: 4 request: proto: HTTP/1.1 @@ -298,7 +298,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:26:21 GMT + - Sat, 12 Oct 2024 07:08:42 GMT Server: - nginx Vary: @@ -306,11 +306,11 @@ interactions: Www-Authenticate: - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." X-Gitlab-Meta: - - '{"correlation_id":"01J9XED2EP4X1NN7GQHE454R8N","version":"1"}' + - '{"correlation_id":"01J9ZRXQP3FYF8GNV1CAE2XHPJ","version":"1"}' X-Request-Id: - - 01J9XED2EP4X1NN7GQHE454R8N + - 01J9ZRXQP3FYF8GNV1CAE2XHPJ X-Runtime: - - "0.020437" + - "0.010340" status: 401 Unauthorized code: 401 - duration: 23.288083ms + duration: 14.14625ms diff --git a/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml b/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml index e1e7f5d..ea6b997 100644 --- a/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml +++ b/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-11T09:11:12.119Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-12T07:08:04.484Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:04 GMT Etag: - - W/"763a880ea8d1c08ecaa89a99e3c63e7f" + - W/"882521c09243ae1cedf2ba0b451a8b14" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH9ZG7J66B42VERDH8JTN","version":"1"}' + - '{"correlation_id":"01J9ZRWJEJKR0VG4DNRYZ9D9HJ","version":"1"}' X-Request-Id: - - 01J9XDH9ZG7J66B42VERDH8JTN + - 01J9ZRWJEJKR0VG4DNRYZ9D9HJ X-Runtime: - - "0.010730" + - "0.060524" status: 200 OK code: 200 - duration: 13.127792ms + duration: 68.569125ms - id: 1 request: proto: HTTP/1.1 @@ -106,7 +106,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:04 GMT Etag: - W/"8e47761c8cfb2481e9983f2bd4b37cca" Link: @@ -125,7 +125,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDHA0D8TTHGP5MSHBQ9M0G","version":"1"}' + - '{"correlation_id":"01J9ZRWJJZMR4XKQ8G48D2QXCM","version":"1"}' X-Next-Page: - "" X-Page: @@ -135,16 +135,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDHA0D8TTHGP5MSHBQ9M0G + - 01J9ZRWJJZMR4XKQ8G48D2QXCM X-Runtime: - - "0.093108" + - "0.023643" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 96.00225ms + duration: 27.55125ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"personal","expires_at":"2024-10-17","scopes":["read_api"]}' + body: '{"name":"personal","expires_at":"2024-10-18","scopes":["read_api"]}' form: {} headers: Accept: @@ -188,7 +188,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:04 GMT Server: - nginx Vary: @@ -198,11 +198,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDHA6F1WEGCXZ0PYM0Z7B7","version":"1"}' + - '{"correlation_id":"01J9ZRWJMRH7TY32E38BP1WQRM","version":"1"}' X-Request-Id: - - 01J9XDHA6F1WEGCXZ0PYM0Z7B7 + - 01J9ZRWJMRH7TY32E38BP1WQRM X-Runtime: - - "0.020591" + - "0.017483" status: 403 Forbidden code: 403 - duration: 24.304417ms + duration: 20.619208ms diff --git a/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml b/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml index 919ed52..4ff30f5 100644 --- a/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml +++ b/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-11T09:11:12.119Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-12T07:08:04.484Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:42 GMT Etag: - - W/"763a880ea8d1c08ecaa89a99e3c63e7f" + - W/"882521c09243ae1cedf2ba0b451a8b14" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDHA8CP37ZXJM21RREGYJM","version":"1"}' + - '{"correlation_id":"01J9ZRXQVFJYTFYY01JCWYP5X7","version":"1"}' X-Request-Id: - - 01J9XDHA8CP37ZXJM21RREGYJM + - 01J9ZRXQVFJYTFYY01JCWYP5X7 X-Runtime: - - "0.013738" + - "0.026300" status: 200 OK code: 200 - duration: 16.688375ms + duration: 33.345416ms - id: 1 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"project","scopes":["read_api"],"access_level":40,"expires_at":"2024-10-17"}' + body: '{"name":"project","scopes":["read_api"],"access_level":40,"expires_at":"2024-10-18"}' form: {} headers: Accept: @@ -96,22 +96,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 231 + content_length: 232 uncompressed: false - body: '{"id":49,"name":"project","revoked":false,"created_at":"2024-10-11T09:11:12.707Z","scopes":["read_api"],"user_id":6,"last_used_at":null,"active":true,"expires_at":"2024-10-17","access_level":40,"token":"glpat-rQqmY8Ffjjo8CEsuHm-Q"}' + body: '{"id":63,"name":"project","revoked":false,"created_at":"2024-10-12T07:08:42.946Z","scopes":["read_api"],"user_id":18,"last_used_at":null,"active":true,"expires_at":"2024-10-18","access_level":40,"token":"glpat-hDkAkz92N48vi8n2sxy-"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "231" + - "232" Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:12 GMT + - Sat, 12 Oct 2024 07:08:42 GMT Etag: - - W/"69e7388453b03dcdbb82c05aa66de1e9" + - W/"55af25ad82d2a3379994fa0e6a91fb14" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -125,14 +125,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDHA9GCAQ451A0XDCW74NJ","version":"1"}' + - '{"correlation_id":"01J9ZRXQXQK75MR6126XEQX4QY","version":"1"}' X-Request-Id: - - 01J9XDHA9GCAQ451A0XDCW74NJ + - 01J9ZRXQXQK75MR6126XEQX4QY X-Runtime: - - "0.281044" + - "0.143481" status: 201 Created code: 201 - duration: 283.812708ms + duration: 147.308708ms - id: 2 request: proto: HTTP/1.1 @@ -161,22 +161,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 198 + content_length: 199 uncompressed: false - body: '{"id":49,"name":"project","revoked":false,"created_at":"2024-10-11T09:11:12.707Z","scopes":["read_api"],"user_id":6,"last_used_at":"2024-10-11T09:11:13.027Z","active":true,"expires_at":"2024-10-17"}' + body: '{"id":63,"name":"project","revoked":false,"created_at":"2024-10-12T07:08:42.946Z","scopes":["read_api"],"user_id":18,"last_used_at":"2024-10-12T07:08:43.116Z","active":true,"expires_at":"2024-10-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "198" + - "199" Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:13 GMT + - Sat, 12 Oct 2024 07:08:43 GMT Etag: - - W/"af9b8cd01c21dd7184fa06fa3425b4aa" + - W/"426a82112248927e42fb358adcdf69f8" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -190,14 +190,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDHAVDPA3GW1XDVQC13RNS","version":"1"}' + - '{"correlation_id":"01J9ZRXR70M9DM078MAV32JF4D","version":"1"}' X-Request-Id: - - 01J9XDHAVDPA3GW1XDVQC13RNS + - 01J9ZRXR70M9DM078MAV32JF4D X-Runtime: - - "0.035029" + - "0.022686" status: 200 OK code: 200 - duration: 43.050375ms + duration: 26.388292ms - id: 3 request: proto: HTTP/1.1 @@ -218,7 +218,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/49 + url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/63 method: DELETE response: proto: HTTP/1.1 @@ -235,7 +235,7 @@ interactions: Connection: - keep-alive Date: - - Fri, 11 Oct 2024 09:11:13 GMT + - Sat, 12 Oct 2024 07:08:43 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -249,14 +249,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDHAY4G27A0JSBNCPSSZ6M","version":"1"}' + - '{"correlation_id":"01J9ZRXR8RQ6PYHKMWCDNKN3Q4","version":"1"}' X-Request-Id: - - 01J9XDHAY4G27A0JSBNCPSSZ6M + - 01J9ZRXR8RQ6PYHKMWCDNKN3Q4 X-Runtime: - - "0.110866" + - "0.035687" status: 204 No Content code: 204 - duration: 114.373625ms + duration: 38.899083ms - id: 4 request: proto: HTTP/1.1 @@ -298,7 +298,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:13 GMT + - Sat, 12 Oct 2024 07:08:43 GMT Server: - nginx Vary: @@ -306,11 +306,11 @@ interactions: Www-Authenticate: - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." X-Gitlab-Meta: - - '{"correlation_id":"01J9XDHB5BSPEGQ53A3RBSS15R","version":"1"}' + - '{"correlation_id":"01J9ZRXRB7GAZS8YPHSRC86TFD","version":"1"}' X-Request-Id: - - 01J9XDHB5BSPEGQ53A3RBSS15R + - 01J9ZRXRB7GAZS8YPHSRC86TFD X-Runtime: - - "0.009434" + - "0.008614" status: 401 Unauthorized code: 401 - duration: 12.635166ms + duration: 11.306667ms diff --git a/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml b/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml index c08f09f..8000584 100644 --- a/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml +++ b/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml @@ -29,20 +29,20 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 222 + content_length: 400 uncompressed: false - body: '{"id":63,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-11T10:43:15.997Z","scopes":["api","admin_mode"],"user_id":2,"last_used_at":"2024-10-11T11:27:02.277Z","active":true,"expires_at":"2024-11-10"}' + body: '{"id":75,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:43.045Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features","sudo","admin_mode","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:13:26.222Z","active":true,"expires_at":"2025-10-12"}' headers: Cache-Control: - max-age=0, private, must-revalidate Content-Length: - - "222" + - "400" Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:27:59 GMT + - Sat, 12 Oct 2024 07:13:26 GMT Etag: - - W/"5c6c013c445fa4f646570c6e5f737e98" + - W/"bb9c6ccfbd0282f27010978cf2b43422" Server: - nginx Vary: @@ -52,14 +52,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNBRZXMNCHCGS727883374","version":"1"}' + - '{"correlation_id":"01J9ZS6CKHCGGE74FY48141648","version":"1"}' X-Request-Id: - - 01J9XNBRZXMNCHCGS727883374 + - 01J9ZS6CKHCGGE74FY48141648 X-Runtime: - - "0.014842" + - "0.241438" status: 200 OK code: 200 - duration: 139.675875ms + duration: 662.8745ms - id: 1 request: proto: HTTP/1.1 @@ -92,7 +92,7 @@ interactions: trailer: {} content_length: 112 uncompressed: false - body: '{"id":129,"username":"service_account_group_265_df38f30d66e0a235ef9d7452afd47473","name":"Service account user"}' + body: '{"id":130,"username":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015","name":"Service account user"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -101,9 +101,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:27:59 GMT + - Sat, 12 Oct 2024 07:13:27 GMT Etag: - - W/"3a5e0556ed266767a9c60814ac95d607" + - W/"af3bccd2d828d21b8aa01ec07380d5f3" Server: - nginx Vary: @@ -113,14 +113,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNBS5JV9FTFYPQ43SNJQFA","version":"1"}' + - '{"correlation_id":"01J9ZS6DK1QEQF4CSJR8TFFGJS","version":"1"}' X-Request-Id: - - 01J9XNBS5JV9FTFYPQ43SNJQFA + - 01J9ZS6DK1QEQF4CSJR8TFFGJS X-Runtime: - - "0.163701" + - "0.701755" status: 201 Created code: 201 - duration: 187.807208ms + duration: 768.591666ms - id: 2 request: proto: HTTP/1.1 @@ -141,7 +141,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users?username=service_account_group_265_df38f30d66e0a235ef9d7452afd47473 + url: https://git.matoski.com/api/v4/users?username=service_account_group_265_920e8e0c29976fb684fd1fa97c480015 method: GET response: proto: HTTP/2.0 @@ -151,7 +151,7 @@ interactions: trailer: {} content_length: 1771 uncompressed: false - body: '[{"id":129,"username":"service_account_group_265_df38f30d66e0a235ef9d7452afd47473","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/a5e4bbf6ab8a155013c4fac2b82250c492b66ff8ca35fc1eb09db6d6457529ab?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_group_265_df38f30d66e0a235ef9d7452afd47473","created_at":"2024-10-11T11:27:59.748Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-11T11:27:59.733Z","last_activity_on":null,"email":"service_account_group_265_df38f30d66e0a235ef9d7452afd47473@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_group_265_df38f30d66e0a235ef9d7452afd47473@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":368,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":265,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' + body: '[{"id":130,"username":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/72c2ffb343ab4d7fccd0d9905716bb6508b66f6f93da507feb3a0ed965474d39?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_group_265_920e8e0c29976fb684fd1fa97c480015","created_at":"2024-10-12T07:13:27.376Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-12T07:13:27.277Z","last_activity_on":null,"email":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":369,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":265,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -160,11 +160,11 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:28:00 GMT + - Sat, 12 Oct 2024 07:13:28 GMT Etag: - - W/"70bbde15f7ab2e64202df345acfa781e" + - W/"60bc0c23047f390e5f28149527a8c638" Link: - - ; rel="first", ; rel="last" + - ; rel="first", ; rel="last" Server: - nginx Vary: @@ -174,7 +174,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNBSHDHQQ5TB97BTJXYKK0","version":"1"}' + - '{"correlation_id":"01J9ZS6F39MPBJNA6C2Z1K6VGM","version":"1"}' X-Next-Page: - "" X-Page: @@ -184,16 +184,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XNBSHDHQQ5TB97BTJXYKK0 + - 01J9ZS6F39MPBJNA6C2Z1K6VGM X-Runtime: - - "0.083405" + - "0.207292" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 108.158291ms + duration: 235.430625ms - id: 3 request: proto: HTTP/1.1 @@ -205,7 +205,7 @@ interactions: host: git.matoski.com remote_addr: "" request_uri: "" - body: '{"scopes":["read_service_ping","read_user","sudo","admin_mode"],"name":"vault-generated-group-service-account-token","expires_at":"2024-10-13"}' + body: '{"scopes":["read_service_ping","read_user","sudo","admin_mode"],"name":"vault-generated-group-service-account-token","expires_at":"2024-10-14"}' form: {} headers: Accept: @@ -216,7 +216,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/groups/265/service_accounts/129/personal_access_tokens + url: https://git.matoski.com/api/v4/groups/265/service_accounts/130/personal_access_tokens method: POST response: proto: HTTP/2.0 @@ -226,7 +226,7 @@ interactions: trailer: {} content_length: 292 uncompressed: false - body: '{"id":74,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-11T11:28:00.311Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":129,"last_used_at":null,"active":true,"expires_at":"2024-10-13","token":"glpat-JkXKDEe_tQnWeVYuoYiL"}' + body: '{"id":76,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:29.218Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":130,"last_used_at":null,"active":true,"expires_at":"2024-10-14","token":"glpat-L2KsvC_apY6d1sYaPodZ"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -235,9 +235,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:28:00 GMT + - Sat, 12 Oct 2024 07:13:29 GMT Etag: - - W/"d42290b51da785498ac08f217d74b5d3" + - W/"2cdcd83ad5d0df6d417c04470696a1e9" Server: - nginx Vary: @@ -247,14 +247,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNBSR736BT7C89VHNENB32","version":"1"}' + - '{"correlation_id":"01J9ZS6FHW402THTRM08Y8SYDR","version":"1"}' X-Request-Id: - - 01J9XNBSR736BT7C89VHNENB32 + - 01J9ZS6FHW402THTRM08Y8SYDR X-Runtime: - - "0.071909" + - "0.151933" status: 201 Created code: 201 - duration: 96.293ms + duration: 174.654167ms - id: 4 request: proto: HTTP/1.1 @@ -285,7 +285,7 @@ interactions: trailer: {} content_length: 277 uncompressed: false - body: '{"id":74,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-11T11:28:00.311Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":129,"last_used_at":"2024-10-11T11:28:00.470Z","active":true,"expires_at":"2024-10-13"}' + body: '{"id":76,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:29.218Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":130,"last_used_at":"2024-10-12T07:13:29.529Z","active":true,"expires_at":"2024-10-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -294,9 +294,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:28:00 GMT + - Sat, 12 Oct 2024 07:13:29 GMT Etag: - - W/"3d92ce8177418165ecb697b693592745" + - W/"91c40a9f8895b5ec0c2bfbaa9077250c" Server: - nginx Vary: @@ -306,14 +306,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNBSYABCY2Z1W8QBF533K3","version":"1"}' + - '{"correlation_id":"01J9ZS6FWWQ2CDQBSTS88CAE3H","version":"1"}' X-Request-Id: - - 01J9XNBSYABCY2Z1W8QBF533K3 + - 01J9ZS6FWWQ2CDQBSTS88CAE3H X-Runtime: - - "0.026629" + - "0.075660" status: 200 OK code: 200 - duration: 50.856083ms + duration: 98.709584ms - id: 5 request: proto: HTTP/1.1 @@ -349,7 +349,7 @@ interactions: Cache-Control: - no-cache Date: - - Fri, 11 Oct 2024 11:28:00 GMT + - Sat, 12 Oct 2024 07:13:29 GMT Server: - nginx Vary: @@ -359,14 +359,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNBT1HAP2NXYE4XBFJ9XWM","version":"1"}' + - '{"correlation_id":"01J9ZS6G33F3ZR12M956GGEWEK","version":"1"}' X-Request-Id: - - 01J9XNBT1HAP2NXYE4XBFJ9XWM + - 01J9ZS6G33F3ZR12M956GGEWEK X-Runtime: - - "0.037092" + - "0.048523" status: 204 No Content code: 204 - duration: 61.005167ms + duration: 71.483833ms - id: 6 request: proto: HTTP/1.1 @@ -387,7 +387,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users/129 + url: https://git.matoski.com/api/v4/users/130 method: DELETE response: proto: HTTP/2.0 @@ -402,7 +402,7 @@ interactions: Cache-Control: - no-cache Date: - - Fri, 11 Oct 2024 11:28:00 GMT + - Sat, 12 Oct 2024 07:13:29 GMT Server: - nginx Vary: @@ -412,11 +412,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNBT5EB5EDF4R9FP14YMVT","version":"1"}' + - '{"correlation_id":"01J9ZS6G7KHWDHBGJQYS467D56","version":"1"}' X-Request-Id: - - 01J9XNBT5EB5EDF4R9FP14YMVT + - 01J9ZS6G7KHWDHBGJQYS467D56 X-Runtime: - - "0.024675" + - "0.052501" status: 204 No Content code: 204 - duration: 49.014166ms + duration: 75.169208ms diff --git a/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml b/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml index 0f525f4..55d33a2 100644 --- a/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml +++ b/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml @@ -29,20 +29,20 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 222 + content_length: 400 uncompressed: false - body: '{"id":63,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-11T10:43:15.997Z","scopes":["api","admin_mode"],"user_id":2,"last_used_at":"2024-10-11T11:27:02.277Z","active":true,"expires_at":"2024-11-10"}' + body: '{"id":75,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:43.045Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features","sudo","admin_mode","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:13:26.222Z","active":true,"expires_at":"2025-10-12"}' headers: Cache-Control: - max-age=0, private, must-revalidate Content-Length: - - "222" + - "400" Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:27:02 GMT + - Sat, 12 Oct 2024 07:13:30 GMT Etag: - - W/"5c6c013c445fa4f646570c6e5f737e98" + - W/"bb9c6ccfbd0282f27010978cf2b43422" Server: - nginx Vary: @@ -52,14 +52,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNA12C24KDCCD1DZRHV4AJ","version":"1"}' + - '{"correlation_id":"01J9ZS6GCFDYP6ANNKPAYDZPEA","version":"1"}' X-Request-Id: - - 01J9XNA12C24KDCCD1DZRHV4AJ + - 01J9ZS6GCFDYP6ANNKPAYDZPEA X-Runtime: - - "0.073940" + - "0.027345" status: 200 OK code: 200 - duration: 199.397458ms + duration: 50.875958ms - id: 1 request: proto: HTTP/1.1 @@ -92,7 +92,7 @@ interactions: trailer: {} content_length: 102 uncompressed: false - body: '{"id":128,"username":"service_account_4d1813f4d8e51f25068ef00325fe9e23","name":"Service account user"}' + body: '{"id":131,"username":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b","name":"Service account user"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -101,9 +101,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:27:02 GMT + - Sat, 12 Oct 2024 07:13:30 GMT Etag: - - W/"28625f0531c3a18779ca0a6e2ff67cc4" + - W/"124d496fc565987e8f74b59e8a81873e" Server: - nginx Vary: @@ -113,14 +113,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNA1BPM7QEEDHFCY9GFAHB","version":"1"}' + - '{"correlation_id":"01J9ZS6GFQW191AXNPM9X9V8G5","version":"1"}' X-Request-Id: - - 01J9XNA1BPM7QEEDHFCY9GFAHB + - 01J9ZS6GFQW191AXNPM9X9V8G5 X-Runtime: - - "0.177871" + - "0.345204" status: 201 Created code: 201 - duration: 200.193375ms + duration: 464.354916ms - id: 2 request: proto: HTTP/1.1 @@ -141,7 +141,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users?username=service_account_4d1813f4d8e51f25068ef00325fe9e23 + url: https://git.matoski.com/api/v4/users?username=service_account_1dd5652e5a2b4e7efcde27f11fa41e9b method: GET response: proto: HTTP/2.0 @@ -151,7 +151,7 @@ interactions: trailer: {} content_length: 1732 uncompressed: false - body: '[{"id":128,"username":"service_account_4d1813f4d8e51f25068ef00325fe9e23","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/f5b2b8b61319b61a2246d9ea1db4b6cd5040e3e3ddfe65165386e67c016d3ce0?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_4d1813f4d8e51f25068ef00325fe9e23","created_at":"2024-10-11T11:27:02.594Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-11T11:27:02.573Z","last_activity_on":null,"email":"service_account_4d1813f4d8e51f25068ef00325fe9e23@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_4d1813f4d8e51f25068ef00325fe9e23@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":367,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":null,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' + body: '[{"id":131,"username":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/d9535977dd36a267d6f0d394b85f4f1a5068b93006fce18d4c73c1adb77bcf5e?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_1dd5652e5a2b4e7efcde27f11fa41e9b","created_at":"2024-10-12T07:13:30.207Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-12T07:13:30.136Z","last_activity_on":null,"email":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":370,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":null,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -160,11 +160,11 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:27:02 GMT + - Sat, 12 Oct 2024 07:13:31 GMT Etag: - - W/"7d233bc673308bc201ffaa69b7c5a765" + - W/"e88d9c883b387c9d524b2072ee28161e" Link: - - ; rel="first", ; rel="last" + - ; rel="first", ; rel="last" Server: - nginx Vary: @@ -174,7 +174,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNA1RA6R0J3YTCNJJFC24E","version":"1"}' + - '{"correlation_id":"01J9ZS6HCYQJPAXDJBVY9NMEKT","version":"1"}' X-Next-Page: - "" X-Page: @@ -184,16 +184,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XNA1RA6R0J3YTCNJJFC24E + - 01J9ZS6HCYQJPAXDJBVY9NMEKT X-Runtime: - - "0.075777" + - "0.133227" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 98.149833ms + duration: 160.147958ms - id: 3 request: proto: HTTP/1.1 @@ -205,7 +205,7 @@ interactions: host: git.matoski.com remote_addr: "" request_uri: "" - body: '{"name":"vault-generated-user-service-account-token","expires_at":"2024-10-13","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' + body: '{"name":"vault-generated-user-service-account-token","expires_at":"2024-10-14","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' form: {} headers: Accept: @@ -216,7 +216,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users/128/personal_access_tokens + url: https://git.matoski.com/api/v4/users/131/personal_access_tokens method: POST response: proto: HTTP/2.0 @@ -226,7 +226,7 @@ interactions: trailer: {} content_length: 291 uncompressed: false - body: '{"id":73,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-11T11:27:03.148Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":128,"last_used_at":null,"active":true,"expires_at":"2024-10-13","token":"glpat-eUzBBWbv9nP_iGgcsLRc"}' + body: '{"id":77,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:31.388Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":131,"last_used_at":null,"active":true,"expires_at":"2024-10-14","token":"glpat-ZvRxxbVNF6kXV5XfHsnn"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -235,9 +235,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:27:03 GMT + - Sat, 12 Oct 2024 07:13:31 GMT Etag: - - W/"e9e725b2708290b2b831daa9200af019" + - W/"3e8d015c0a830b4955782785c2589519" Server: - nginx Vary: @@ -247,14 +247,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNA1YG8NVEJWWSGE0RTAPA","version":"1"}' + - '{"correlation_id":"01J9ZS6HPWWMPKM5VDW3AGGA9T","version":"1"}' X-Request-Id: - - 01J9XNA1YG8NVEJWWSGE0RTAPA + - 01J9ZS6HPWWMPKM5VDW3AGGA9T X-Runtime: - - "0.053255" + - "0.059684" status: 201 Created code: 201 - duration: 75.480792ms + duration: 82.40575ms - id: 4 request: proto: HTTP/1.1 @@ -285,7 +285,7 @@ interactions: trailer: {} content_length: 276 uncompressed: false - body: '{"id":73,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-11T11:27:03.148Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":128,"last_used_at":"2024-10-11T11:27:03.311Z","active":true,"expires_at":"2024-10-13"}' + body: '{"id":77,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:31.388Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":131,"last_used_at":"2024-10-12T07:13:31.543Z","active":true,"expires_at":"2024-10-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -294,9 +294,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 11:27:03 GMT + - Sat, 12 Oct 2024 07:13:31 GMT Etag: - - W/"e9860fd38438b4b0bd1fd43eeee5063e" + - W/"76191cfbce819104706b54f9f4c117a3" Server: - nginx Vary: @@ -306,14 +306,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNA238H3KFTG248Q8PGW3Z","version":"1"}' + - '{"correlation_id":"01J9ZS6HW2KM7XMG4EHTKQX988","version":"1"}' X-Request-Id: - - 01J9XNA238H3KFTG248Q8PGW3Z + - 01J9ZS6HW2KM7XMG4EHTKQX988 X-Runtime: - - "0.092446" + - "0.041593" status: 200 OK code: 200 - duration: 113.698792ms + duration: 64.315583ms - id: 5 request: proto: HTTP/1.1 @@ -349,7 +349,7 @@ interactions: Cache-Control: - no-cache Date: - - Fri, 11 Oct 2024 11:27:03 GMT + - Sat, 12 Oct 2024 07:13:31 GMT Server: - nginx Vary: @@ -359,14 +359,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNA2AD2B5629TB0RJ4MYMS","version":"1"}' + - '{"correlation_id":"01J9ZS6J04AHMR1AWDB4SMDMFT","version":"1"}' X-Request-Id: - - 01J9XNA2AD2B5629TB0RJ4MYMS + - 01J9ZS6J04AHMR1AWDB4SMDMFT X-Runtime: - - "0.042040" + - "0.144704" status: 204 No Content code: 204 - duration: 64.01875ms + duration: 170.06675ms - id: 6 request: proto: HTTP/1.1 @@ -387,7 +387,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users/128 + url: https://git.matoski.com/api/v4/users/131 method: DELETE response: proto: HTTP/2.0 @@ -402,7 +402,7 @@ interactions: Cache-Control: - no-cache Date: - - Fri, 11 Oct 2024 11:27:03 GMT + - Sat, 12 Oct 2024 07:13:32 GMT Server: - nginx Vary: @@ -412,11 +412,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XNA2EF81JB21CSQSCDEFVM","version":"1"}' + - '{"correlation_id":"01J9ZS6JATV0HAS7CWYR32NKQP","version":"1"}' X-Request-Id: - - 01J9XNA2EF81JB21CSQSCDEFVM + - 01J9ZS6JATV0HAS7CWYR32NKQP X-Runtime: - - "0.033987" + - "0.032885" status: 204 No Content code: 204 - duration: 56.432708ms + duration: 55.29275ms