BoxLang 🚀 A New JVM Dynamic Language Learn More...
This project is an example fw/1 application with secure single and two-factor (2FA) authentication and session management functions as follows:
admin
subsystemadmin
subsystemApplication.cfc
addDate
true/false parameter to uberHash function to append the current date to the input value on hashflushCache
to flushprod
(production) environment before running IP watching or blocking routinesipBlocked.html
file.Application.cfc
FW/1 initialization modelApplication.cfc
(off by default to maintain backwards compatibility). Code prior to this release has been moved to the legacy
branch.rekeyKeyRing()
has been added to the SecurityService to aid in rekeying your keyring for this change (and rekeying it in general) if upgrading from a previous release. You may alternatively uncomment a line in Application.cfc
to force legacy master key usage. Please see additional notes in the Application.cfc
for further details. Lucee 4.5 will continue to use the legacy hashing of the master key.Application.cfc
. Please see additional notes in the Application.cfc
for further details.rc.product
and rc.version
variables definitions and the dashboard view now uses the engine and engine version information derived from the application scopeThis code was put together for the ColdFusion: Code Security Best Practices
presentation by Denard Springle at NCDevCon 2015 and has since been transformed into a concise starting point for developers who need to create a secure application using the fw/1 CFML MVC framework.
This code has been expanded multiple times to include additional functionality not shown during the initial presentation. More details on how (and why) these security functions work and are important can be gleaned from reading the ColdFusion Security documents on CFDocs and from reviewing the SecurityService.cfc in /model/services/ which has been expanded for content. The code is ripe with comments to help aid in understanding how and why security features have been implemented and should be easy to pick up and run with for anyone with a passing familiarity of fw/1.
box install fw1-sa
twofactorauth
for your database in your CFML engine's admin (or change in Application.cfc
)Application.cfc
if running Lucee 5.x+)keyrings
folder to a location outside your webrootdevelopmentHmacKey
value in Application.cfc
(use generateSecretKey( 'HMACSHA512' )
)keyRingPath
location to where you moved the keyrings
folder to in Application.cfc
173
to some other integer number of iterations in Application.cfc
Application.cfc
(instead of c2VjdXJlX2F1dGhfbWFzdGVyX2tleQ==
)Application.cfc
(instead of UnRUcFBBS1hOQmgwem9XYg==
)Application.cfc
(instead of c2VjdXJlX2F1dGhfa2V5cmluZw==
)512
to some other integer number of iterations in Application.cfc
mid()
function of the hashed master key to start at a position other than 38
in a range from 1
to 106
cookieName
and dummyCookieOne
, dummyCookieTwo
and dummyCookieThree
values in Application.cfc
Application.cfc
as needed (see notes in Application.cfc
)check if the keyring is a valid array of keys
statement in Application.cfc
to prevent regeneration of a new keyring file after initial launch. See notes in Application.cfc
.NOTE If you are currently running a version of fw1-sa without the 2FA integration, then you'll need to complete the following steps before updating to the latest master branch:
If not using 2FA:
Application.cfc
(or MyApplication.cfc
if included in your distribution) so you can copy values for keyring and other application variables as needed.providerId
and phone
as additional fields before updatingIf using 2FA:
Application.cfc
(or MyApplication.cfc
if included in your distribution) so you can copy values for keyring and other application variables as needed.You can view single factor authentication using this code live at https://sa.vsgcom.net/
You can view two-factor authentication using this code live at https://tfa.vsgcom.net/
If you find any bugs or have a feature you'd like to see implemented in this code, please use the issues area here on GitHub to log them.
This project is actively being maintained and monitored by Denard Springle. If you would like to contribute to this example please feel free to fork, modify and send a pull request!
This project utilizes the free open source MVC CFML (ColdFusion) framework Framework One (fw/1) by Sean Corfield.
The use and distribution terms for this software are covered by the Apache Software License 2.0 (http://www.apache.org/licenses/LICENSE-2.0).
$
box install fw1-sa