Correct blocklist/allowlist language

This commit is contained in:
Eric Schultz 2020-10-05 14:51:18 -05:00 committed by Eric Schultz
parent 8c1fc8a032
commit 35402a0d18
5 changed files with 9 additions and 20 deletions

View file

@ -16,13 +16,13 @@ function on_ios11() {
, modalIframe: null , modalIframe: null
} }
const commitchange = windowAsAny.commitchange; const commitchange = windowAsAny.commitchange;
commitchange.getParamsFromUrl = (whitelist:any) => { commitchange.getParamsFromUrl = (allowlist:any) => {
var result:any = {}, var result:any = {},
tmp = []; tmp = [];
var items = location.search.substr(1).split("&"); var items = location.search.substr(1).split("&");
for (var index = 0; index < items.length; index++) { for (var index = 0; index < items.length; index++) {
tmp = items[index].split("="); tmp = items[index].split("=");
if (whitelist.indexOf(tmp[0])) result[tmp[0]] = decodeURIComponent(tmp[1]); if (allowlist.indexOf(tmp[0])) result[tmp[0]] = decodeURIComponent(tmp[1]);
} }
return result; return result;
} }

View file

@ -23,13 +23,13 @@ window.commitchange = {
, modalIframe: null , modalIframe: null
} }
commitchange.getParamsFromUrl = (whitelist) => { commitchange.getParamsFromUrl = (allowlist) => {
var result = {}, var result = {},
tmp = []; tmp = [];
var items = location.search.substr(1).split("&"); var items = location.search.substr(1).split("&");
for (var index = 0; index < items.length; index++) { for (var index = 0; index < items.length; index++) {
tmp = items[index].split("="); tmp = items[index].split("=");
if (whitelist.indexOf(tmp[0])) result[tmp[0]] = decodeURIComponent(tmp[1]); if (allowlist.indexOf(tmp[0])) result[tmp[0]] = decodeURIComponent(tmp[1]);
} }
return result; return result;
} }

View file

@ -18,7 +18,7 @@ import {ApiManager} from "../../lib/api_manager";
import * as CustomAPIS from "../../lib/apis"; import * as CustomAPIS from "../../lib/apis";
import {CSRFInterceptor} from "../../lib/csrf_interceptor"; import {CSRFInterceptor} from "../../lib/csrf_interceptor";
import {CreateOffsiteDonation, CreateOffsiteDonationModel} from "../../lib/api/create_offsite_donation"; import {CreateOffsiteDonation, CreateOffsiteDonationModel} from "../../lib/api/create_offsite_donation";
import blacklist from "validator/lib/blacklist"; import blocklist from "validator/lib/blacklist";
import * as _ from 'lodash'; import * as _ from 'lodash';
import moment from 'moment'; import moment from 'moment';
import { castToUndefinedIfBlank } from '../../lib/utils'; import { castToUndefinedIfBlank } from '../../lib/utils';
@ -140,14 +140,9 @@ class CreateNewOffsitePaymentPane extends React.Component<CreateOffsitePaymentPa
'gross_amount': createFieldDefinition({name: 'gross_amount', 'gross_amount': createFieldDefinition({name: 'gross_amount',
label: 'Gross Amount', label: 'Gross Amount',
input: (amount:number) => centsToDollars(amount), input: (amount:number) => centsToDollars(amount),
output: (dollarString:string) => parseFloat(blacklist(dollarString, '$,')), output: (dollarString:string) => parseFloat(blocklist(dollarString, '$,')),
value: 0 value: 0
}), }),
// 'fee_total': createFieldDefinition({name: 'fee_total', label: 'Fees',
// input: (amount:number) => centsToDollars(amount),
// output: (dollarString:string) => parseFloat(blacklist(dollarString, '$,')),
// value: 0
// }),
'date': createFieldDefinition({name: 'date', label: 'Date', 'date': createFieldDefinition({name: 'date', label: 'Date',
input: (isoTime:string) => this.nonprofitTimezonedDates.readable_date(isoTime), input: (isoTime:string) => this.nonprofitTimezonedDates.readable_date(isoTime),
output:(date:string) => this.nonprofitTimezonedDates.readable_date_time_to_iso(date), output:(date:string) => this.nonprofitTimezonedDates.readable_date_time_to_iso(date),

View file

@ -17,7 +17,7 @@ import {TwoColumnFields} from "../common/layout";
import {Validations} from "../../lib/vjf_rules"; import {Validations} from "../../lib/vjf_rules";
import * as _ from 'lodash' import * as _ from 'lodash'
import {Dedication, parseDedication, serializeDedication} from '../../lib/dedication'; import {Dedication, parseDedication, serializeDedication} from '../../lib/dedication';
import blacklist from "validator/lib/blacklist"; import blocklist from "validator/lib/blacklist";
import {createFieldDefinition} from "../../lib/mobx_utils"; import {createFieldDefinition} from "../../lib/mobx_utils";
import Modal from "../common/Modal"; import Modal from "../common/Modal";
import ReactInput from "../common/form/ReactInput"; import ReactInput from "../common/form/ReactInput";
@ -186,12 +186,12 @@ class EditPaymentPane extends React.Component<EditPaymentPaneProps & WrappedComp
'gross_amount': createFieldDefinition({ 'gross_amount': createFieldDefinition({
name: 'gross_amount', label: 'Gross Amount', value: this.props.data.gross_amount, name: 'gross_amount', label: 'Gross Amount', value: this.props.data.gross_amount,
input: (amount: number) => centsToDollars(amount), input: (amount: number) => centsToDollars(amount),
output: (dollarString: string) => parseFloat(blacklist(dollarString, '$,')) output: (dollarString: string) => parseFloat(blocklist(dollarString, '$,'))
}), }),
'fee_total': createFieldDefinition({ 'fee_total': createFieldDefinition({
name: 'fee_total', label: 'Fees', value: this.props.data.fee_total, name: 'fee_total', label: 'Fees', value: this.props.data.fee_total,
input: (amount: number) => centsToDollars(amount), input: (amount: number) => centsToDollars(amount),
output: (dollarString: string) => parseFloat(blacklist(dollarString, '$,')) output: (dollarString: string) => parseFloat(blocklist(dollarString, '$,'))
}), }),
'date': createFieldDefinition({ 'date': createFieldDefinition({
name: 'date', label: 'Date', name: 'date', label: 'Date',

View file

@ -68,12 +68,6 @@ module Commitchange
# like if you have constraints or database-specific column types # like if you have constraints or database-specific column types
config.active_record.schema_format = :sql config.active_record.schema_format = :sql
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
# config.active_record.whitelist_attributes = true
# Enable the asset pipeline # Enable the asset pipeline
config.assets.enabled = true config.assets.enabled = true