Skip to content

Commit 10094f7

Browse files
committed
- **CRITICAL**: Fixed JwtService.toEpoch() and fromEpoch() producing incorrect epoch seconds on non-UTC servers. The ISO-8601 baseline string combined with dateConvert("utc2local", ...) caused a double timezone shift. Now uses parseDateTime("1970-01-01T00:00:00Z") directly, producing correct JWT iat/exp claims on any server timezone. (Affects versions 3.5.0–3.7.0)
1 parent 58205a9 commit 10094f7

21 files changed

Lines changed: 2974 additions & 32 deletions

.cfconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"clob":"true",
2323
"connectionLimit":"100",
2424
"connectionTimeout":"1",
25-
"custom":"useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC&useLegacyDatetimeCode=true&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true",
25+
"custom":"useUnicode=true&characterEncoding=UTF-8&connectionTimeZone=UTC&forceConnectionTimeZoneToSession=true&useSSL=false&allowPublicKeyRetrieval=true&useServerPrepStmts=false&cachePrepStmts=false",
2626
"database":"cbsecurity",
2727
"dbdriver":"MySQL",
2828
"dsn":"jdbc:mysql://{host}:{port}/{database}",

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
### Fixed
13+
14+
- **CRITICAL**: Fixed `JwtService.toEpoch()` and `fromEpoch()` producing incorrect epoch seconds on non-UTC servers. The ISO-8601 baseline string combined with `dateConvert("utc2local", ...)` caused a double timezone shift. Now uses `parseDateTime("1970-01-01T00:00:00Z")` directly, producing correct JWT `iat`/`exp` claims on any server timezone. (Affects versions 3.5.0–3.7.0)
15+
1216
## [3.7.0] - 2026-01-14
1317

1418
### Changed

models/jwt/JwtService.cfc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ component accessors="true" singleton threadsafe {
652652
function toEpoch( required target ){
653653
return dateDiff(
654654
"s",
655-
dateConvert( "utc2local", "1970-01-01T00:00:00" ),
655+
parseDateTime( "1970-01-01T00:00:00Z" ),
656656
arguments.target
657657
);
658658
}
@@ -665,8 +665,8 @@ component accessors="true" singleton threadsafe {
665665
function fromEpoch( required target ){
666666
return dateAdd(
667667
"s",
668-
arguments.target, // should be in utc
669-
dateConvert( "utc2local", "1970-01-01T00:00:00" )
668+
arguments.target,
669+
parseDateTime( "1970-01-01T00:00:00Z" )
670670
);
671671
}
672672

server-boxlang-cfml@1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"JVM":{
2121
"heapSize":"1024",
2222
"javaVersion":"openjdk21_jre",
23-
"args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888"
23+
"args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777"
2424
},
2525
"openBrowser":false,
2626
"cfconfig":{

server-boxlang-cfml@be.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"JVM":{
2020
"heapSize":"1024",
2121
"javaVersion":"openjdk21_jre",
22-
"args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888"
22+
"args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777"
2323
},
2424
"openBrowser": false,
2525
"cfconfig":{

server-boxlang@1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"JVM":{
2020
"heapSize":"1024",
2121
"javaVersion":"openjdk21_jre",
22-
"args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888"
22+
"args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777"
2323
},
2424
"openBrowser": false,
2525
"cfconfig":{

test-harness/config/Application.cfc

Lines changed: 0 additions & 9 deletions
This file was deleted.

test-harness/config/Coldbox.cfc

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Configure ColdBox Application
33
function configure(){
44
// coldbox directives
5-
coldbox = {
5+
variables.coldbox = {
66
// Application Setup
77
appName : "Module Tester",
88
// Development Settings
@@ -31,21 +31,13 @@
3131
// environment settings, create a detectEnvironment() method to detect it yourself.
3232
// create a function with the name of the environment so it can be executed if that environment is detected
3333
// the value of the environment is a list of regex patterns to match the cgi.http_host.
34-
environments = { development : "localhost,127\.0\.0\.1" };
35-
36-
// Module Directives
37-
modules = {
38-
// An array of modules names to load, empty means all of them
39-
include : [],
40-
// An array of modules names to NOT load, empty means none
41-
exclude : []
42-
};
34+
variables.environments = { development : "localhost,127\.0\.0\.1" };
4335

4436
// Register interceptors as an array, we need order
45-
interceptors = [];
37+
variables.interceptors = [];
4638

4739
// LogBox DSL
48-
logBox = {
40+
variables.logBox = {
4941
// Define Appenders
5042
appenders : {
5143
files : {
@@ -62,10 +54,10 @@
6254
};
6355

6456
// Module Settings
65-
moduleSettings = {
57+
variables.moduleSettings = {
6658
// CBDebugger
6759
cbdebugger : {
68-
modules : { enabled : true, expanded : false }
60+
modules : { enabled : false, expanded : false }
6961
},
7062
// CB Auth
7163
cbAuth : { userServiceClass : "UserService" },

test-harness/handlers/Public.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ component {
3737
}
3838

3939
function toEpoch( required target ){
40-
return dateDiff( "s", dateConvert( "utc2local", "1970-01-01T00:00:00Z" ), arguments.target );
40+
return dateDiff( "s", parseDateTime( "1970-01-01T00:00:00Z" ), arguments.target );
4141
}
4242

4343
function fromEpoch( required target ){
44-
return dateAdd( "s", arguments.target, dateConvert( "utc2local", "1970-01-01T00:00:00Z" ) );
44+
return dateAdd( "s", arguments.target, parseDateTime( "1970-01-01T00:00:00Z" ) );
4545
}
4646

4747
}

0 commit comments

Comments
 (0)