grafana/pkg/services/sqlstore/migrations
Jo 06278615fb
Fix: Increase login_attempt.ip_address column length for IPv6 support (#107035)
* fix: increase login_attempt.ip_address column length for IPv6 support

- Expand ip_address column from VARCHAR(30) to VARCHAR(50) to accommodate IPv6 addresses
- Add database migration with support for PostgreSQL, MySQL, and SQLite
- Add comprehensive integration tests for various IPv6 address formats
- Resolves 500 errors when login fails over IPv6, now returns proper 401 errors

Fixes #106362

* test: add missing test skip to TestIntegrationIPv6AddressSupport

Skip integration test when running with -short flag to separate unit and integration tests

* Update pkg/services/sqlstore/migrations/login_attempt_mig.go

Co-authored-by: Victor Cinaglia <victor@grafana.com>

* fix missing bracket

* fix: resolve PostgreSQL timestamp overflow in IPv6 test

- Use controlled time mock instead of time.Now() to avoid timestamp conversion issues
- Follow existing test patterns with xormStore and mock time functions
- Add proper Since parameter to GetIPLoginAttemptCount query
- Fixes PostgreSQL error: 'pq: value "-62135596800" is out of range for type integer'

* fix: resolve PostgreSQL UTF-8 encoding error in IPv6 test

Replace string(rune(i)) with fmt.Sprintf to avoid null bytes (0x00)
when i=0, which caused 'invalid byte sequence for encoding UTF8' error

---------

Co-authored-by: Victor Cinaglia <victor@grafana.com>
2025-06-24 16:11:45 +02:00
..
accesscontrol Chore: Replace xorm.io/xorm imports (#104458) 2025-05-02 17:13:01 +02:00
anonservice
externalsession Auth: Increase name_id and session_id length to 1024 in user_external_session (#95352) 2024-10-24 17:14:38 +02:00
signingkeys
ssosettings
ualert Alerting: Persist alert instance FiredAt field (#105927) 2025-05-27 10:04:26 +01:00
usermig Remove support for Google Spanner database. (#105846) 2025-05-23 11:35:59 +02:00
alert_mig.go
annotation_mig.go Annotations: Use dashboard uids instead of dashboard ids (#106676) 2025-06-13 13:59:24 -05:00
apikey_mig.go
cache_data_mig.go
cloud_migrations.go MigrationAssistant: Restrict dashboards, folders and datasources by the org id of the signed in user (#96339) 2024-11-12 13:03:16 -06:00
common.go
correlations_mig.go
dashboard_acl.go
dashboard_mig.go Chore: Replace xorm.io/xorm imports (#104458) 2025-05-02 17:13:01 +02:00
dashboard_public_mig.go
dashboard_snapshot_mig.go
dashboard_version_mig.go Dashboards: Add apiVersion to dashboard table (#100845) 2025-03-04 07:47:45 +03:00
datasource_mig.go Fix: Change secure_json_data column data type to medium text only MYSQL (#102557) 2025-03-27 12:59:07 -04:00
db_file_storage.go
entity_events_mig.go
external_alertmanagers.go Chore: Replace xorm.io/xorm imports (#104458) 2025-05-02 17:13:01 +02:00
folder_mig.go Dashboards: Remove unique name constraints (#90687) 2024-10-29 08:58:39 +03:00
heartbeat_mig.go
kv_store_mig.go
libraryelements.go
login_attempt_mig.go Fix: Increase login_attempt.ip_address column length for IPv6 support (#107035) 2025-06-24 16:11:45 +02:00
migrations.go Alerting: Persist alert instance FiredAt field (#105927) 2025-05-27 10:04:26 +01:00
migrations_test.go Remove support for Google Spanner database. (#105846) 2025-05-23 11:35:59 +02:00
org_mig.go
playlist_mig.go
plugin_setting.go fix: make org_id not nullable and set default value (#95610) 2024-10-31 09:53:33 -04:00
preferences_mig.go Preferences: Use dashboard uid for the home dashboard (#106666) 2025-06-13 07:10:44 -05:00
query_history_mig.go
query_history_star_mig.go
quota_mig.go
secrets_mig.go
serverlock_migrations.go
session_mig.go
short_url_mig.go
star_mig.go Remove support for Google Spanner database. (#105846) 2025-05-23 11:35:59 +02:00
stats_mig.go
tag_mig.go
team_mig.go Team: Add columns external_uid and is_provisioned to the team table (#103285) 2025-04-04 11:00:14 +03:00
temp_user.go Chore: Replace xorm.io/xorm imports (#104458) 2025-05-02 17:13:01 +02:00
user_auth_mig.go SCIM: Validate provisioned users (#102099) 2025-03-24 09:28:51 +01:00
user_auth_token_mig.go Auth: Attach external session info to Grafana session (#93849) 2024-10-08 11:03:29 +02:00
user_mig.go Remove support for Google Spanner database. (#105846) 2025-05-23 11:35:59 +02:00