Skip to content

Commit 17a11ca

Browse files
author
Nick Schwab
authored
Release 2.8.0
# 2.8.0 (October 30, 2019) Custom Vehicle Data, RPC Encryption, Widgets, and more. ### What's New * **Widgets**. Functional groups can now be flagged as a `widget` functional group on the group's details page to be automatically granted to applications requesting widget permissions. You can see if an application is requesting widget permissions during application review. More information about this feature can be found in the [Evolution Proposal](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0216-widget-support.md). * **Custom Vehicle Data**. Also known as "Generic Network Signal Data", this feature allows OEMs to define custom vehicle data items to be sent to Core, include the items within functional groups with applicable RPCs (such as `GetVehicleData`), flag functional groups as proprietary, and manually grant proprietary functional groups to applications during the review process. More information about this feature can be found in the [Evolution Proposal](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0173-Read-Generic-Network-Signal-data.md). * **RPC Encryption**. Functional groups can now be flagged as requiring encryption, which informs Core to require an application to use encryption when calling RPCs contained in the functional group. Applications can also be flagged as requiring encryption during the review process, which is used in conjunction with the functional group encryption flag. Additionally, OEMs may now configure SDL Server as a Certificate Authority to be used to generate and sign `module_config` certificates and application certificates. These certificates will auto-renew when they approach their expiration date and a new API has been added to allow OEM mobile security libraries to fetch application certificates. More information about this feature can be found in the [Evolution Proposal](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0207-rpc-message-protection.md). * **Passenger Mode**. OEMs can allow passengers to dismiss the SDL lock screen via a new checkbox on the Module Config page. More information about this feature can be found in the [Evolution Proposal](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md). * **New RPCs**. If you have not yet assigned new RPCs to functional groups prior to installing this update, the new RPCs will automatically be attempted to be added to the appropriate functional groups. The new RPCs are described in the Evolution Proposals for [Update Published App Services](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0225-update-published-app-services.md), [Cancel Interaction RPC](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0184-cancel-interaction.md), [Open Menu RPC](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md), [Remote Control - Allow Multiple Modules per Module Type](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0221-multiple-modules.md), and [Close Application RPC](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0115-close-application.md). * **Bug Fixes**. Various bug fixes, such as including extra back-end constraints on functional group assignments to ensure that certain group types are not automatically granted to apps even if they contain common RPCs the app has specifically requested. If you have any questions about this release or about SDL Policy Server in general, please join us in the `#sdl_server` channel of our public [Slack Organization](http://slack.smartdevicelink.com/).
2 parents 361f276 + 8f2095d commit 17a11ca

File tree

130 files changed

+7579
-577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+7579
-577
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ node_modules/
33
dist/
44
*.log
55
.env
6+
*.pem
7+
*.key
68

79
# Editor directories and files
810
.idea

app/v1/about/controller.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
const app = require('../app');
2-
const async = require('async');
32
const config = require('../../../settings.js');
43
const packageJson = require('../../../package.json'); //configuration module
54
const requestjs = require('request');
65
const semver = require('semver');
6+
const certificateController = require('../certificates/controller.js');
77

88
exports.getInfo = function (req, res, next) {
99
var data = {
1010
"current_version": packageJson.version,
1111
"latest_version": packageJson.version,
1212
"is_update_available": false,
13-
"ssl_port": config.policyServerPortSSL,
13+
"ssl_port": config.ssl.policyServerPort,
1414
"cache_module": config.cacheModule,
1515
"auth_type": config.authType,
1616
"auto_approve_all_apps": config.autoApproveAllApps,
17+
"encryption_required": config.autoApproveSetRPCEncryption,
1718
"base_url": app.locals.baseUrl,
1819
"notification": {
1920
"appsPendingReview": {
@@ -28,7 +29,8 @@ exports.getInfo = function (req, res, next) {
2829
"to_count": config.notification.appsPendingReview.email.to.split(",").length
2930
}
3031
}
31-
}
32+
},
33+
"certificate_authority": certificateController.openSSLEnabled
3234
};
3335

