Skip to content

Commit fde61ef

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 8960cde commit fde61ef

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",
@@ -451,7 +453,8 @@
451453
"anyOf": [
452454
{
453455
"type": "string",
454-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
456+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
457+
"minLength": 1
455458
},
456459
{
457460
"type": "object",
@@ -638,7 +641,8 @@
638641
"anyOf": [
639642
{
640643
"type": "string",
641-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
644+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
645+
"minLength": 1
642646
},
643647
{
644648
"type": "object",
@@ -788,7 +792,8 @@
788792
"anyOf": [
789793
{
790794
"type": "string",
791-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
795+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
796+
"minLength": 1
792797
},
793798
{
794799
"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",
@@ -714,7 +716,8 @@
714716
"anyOf": [
715717
{
716718
"type": "string",
717-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
719+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
720+
"minLength": 1
718721
},
719722
{
720723
"type": "object",
@@ -901,7 +904,8 @@
901904
"anyOf": [
902905
{
903906
"type": "string",
904-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
907+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
908+
"minLength": 1
905909
},
906910
{
907911
"type": "object",
@@ -1051,7 +1055,8 @@
10511055
"anyOf": [
10521056
{
10531057
"type": "string",
1054-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
1058+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
1059+
"minLength": 1
10551060
},
10561061
{
10571062
"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",
@@ -450,7 +452,8 @@ const schema = {
450452
"anyOf": [
451453
{
452454
"type": "string",
453-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
455+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
456+
"minLength": 1
454457
},
455458
{
456459
"type": "object",
@@ -637,7 +640,8 @@ const schema = {
637640
"anyOf": [
638641
{
639642
"type": "string",
640-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
643+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
644+
"minLength": 1
641645
},
642646
{
643647
"type": "object",
@@ -787,7 +791,8 @@ const schema = {
787791
"anyOf": [
788792
{
789793
"type": "string",
790-
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)"
794+
"description": "Direct token value (SECURITY RISK: not recommended for production - use secrets or environment variables instead)",
795+
"minLength": 1
791796
},
792797
{
793798
"type": "object",

0 commit comments

Comments
 (0)