Skip to content

📦 NEW: Add Fixinator Security Scan Github Action #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/fixinator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Fixinator

on:
push:
branches-ignore:
- "main"
- "master"
- "development"
# paths:
# - '**.cfc'
pull_request:
branches:
- main
- master
- development
# paths:
# - '**.cfc'

jobs:
audit:
name: Fixinator scan
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Run Fixinator Security Scan
uses: Ortus-Solutions/fixinator-action@v1
with:
api_key: ${{ secrets.FIXINATOR_KEY }}
path: ModuleConfig.cfc,models/**.cfc
confidence: medium
severity: low
3 changes: 2 additions & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ on:
- "main"
- "master"
- "development"
paths:
- '**.cfc'
pull_request:
branches:
- main
- master
- development
# Only run if *.cfc files are modified
paths:
- '**.cfc'

Expand Down
19 changes: 10 additions & 9 deletions models/Assets.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ component extends="BaseRequest" {

/**
* Create an asset report.
*
*
* @see https://plaid.com/docs/api/products/#asset_reportcreate
*
* @access_token
* @access_token
* @days_requested The maximum integer number of days of history to include in the Asset Report. If using Fannie Mae Day 1 Certainty, days_requested must be at least 61 for new originations or at least 31 for refinancings.
* @options
* @options
*/
public struct function createReport(
required string access_token,
Expand All @@ -23,13 +23,14 @@ component extends="BaseRequest" {
hyper.post(
url = settings.api_url & "/asset_report/create",
body = {
"client_id" : settings.api_client_id,
"secret" : settings.api_client_secret,
"access_tokens" : [ arguments.access_token ],
"days_requested": arguments.days_requested,
"options" : arguments.options
"client_id" : settings.api_client_id,
"secret" : settings.api_client_secret,
"access_tokens" : [ arguments.access_token ],
"days_requested" : arguments.days_requested,
"options" : arguments.options
}
)
);
}
}

}
7 changes: 4 additions & 3 deletions models/BaseRequest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ component {
property name="hyper" inject="HyperBuilder@hyper";

public component function init(){
var accessToken = queryExecute( "SELECT token from apiKeys WHERE userID='#url.userID#'" );
return this;
}

Expand Down Expand Up @@ -35,9 +36,9 @@ component {
}

throw(
message = message,
type = type,
detail = detail,
message = message,
type = type,
detail = detail,
extendedinfo = result
);
}
Expand Down
59 changes: 30 additions & 29 deletions tests/specs/unit/AccountsTest.cfc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Accounts"{
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Accounts" {

/*********************************** LIFE CYCLE Methods ***********************************/

Expand All @@ -14,18 +14,29 @@ component extends="coldbox.system.testing.BaseModelTest" model="models.Accounts"
super.setup();

variables.plaidAPISettings = {
api_url : "http://localhost",
api_client_id : "client-id-test-1",
api_client_secret: "client-secret-haha"
api_url : "http://localhost",
api_client_id : "client-id-test-1",
api_client_secret : "client-secret-haha"
};

variables.hyperMock = getMockBox().createMock( "hyper.models.HyperBuilder");
variables.hyperMock = getMockBox().createMock( "hyper.models.HyperBuilder" );
variables.hyperResponseMock = getMockBox().createMock( "hyper.models.HyperResponse" );

hyperMock.$( method = "post", callLogging = true, returns=hyperResponseMock, preserveReturnType=true );

model.$property( propertyName = "settings", mock=variables.plaidAPISettings );
model.$property( propertyName = "hyper", mock=hyperMock );
hyperMock.$(
method = "post",
callLogging = true,
returns = hyperResponseMock,
preserveReturnType = true
);

model.$property(
propertyName = "settings",
mock = variables.plaidAPISettings
);
model.$property(
propertyName = "hyper",
mock = hyperMock
);

// init the model object
model.init();
Expand All @@ -38,29 +49,19 @@ component extends="coldbox.system.testing.BaseModelTest" model="models.Accounts"
/*********************************** BDD SUITES ***********************************/

function run(){

describe( "cfplaid.models.Accounts Suite", function(){

describe( "getBalances", function(){
it( "should fetch account balances", function() {

it( "should fetch account balances", function(){
variables.hyperResponseMock.$property(
propertyName = "data",
mock = serializeJSON( { balances : [] } )
);
var result = variables.model.getBalances(
access_token = "secret-123"
);

expect( result ).toBeStruct( "should return deserialized JSON" )
.toHaveKey( "balances" );

});
});


});
var result = variables.model.getBalances( access_token = "secret-123" );

expect( result ).toBeStruct( "should return deserialized JSON" ).toHaveKey( "balances" );
} );
} );
} );
}

}
16 changes: 6 additions & 10 deletions tests/specs/unit/AssetsTest.cfc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Assets"{
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Assets" {

/*********************************** LIFE CYCLE Methods ***********************************/

Expand All @@ -24,12 +24,8 @@ component extends="coldbox.system.testing.BaseModelTest" model="models.Assets"{
/*********************************** BDD SUITES ***********************************/

function run(){

describe( "Assets Suite", function(){


});

} );
}

}
25 changes: 10 additions & 15 deletions tests/specs/unit/TokensTest.cfc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Tokens"{
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Tokens" {

/*********************************** LIFE CYCLE Methods ***********************************/

Expand All @@ -24,28 +24,23 @@ component extends="coldbox.system.testing.BaseModelTest" model="models.Tokens"{
/*********************************** BDD SUITES ***********************************/

function run(){

xdescribe( "models.Tokens Suite", function(){

it( "should createLink", function(){
expect( false ).toBeTrue();
});
} );

it( "should exchangeToken", function(){
expect( false ).toBeTrue();
});
} );

it( "should invalidateToken", function(){
expect( false ).toBeTrue();
});
} );

it( "should getLinkToken", function(){
expect( false ).toBeTrue();
});


});

} );
} );
}

}
20 changes: 8 additions & 12 deletions tests/specs/unit/Transactions.cfc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Transactions"{
* The base model test case will use the 'model' annotation as the instantiation path
* and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your
* responsibility to update the model annotation instantiation path and init your model.
*/
component extends="coldbox.system.testing.BaseModelTest" model="models.Transactions" {

/*********************************** LIFE CYCLE Methods ***********************************/

Expand All @@ -24,15 +24,11 @@ component extends="coldbox.system.testing.BaseModelTest" model="models.Transacti
/*********************************** BDD SUITES ***********************************/

function run(){

describe( "cfplaid.models.Transactions Suite", function(){

xit( "should getBalances", function(){
expect( false ).toBeTrue();
});

});

} );
} );
}

}
}