Skip to content

Validate null constraint for token name

Emily Ring requested to merge 322745-validate-null-constraint into master

What does this MR do?

We recently added a name field to Clusters::AgentTokens and validated the field.

See related issue: #322745 (closed)

See previous MRs

This is the final MR which will validate_not_null_constraint on the new name field.

Migration

== 20210317155207 ValidateNotNullConstraintOnClusterTokenName: migrating ======
-- current_schema()
   -> 0.0002s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- execute("ALTER TABLE cluster_agent_tokens VALIDATE CONSTRAINT check_0fb634d04d;")
   -> 0.0040s
-- execute("RESET ALL")
   -> 0.0006s
== 20210317155207 ValidateNotNullConstraintOnClusterTokenName: migrated (0.0083s)

SELECT * FROM cluster_agent_tokens WHERE name IS NULL

https://console.postgres.ai/gitlab/gitlab-production-tunnel/sessions/2863/commands/9017

 Seq Scan on public.cluster_agent_tokens  (cost=0.00..4.22 rows=1 width=184) (actual time=1.936..1.937 rows=0 loops=1)
   Filter: (cluster_agent_tokens.name IS NULL)
   Rows Removed by Filter: 22
   Buffers: shared read=1
   I/O Timings: read=1.910

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #322745 (closed)

Edited by Emily Ring

Merge request reports