Skip to content

Commit 13ffb77

Browse files
committed
Disable code editor in the UI when modification disabled. Fix mispelling and renamed to match other SCRIPT_ prefixed settings
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 661be10 commit 13ffb77

File tree

16 files changed

+32
-16
lines changed

16 files changed

+32
-16
lines changed

k8s/cloud/base/api_deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ spec:
4040
name: pl-ory-service-config
4141
- configMapRef:
4242
name: pl-auth-connector-config
43+
- configMapRef:
44+
name: pl-script-bundles-config
4345
- configMapRef:
4446
name: pl-errors-config
4547
optional: true

k8s/cloud/base/proxy_nginx_config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ data:
3535
sub_filter '__CONFIG_DOMAIN_NAME__' "'${domain_name}'";
3636
sub_filter '__CONFIG_SCRIPT_BUNDLE_URLS__' "'${script_bundle_urls}'";
3737
sub_filter '__CONFIG_SCRIPT_BUNDLE_DEV__' "'${script_bundle_dev}'";
38+
sub_filter '__CONFIG_SCRIPT_MODIFICATION_DISABLED__' "'${script_modification_disabled}'";
3839
sub_filter '__SEGMENT_UI_WRITE_KEY__' "'${segment_ui_write_key}'";
3940
sub_filter '__SEGMENT_ANALYTICS_JS_DOMAIN__' "'segment.${domain_name}'";
4041
sub_filter '__CONFIG_LD_CLIENT_ID__' "'${ld_client_id}'";
@@ -134,6 +135,7 @@ data:
134135
set_by_lua_block $segment_cli_write_key { return os.getenv("PL_SEGMENT_CLI_WRITE_KEY") }
135136
set_by_lua_block $script_bundle_urls { return os.getenv("SCRIPT_BUNDLE_URLS") }
136137
set_by_lua_block $script_bundle_dev { return os.getenv("SCRIPT_BUNDLE_DEV") }
138+
set_by_lua_block $script_modification_disabled { return os.getenv("SCRIPT_MODIFICATION_DISABLED") }
137139
set_by_lua_block $analytics_enabled { return os.getenv("ANALYTICS_ENABLED") }
138140
set_by_lua_block $announcement_enabled { return os.getenv("ANNOUNCEMENT_ENABLED") }
139141
set_by_lua_block $announce_widget_url { return os.getenv("ANNOUNCE_WIDGET_URL") }
@@ -169,7 +171,8 @@ data:
169171
env PL_HYDRA_SERVICE;
170172
env PL_KRATOS_SERVICE;
171173
env SCRIPT_BUNDLE_URLS;
172-
env SCRIPT_BUNDE_DEV;
174+
env SCRIPT_BUNDLE_DEV;
175+
env SCRIPT_MODIFICATION_DISABLED;
173176
env ANALYTICS_ENABLED;
174177
env ANNOUNCEMENT_ENABLED;
175178
env ANNOUNCE_WIDGET_URL;

k8s/cloud/base/script_bundles_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ data:
99
"https://artifacts.px.dev/pxl_scripts/bundle.json"
1010
]
1111
SCRIPT_BUNDLE_DEV: "false"
12+
SCRIPT_MODIFICATION_DISABLED: "false"

k8s/cloud/dev/script_bundles_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ data:
1010
"https://artifacts.px.dev/pxl_scripts/bundle.json"
1111
]
1212
SCRIPT_BUNDLE_DEV: "false"
13+
SCRIPT_MODIFICATION_DISABLED: "false"

k8s/cloud/prod/script_bundles_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ data:
1010
"https://artifacts.px.dev/pxl_scripts/bundle.json"
1111
]
1212
SCRIPT_BUNDLE_DEV: "false"
13+
SCRIPT_MODIFICATION_DISABLED: "false"

k8s/cloud/public/base/script_bundles_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ data:
99
"https://artifacts.px.dev/pxl_scripts/bundle.json"
1010
]
1111
SCRIPT_BUNDLE_DEV: "false"
12+
SCRIPT_MODIFICATION_DISABLED: "false"

