Skip to content

Commit 4350c81

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 22c637a commit 4350c81

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",
@@ -783,7 +787,8 @@
783787
"anyOf": [
784788
{
785789
"type": "string",
786-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
790+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
791+
"minLength": 1
787792
},
788793
{
789794
"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
@@ -286,7 +286,8 @@
286286
"anyOf": [
287287
{
288288
"type": "string",
289-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
289+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
290+
"minLength": 1
290291
},
291292
{
292293
"type": "object",
@@ -503,7 +504,8 @@
503504
"anyOf": [
504505
{
505506
"type": "string",
506-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
507+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
508+
"minLength": 1
507509
},
508510
{
509511
"type": "object",
@@ -709,7 +711,8 @@
709711
"anyOf": [
710712
{
711713
"type": "string",
712-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
714+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
715+
"minLength": 1
713716
},
714717
{
715718
"type": "object",
@@ -896,7 +899,8 @@
896899
"anyOf": [
897900
{
898901
"type": "string",
899-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
902+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
903+
"minLength": 1
900904
},
901905
{
902906
"type": "object",
@@ -1046,7 +1050,8 @@
10461050
"anyOf": [
10471051
{
10481052
"type": "string",
1049-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
1053+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
1054+
"minLength": 1
10501055
},
10511056
{
10521057
"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",
@@ -782,7 +786,8 @@ const schema = {
782786
"anyOf": [
783787
{
784788
"type": "string",
785-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
789+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
790+
"minLength": 1
786791
},
787792
{
788793
"type": "object",

0 commit comments

Comments
 (0)