3436
requestjs({
@@ -43,6 +45,14 @@ exports.getInfo = function (req, res, next) {
4345
data.is_update_available = semver.lt(data.current_version, data.latest_version);
4446
data.update_type = semver.diff(data.current_version, data.latest_version);
4547
}
48+
if(data.certificate_authority){
49+
return certificateController.checkAuthorityValidity(function(isAuthorityValid){
50+
data.is_authority_valid = isAuthorityValid && data.certificate_authority;
51+
res.parcel.setStatus(200)
52+
.setData(data)
53+
.deliver();
54+
})
55+
}
4656

4757
res.parcel.setStatus(200)
4858
.setData(data)

app/v1/app.js

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ app.locals.version = path.basename(__dirname);
2727

2828
// construct base URL, e.g. "http://localhost:3000"
2929
app.locals.baseUrl = "http";
30-
if(app.locals.config.policyServerPort == 443) app.locals.baseUrl += "s";
30+
if(app.locals.config.ssl.policyServerPort) app.locals.baseUrl += "s";
3131
app.locals.baseUrl += "://" + app.locals.config.policyServerHost;
32-
if(![80,443].includes(app.locals.config.policyServerPort)) app.locals.baseUrl += ":" + app.locals.config.policyServerPort;
32+
if(app.locals.config.ssl.policyServerPort && app.locals.config.ssl.policyServerPort != 443){
33+
app.locals.baseUrl += ":" + app.locals.config.ssl.policyServerPort;
34+
}else if(app.locals.config.policyServerPort != 80){
35+
app.locals.baseUrl += ":" + app.locals.config.policyServerPort;
36+
}
3337

3438
//export app before requiring dependent modules to avoid circular dependency issues
3539
module.exports = app;
@@ -49,6 +53,8 @@ const services = require('./services/controller.js');
4953
const moduleConfig = require('./module-config/controller.js');
5054
const about = require('./about/controller.js');
5155
const auth = require('./middleware/auth.js');
56+
const certificates = require('./certificates/controller.js');
57+
const vehicleData = require('./vehicle-data/controller.js');
5258

5359
function exposeRoutes () {
5460
// use helmet middleware for security
@@ -66,7 +72,13 @@ function exposeRoutes () {
6672
app.post('/applications/administrator', auth.validateAuth, applications.administratorPost);
6773
app.post('/applications/passthrough', auth.validateAuth, applications.passthroughPost);
6874
app.post('/applications/hybrid', auth.validateAuth, applications.hybridPost);
75+
app.put('/applications/rpcencryption', auth.validateAuth, applications.rpcEncryptionPut);
6976
app.put('/applications/service/permission', auth.validateAuth, applications.putServicePermission);
77+
app.post('/applications/certificate/get', applications.getAppCertificate);
78+
app.get('/applications/certificate/get', applications.getAppCertificate);
79+
app.post('/applications/certificate', applications.updateAppCertificate);
80+
app.get('/applications/groups', auth.validateAuth, applications.getFunctionalGroups);
81+
app.put('/applications/groups', auth.validateAuth, applications.putFunctionalGroup);
7082
app.post('/webhook', applications.webhook); //webhook route
7183
//begin policy table routes
7284
app.post('/staging/policy', policy.postFromCoreStaging);
@@ -89,32 +101,41 @@ function exposeRoutes () {
89101
app.post('/module', auth.validateAuth, moduleConfig.post);
90102
app.post('/module/promote', auth.validateAuth, moduleConfig.promote);
91103
app.get('/about', auth.validateAuth, about.getInfo);
92-
}
93-
94-
function updatePermissionsAndGenerateTemplates (next) {
95-
permissions.update(function () {
96-
//generate functional group templates for fast responding to the UI for function group info
97-
//requires that permission information has updated
98-
groups.generateFunctionGroupTemplates(function () {
99-
log.info("Functional groups generated");
100-
if (next) {
101-
next();
102-
}
103-
});
104-
});
104+
app.post('/security/certificate', certificates.createCertificate);
105+
app.post('/security/private', certificates.createPrivateKey);
106+
//begin vehicle data routes
107+
app.post('/vehicle-data', auth.validateAuth, vehicleData.post);
108+
app.get('/vehicle-data', auth.validateAuth, vehicleData.get);
109+
app.post('/vehicle-data/promote', auth.validateAuth, vehicleData.promote);
110+
app.get('/vehicle-data/type', auth.validateAuth, vehicleData.getValidTypes);
105111
}
106112

107113
//do not allow routes to be exposed until these async functions are completed
108114
flame.async.parallel([
115+
//certificate expiration check and renewal for both applications and for the module config
116+
applications.checkAndUpdateCertificates,
117+
moduleConfig.checkAndUpdateCertificate,
109118
//get and store permission info from SHAID on startup
110-
updatePermissionsAndGenerateTemplates,
119+
function (next) {
120+
permissions.update(function () {
121+
log.info("Permissions updated");
122+
next();
123+
});
124+
},
111125
function (next) {
112126
// get and store app service type info from SHAID on startup
113127
services.upsertTypes(function () {
114128
log.info("App service types updated");
115129
next();
116130
});
117131
},
132+
function (next) {
133+
//get and store app categories from SHAID on startup
134+
applications.queryAndStoreCategories(function() {
135+
log.info('App categories updated');
136+
next();
137+
});
138+
},
118139
function (next) {
119140
//get and store language code info from the GitHub SDL RPC specification on startup
120141
messages.updateLanguages(function () {
@@ -129,11 +150,30 @@ flame.async.parallel([
129150
next();
130151
});
131152
},
153+
function(next) {
154+
vehicleData.updateRpcSpec(function() {
155+
log.info("RPC Spec updated");
156+
next();
157+
});
158+
},
132159
], function () {
133160
log.info("Start up complete. Exposing routes.");
134161
exposeRoutes();
135162
});
136163

137164
//cron job for running updates. runs once a day at midnight
138-
new Cron('00 00 00 * * *', updatePermissionsAndGenerateTemplates, null, true);
139-
new Cron('00 00 00 * * *', messages.updateLanguages, null, true);
165+
new Cron('00 00 00 * * *', permissions.update, null, true);
166+
new Cron('00 05 00 * * *', messages.updateLanguages, null, true);
167+
new Cron('00 10 00 * * *', applications.queryAndStoreCategories, null, true);
168+
new Cron('00 15 00 * * *', vehicleData.updateRpcSpec, null, true);
169+
new Cron('00 20 00 * * *', applications.checkAndUpdateCertificates, null, true);
170+
new Cron('00 25 00 * * *', moduleConfig.checkAndUpdateCertificate, null, true);
171+
172+
/* FOR TESTING
173+
new Cron('10 * * * * *', permissions.update, null, true);
174+
new Cron('20 * * * * *', messages.updateLanguages, null, true);
175+
new Cron('30 * * * * *', applications.queryAndStoreCategories, null, true);
176+
new Cron('40 * * * * *', vehicleData.updateRpcSpec, null, true);
177+
new Cron('50 * * * * *', applications.checkAndUpdateCertificates, null, true);
178+
new Cron('00 * * * * *', moduleConfig.checkAndUpdateCertificate, null, true);
179+
*/

0 commit comments

Comments
 (0)