Skip to content

Commit 42ec1d9

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 23b05cd commit 42ec1d9

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
@@ -262,7 +262,8 @@
262262
"anyOf": [
263263
{
264264
"type": "string",
265-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
265+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
266+
"minLength": 1
266267
},
267268
{
268269
"type": "object",
@@ -479,7 +480,8 @@
479480
"anyOf": [
480481
{
481482
"type": "string",
482-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
483+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
484+
"minLength": 1
483485
},
484486
{
485487
"type": "object",
@@ -685,7 +687,8 @@
685687
"anyOf": [
686688
{
687689
"type": "string",
688-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
690+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
691+
"minLength": 1
689692
},
690693
{
691694
"type": "object",
@@ -872,7 +875,8 @@
872875
"anyOf": [
873876
{
874877
"type": "string",
875-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
878+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
879+
"minLength": 1
876880
},
877881
{
878882
"type": "object",
@@ -981,7 +985,8 @@
981985
"anyOf": [
982986
{
983987
"type": "string",
984-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
988+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
989+
"minLength": 1
985990
},
986991
{
987992
"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)