Skip to content

Commit 832cd96

Browse files
committed
fix: Add minLength validation to prevent empty tokens in schema
- Added minLength: 1 constraint to Token schema definition in shared.json - Prevents empty string tokens that would cause runtime HTTP errors - Regenerated all schema documentation files (.mdx) and TypeScript definitions - Ensures consistent validation across all connection types (GitHub, GitLab, Gitea, Bitbucket, Gerrit) This addresses CodeRabbit bot's review comment about preventing zero-length tokens at the schema level rather than failing at runtime during HTTP requests.
1 parent 8f2147c commit 832cd96

17 files changed

+66
-33
lines changed

docs/snippets/schemas/v3/bitbucket.schema.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"anyOf": [
2424
{
2525
"type": "string",
26-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
26+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
27+
"minLength": 1
2728
},
2829
{
2930
"type": "object",

docs/snippets/schemas/v3/connection.schema.mdx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"anyOf": [
2424
{
2525
"type": "string",
26-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
26+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
27+
"minLength": 1
2728
},
2829
{
2930
"type": "object",
@@ -240,7 +241,8 @@
240241
"anyOf": [
241242
{
242243
"type": "string",
243-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
244+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
245+
"minLength": 1
244246
},
245247
{
246248
"type": "object",
@@ -446,7 +448,8 @@
446448
"anyOf": [
447449
{
448450
"type": "string",
449-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
451+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
452+
"minLength": 1
450453
},
451454
{
452455
"type": "object",
@@ -633,7 +636,8 @@
633636
"anyOf": [
634637
{
635638
"type": "string",
636-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
639+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
640+
"minLength": 1
637641
},
638642
{
639643
"type": "object",
@@ -742,7 +746,8 @@
742746
"anyOf": [
743747
{
744748
"type": "string",
745-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
749+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
750+
"minLength": 1
746751
},
747752
{
748753
"type": "object",

docs/snippets/schemas/v3/gerrit.schema.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"anyOf": [
4343
{
4444
"type": "string",
45-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
45+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
46+
"minLength": 1
4647
},
4748
{
4849
"type": "object",

docs/snippets/schemas/v3/gitea.schema.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"anyOf": [
2020
{
2121
"type": "string",
22-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
22+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
23+
"minLength": 1
2324
},
2425
{
2526
"type": "object",

docs/snippets/schemas/v3/github.schema.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"anyOf": [
2020
{
2121
"type": "string",
22-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
22+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
23+
"minLength": 1
2324
},
2425
{
2526
"type": "object",

docs/snippets/schemas/v3/gitlab.schema.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"anyOf": [
2020
{
2121
"type": "string",
22-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
22+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
23+
"minLength": 1
2324
},
2425
{
2526
"type": "object",

docs/snippets/schemas/v3/index.schema.mdx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@
264264
"anyOf": [
265265
{
266266
"type": "string",
267-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
267+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
268+
"minLength": 1
268269
},
269270
{
270271
"type": "object",
@@ -481,7 +482,8 @@
481482
"anyOf": [
482483
{
483484
"type": "string",
484-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
485+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
486+
"minLength": 1
485487
},
486488
{
487489
"type": "object",
@@ -687,7 +689,8 @@
687689
"anyOf": [
688690
{
689691
"type": "string",
690-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
692+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
693+
"minLength": 1
691694
},
692695
{
693696
"type": "object",
@@ -874,7 +877,8 @@
874877
"anyOf": [
875878
{
876879
"type": "string",
877-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
880+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
881+
"minLength": 1
878882
},
879883
{
880884
"type": "object",
@@ -983,7 +987,8 @@
983987
"anyOf": [
984988
{
985989
"type": "string",
986-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
990+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
991+
"minLength": 1
987992
},
988993
{
989994
"type": "object",

docs/snippets/schemas/v3/shared.schema.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"anyOf": [
99
{
1010
"type": "string",
11-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
11+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
12+
"minLength": 1
1213
},
1314
{
1415
"type": "object",

packages/schemas/src/v3/bitbucket.schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const schema = {
2222
"anyOf": [
2323
{
2424
"type": "string",
25-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
25+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
26+
"minLength": 1
2627
},
2728
{
2829
"type": "object",

packages/schemas/src/v3/connection.schema.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const schema = {
2222
"anyOf": [
2323
{
2424
"type": "string",
25-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
25+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
26+
"minLength": 1
2627
},
2728
{
2829
"type": "object",
@@ -239,7 +240,8 @@ const schema = {
239240
"anyOf": [
240241
{
241242
"type": "string",
242-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
243+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
244+
"minLength": 1
243245
},
244246
{
245247
"type": "object",
@@ -445,7 +447,8 @@ const schema = {
445447
"anyOf": [
446448
{
447449
"type": "string",
448-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
450+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
451+
"minLength": 1
449452
},
450453
{
451454
"type": "object",
@@ -632,7 +635,8 @@ const schema = {
632635
"anyOf": [
633636
{
634637
"type": "string",
635-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
638+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
639+
"minLength": 1
636640
},
637641
{
638642
"type": "object",
@@ -741,7 +745,8 @@ const schema = {
741745
"anyOf": [
742746
{
743747
"type": "string",
744-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
748+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
749+
"minLength": 1
745750
},
746751
{
747752
"type": "object",

0 commit comments

Comments
 (0)