Skip to content

Commit ecf0a82

Browse files
committed
feat: disable auto-revoke by default for new organizations
The api_token_inactivity_threshold_days column is now NULL by default, meaning the feature is opt-in rather than enabled for all organizations. Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
1 parent 6085408 commit ecf0a82

8 files changed

Lines changed: 11 additions & 15 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
-- Modify "organizations" table
2-
ALTER TABLE "organizations" ADD COLUMN "api_token_inactivity_threshold_days" bigint NULL DEFAULT 90;
2+
ALTER TABLE "organizations" ADD COLUMN "api_token_inactivity_threshold_days" bigint NULL;

app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:DZG5SuyNBB2e7Sl5ggvyQoGEzNLOeEdUlL3QwD/Cs0k=
1+
h1:zokBUIf1GE1Ih+WH8XycjROBmH2uLn+Kh6sw9vVhTl4=
22
20230706165452_init-schema.sql h1:VvqbNFEQnCvUVyj2iDYVQQxDM0+sSXqocpt/5H64k8M=
33
20230710111950-cas-backend.sql h1:A8iBuSzZIEbdsv9ipBtscZQuaBp3V5/VMw7eZH6GX+g=
44
20230712094107-cas-backends-workflow-runs.sql h1:a5rzxpVGyd56nLRSsKrmCFc9sebg65RWzLghKHh5xvI=
@@ -124,4 +124,4 @@ h1:DZG5SuyNBB2e7Sl5ggvyQoGEzNLOeEdUlL3QwD/Cs0k=
124124
20251217164302.sql h1:OL3OCqWsMtv06RfIlQNcdLMbt4Tz91Lijpbkxqwt7zM=
125125
20260112115927.sql h1:/RKhzT5dRphgeBitxBfo3a3fqLVgvmVZxxqe9fH8lkg=
126126
20260204113827.sql h1:rlJNf8QRfqOfDHf2GUi+59Rgv2BkSbMTPuMalPsMkZg=
127-
20260211225609.sql h1:40sd6S8ubdNzjDdRSBqAxElisky07OlSvJ0q8WmVjFk=
127+
20260211225609.sql h1:DTkyg3oZSV99uPGl+vOuK9FSlEumXwoYCgchUhsg/P4=

app/controlplane/pkg/data/ent/migrate/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ var (
432432
{Name: "policies_allowed_hostnames", Type: field.TypeJSON, Nullable: true},
433433
{Name: "prevent_implicit_workflow_creation", Type: field.TypeBool, Default: false},
434434
{Name: "restrict_contract_creation_to_org_admins", Type: field.TypeBool, Default: false},
435-
{Name: "api_token_inactivity_threshold_days", Type: field.TypeInt, Nullable: true, Default: 90},
435+
{Name: "api_token_inactivity_threshold_days", Type: field.TypeInt, Nullable: true},
436436
}
437437
// OrganizationsTable holds the schema information for the "organizations" table.
438438
OrganizationsTable = &schema.Table{

app/controlplane/pkg/data/ent/organization/organization.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/pkg/data/ent/organization_create.go

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/pkg/data/ent/runtime.go

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/pkg/data/ent/schema/organization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (Organization) Fields() []ent.Field {
5757
field.Bool("restrict_contract_creation_to_org_admins").Default(false),
5858
// api_token_inactivity_threshold_days is the number of days after which inactive API tokens are auto-revoked.
5959
// nil = disabled, any positive int = threshold in days
60-
field.Int("api_token_inactivity_threshold_days").Optional().Nillable().Default(90),
60+
field.Int("api_token_inactivity_threshold_days").Optional().Nillable(),
6161
}
6262
}
6363

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,13 @@ github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
10051005
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
10061006
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
10071007
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
1008+
github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM=
1009+
github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
1010+
github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI=
1011+
github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g=
10081012
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
1013+
github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY=
1014+
github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo=
10091015
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
10101016
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
10111017
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=

0 commit comments

Comments
 (0)