diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 148deb86c4c..d0d81ebc870 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -7,6 +7,14 @@ module API before { authenticate! } before { authorize! :admin_build, user_project } + helpers do + def filter_variable_parameters(params) + # This method exists so that EE can more easily filter out certain + # parameters, without having to modify the source code directly. + params + end + end + params do requires :id, type: String, desc: 'The ID of a project' end @@ -50,6 +58,7 @@ module API end post ':id/variables' do variable_params = declared_params(include_missing: false) + variable_params = filter_variable_parameters(variable_params) variable = user_project.variables.create(variable_params) @@ -75,6 +84,7 @@ module API break not_found!('Variable') unless variable variable_params = declared_params(include_missing: false).except(:key) + variable_params = filter_variable_parameters(variable_params) if variable.update(variable_params) present variable, with: Entities::Variable