k8s/cloud/staging/script_bundles_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ data:
1010
"https://artifacts.px.dev/pxl_scripts/bundle.json"
1111
]
1212
SCRIPT_BUNDLE_DEV: "false"
13+
SCRIPT_MODIFICATION_DISABLED: "false"

k8s/cloud/testing/script_bundles_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ data:
1010
"https://artifacts.px.dev/pxl_scripts/bundle.json"
1111
]
1212
SCRIPT_BUNDLE_DEV: "false"
13+
SCRIPT_MODIFICATION_DISABLED: "false"

src/cloud/api/api_server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func init() {
6666

6767
pflag.String("auth_connector_name", "", "If any, the name of the auth connector to be used with Pixie")
6868
pflag.String("auth_connector_callback_url", "", "If any, the callback URL for the auth connector")
69-
pflag.Bool("disable_script_modification", false, "If script modification should be disallowed to prevent arbitrary script execution")
69+
pflag.Bool("script_modification_disabled", false, "If script modification should be disallowed to prevent arbitrary script execution")
7070
}
7171

7272
func main() {
@@ -221,8 +221,8 @@ func main() {
221221
sms := &controllers.ScriptMgrServer{ScriptMgr: sm}
222222
cloudpb.RegisterScriptMgrServer(s.GRPCServer(), sms)
223223

224-
disableScriptModification := viper.GetBool("disable_script_modification")
225-
vpt := ptproxy.NewVizierPassThroughProxy(nc, vc, sm, disableScriptModification)
224+
scriptModificationDisabled := viper.GetBool("script_modification_disabled")
225+
vpt := ptproxy.NewVizierPassThroughProxy(nc, vc, sm, scriptModificationDisabled)
226226
vizierpb.RegisterVizierServiceServer(s.GRPCServer(), vpt)
227227
vizierpb.RegisterVizierDebugServiceServer(s.GRPCServer(), vpt)
228228

src/cloud/api/ptproxy/vizier_pt_proxy.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ type scriptmgrClient interface {
5252
// VizierPassThroughProxy implements the VizierAPI and allows proxying the data to the actual
5353
// vizier cluster.
5454
type VizierPassThroughProxy struct {
55-
nc *nats.Conn
56-
vc vzmgrClient
57-
sm scriptmgrClient
58-
disableScriptModifiation bool
55+
nc *nats.Conn
56+
vc vzmgrClient
57+
sm scriptmgrClient
58+
scriptModificationDisabled bool
5959
}
6060

6161
// getServiceCredentials returns JWT credentials for inter-service requests.
@@ -65,8 +65,8 @@ func getServiceCredentials(signingKey string) (string, error) {
6565
}
6666

6767
// NewVizierPassThroughProxy creates a new passthrough proxy.
68-
func NewVizierPassThroughProxy(nc *nats.Conn, vc vzmgrClient, sm scriptmgrClient, disableScriptModifiation bool) *VizierPassThroughProxy {
69-
return &VizierPassThroughProxy{nc: nc, vc: vc, sm: sm, disableScriptModifiation: disableScriptModifiation}
68+
func NewVizierPassThroughProxy(nc *nats.Conn, vc vzmgrClient, sm scriptmgrClient, scriptModificationDisabled bool) *VizierPassThroughProxy {
69+
return &VizierPassThroughProxy{nc: nc, vc: vc, sm: sm, scriptModificationDisabled: scriptModificationDisabled}
7070
}
7171

7272
func (v *VizierPassThroughProxy) isScriptModified(ctx context.Context, script string) (bool, error) {
@@ -98,7 +98,7 @@ func (v *VizierPassThroughProxy) ExecuteScript(req *vizierpb.ExecuteScriptReques
9898
return err
9999
}
100100
defer rp.Finish()
101-
if v.disableScriptModifiation {
101+
if v.scriptModificationDisabled {
102102
modified, err := v.isScriptModified(srv.Context(), req.QueryStr)
103103
if err != nil {
104104
return err

0 commit comments

Comments
 (0)