Skip to content
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

Release 2.12 #266

Merged
merged 25 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7d76656
Run auto fix on vulnerabilities
crokita Jun 2, 2021
4a8f380
Update redis package
crokita Jun 2, 2021
67903e2
Merge pull request #247 from smartdevicelink/bugfix/2-11-vulnerabilities
crokita Jun 10, 2021
c7d243d
Add navbar functionality to hamburger button in header and resize win…
renonick87 Jun 22, 2021
58e207e
Merge branch 'develop' of https://github.com/smartdevicelink/sdl_serv…
renonick87 Jun 22, 2021
bb3bea1
Cleanup comments and remove unused method
renonick87 Jun 23, 2021
ccc69a3
Update dropdown nav to include notifs for pending apps/functional gro…
renonick87 Jun 23, 2021
20b990c
Include methods to ensure pending apps count is updated in dropdown nav
renonick87 Jun 23, 2021
7e5e0d7
add staging endpoint for embedded app store
renonick87 Jun 25, 2021
161842c
rename staging endpoint for embedded app store
renonick87 Jun 25, 2021
6aa3dc3
Fix refresh issue on login page
renonick87 Jun 28, 2021
1786d4f
Add option to encrypt cert + key in module config
crokita Jun 28, 2021
27bcfd1
Merge pull request #249 from smartdevicelink/feature/navbar-toggle
renonick87 Jun 30, 2021
c288f5d
Include additional validation on some module_config values that would…
renonick87 Jul 1, 2021
3ef0003
Add non-static consumer message versioning
crokita Jul 2, 2021
e6531f9
Merge pull request #252 from smartdevicelink/feature/staging_app_store
renonick87 Jul 8, 2021
5128267
Merge pull request #255 from smartdevicelink/feature/module_config_in…
renonick87 Jul 8, 2021
641a656
Merge pull request #253 from smartdevicelink/feature/module-config-ce…
crokita Jul 14, 2021
1989b88
Merge pull request #257 from smartdevicelink/feature/message-versioning
crokita Jul 28, 2021
a939911
Add new route to promote staging state in module config
crokita Aug 10, 2021
4a804c6
Merge pull request #259 from smartdevicelink/bugfix/module-config-pro…
crokita Aug 13, 2021
ea7a939
Bump to version 2.12
crokita Oct 8, 2021
3e39552
Fix to logging error in error branch
crokita Oct 8, 2021
c5ea260
Merge pull request #265 from smartdevicelink/bugfix/sidenav-error
crokita Oct 19, 2021
5b41af1
Merge pull request #264 from smartdevicelink/feature/2-12-version
crokita Oct 27, 2021
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
2 changes: 2 additions & 0 deletions app/v1/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function exposeRoutes () {
app.put('/applications/groups', auth.validateAuth, applications.putFunctionalGroup);
// webengine app store
app.get('/applications/store', cors(), applications.getAppStore);
app.get('/applications/store/staging', cors(), applications.getStagingAppStore);
app.post('/webhook', applications.webhook); //webhook route
//begin policy table routes
app.options('/staging/policy', cors())
Expand All @@ -105,6 +106,7 @@ function exposeRoutes () {
app.get('/module', auth.validateAuth, moduleConfig.get);
app.post('/module', auth.validateAuth, moduleConfig.post);
app.post('/module/promote', auth.validateAuth, moduleConfig.promote);
app.post('/module/promoteNoId', auth.validateAuth, moduleConfig.promoteNoId);
app.get('/about', auth.validateAuth, about.getInfo);
app.post('/security/certificate', certificates.createCertificate);
app.post('/security/private', certificates.createPrivateKey);
Expand Down
36 changes: 36 additions & 0 deletions app/v1/applications/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,41 @@ function queryAndStoreCategories(callback) {
});
}

function getStagingAppStore (req, res, next) {
let filterObj = {
approval_status: 'STAGING',
platform: 'EMBEDDED',
};

if (req.query.uuid) {
filterObj.app_uuid = req.query.uuid;
}
if (req.query.transport_type) {
filterObj.transport_type = req.query.transport_type;
}

let chosenFlow = helper.createAppInfoFlow('multiFilter', filterObj);

const finalFlow = flow([
chosenFlow,
helper.appStoreTransformation.bind(null, req.query.min_rpc_version, req.query.min_protocol_version),
], { method: 'waterfall' });

finalFlow(function (err, apps) {
if (err) {
app.locals.log.error(err);
return res.parcel.setStatus(500)
.setMessage("Internal Server Error")
.deliver();
}
return res.parcel.setStatus(200)
.setData({
applications: apps,
})
.deliver();
})
}

function getAppStore (req, res, next) {
// only let embedded apps through
let filterObj = {
Expand Down Expand Up @@ -670,4 +705,5 @@ module.exports = {
updateAppCertificate: updateAppCertificate,
checkAndUpdateCertificates: checkAndUpdateCertificates,
getAppStore: getAppStore,
getStagingAppStore: getStagingAppStore,
};
13 changes: 12 additions & 1 deletion app/v1/messages/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = {
categoryByLanguage: getMessageCategoriesByLanguage,
categoryByMaxId: getMessageCategoriesByMaxId,
byIds: getMessagesByIdsStagingFilter,
groupsByIds: getMessageGroupsByIdsStagingFilter
groupsByIds: getMessageGroupsByIdsStagingFilter,
highestGroupId: getHighestMessageGroupId,
},
getMessageNamesStaging: getMessageNamesStaging,
getLanguages: getLanguages,
Expand All @@ -44,6 +45,16 @@ function getMessagesStatus (isProduction) {
}
}

//retrieve the highest id message group found
function getHighestMessageGroupId (isProduction) {
let viewName = isProduction ? 'view_message_group_production' : 'view_message_group_staging';

let sqlString = sql.select('MAX(id) AS id')
.from(viewName);

return sqlString.toString();
}

//retrieve message group information such as categories
function getMessageGroups (isProduction, category, hideDeleted = false) {
let viewName = isProduction ? 'view_message_group_production' : 'view_message_group_staging';
Expand Down
29 changes: 29 additions & 0 deletions app/v1/module-config/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,34 @@ function post(isProduction, req, res, next) {
}
}

function promoteNoId (req, res, next) {
if (res.parcel.message) {
return res.parcel.deliver();
}

// retrieve the staging config
const flow = helper.getModuleConfigFlow('status', false);

flow(function(err, data) {
if (err) {
app.locals.log.error(err);
return res.parcel
.setStatus(500)
.setMessage('Internal server error')
.deliver();
}
if (!certController.openSSLEnabled) { // cert gen not enabled
data.forEach(obj => {
delete obj.certificate;
delete obj.private_key
})
}
// modify the body and pass the express parameters along as if we are posting to production
req.body = data[0];
post(true, req, res, next);
});
}

function checkAndUpdateCertificate (cb) {
if (!certController.openSSLEnabled) {
if (cb) {
Expand Down Expand Up @@ -183,5 +211,6 @@ module.exports = {
get: get,
post: post.bind(null, false),
promote: post.bind(null, true),
promoteNoId: promoteNoId,
checkAndUpdateCertificate: checkAndUpdateCertificate
};
85 changes: 51 additions & 34 deletions app/v1/module-config/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ function validatePost (req, res) {
req.body.exchange_after_x_days -= 0;
req.body.timeout_after_x_seconds -= 0;

if (!check.number(req.body.exchange_after_x_ignition_cycles)) {
return setError("exchange_after_x_ignition_cycles required");
if (!check.number(req.body.exchange_after_x_ignition_cycles) ||
(check.number(req.body.exchange_after_x_ignition_cycles) && req.body.exchange_after_x_ignition_cycles > 255)) {
return setError("exchange_after_x_ignition_cycles required and should not exceed 255");
}
if (!check.number(req.body.exchange_after_x_kilometers)) {
return setError("exchange_after_x_kilometers required");
}
if (!check.number(req.body.exchange_after_x_days)) {
return setError("exchange_after_x_days required");
if (!check.number(req.body.exchange_after_x_days) ||
(check.number(req.body.exchange_after_x_days) && req.body.exchange_after_x_days > 255)) {
return setError("exchange_after_x_days required and should not exceed 255");
}
if (!check.number(req.body.timeout_after_x_seconds)) {
return setError("timeout_after_x_seconds required");
if (!check.number(req.body.timeout_after_x_seconds) ||
(check.number(req.body.timeout_after_x_seconds) && req.body.timeout_after_x_seconds > 65535)) {
return setError("timeout_after_x_seconds required and should not exceed 65535");
}
if (!check.array(req.body.seconds_between_retries)) {
return setError("seconds_between_retries required");
Expand Down Expand Up @@ -58,26 +61,33 @@ function validatePost (req, res) {
req.body.notifications_per_minute_by_priority.COMMUNICATION -= 0;
req.body.notifications_per_minute_by_priority.NORMAL -= 0;
req.body.notifications_per_minute_by_priority.NONE -= 0;
if (!check.number(req.body.notifications_per_minute_by_priority.EMERGENCY)) {
return setError("EMERGENCY notification count required");
if (!check.number(req.body.notifications_per_minute_by_priority.EMERGENCY) ||
(check.number(req.body.notifications_per_minute_by_priority.EMERGENCY) && req.body.notifications_per_minute_by_priority.EMERGENCY > 255)) {
return setError("EMERGENCY notification count required and should not exceed 255");
}
if (!check.number(req.body.notifications_per_minute_by_priority.NAVIGATION)) {
return setError("NAVIGATION notification count required");
if (!check.number(req.body.notifications_per_minute_by_priority.NAVIGATION) ||
(check.number(req.body.notifications_per_minute_by_priority.NAVIGATION) && req.body.notifications_per_minute_by_priority.NAVIGATION > 255)) {
return setError("NAVIGATION notification count required and should not exceed 255");
}
if (!check.number(req.body.notifications_per_minute_by_priority.PROJECTION)) {
return setError("PROJECTION notification count required");
if (!check.number(req.body.notifications_per_minute_by_priority.PROJECTION) ||
(check.number(req.body.notifications_per_minute_by_priority.PROJECTION) && req.body.notifications_per_minute_by_priority.PROJECTION > 255)) {
return setError("PROJECTION notification count required and should not exceed 255");
}
if (!check.number(req.body.notifications_per_minute_by_priority.VOICECOM)) {
return setError("VOICECOM notification count required");
if (!check.number(req.body.notifications_per_minute_by_priority.VOICECOM) ||
(check.number(req.body.notifications_per_minute_by_priority.VOICECOM) && req.body.notifications_per_minute_by_priority.VOICECOM > 255)) {
return setError("VOICECOM notification count required and should not exceed 255");
}
if (!check.number(req.body.notifications_per_minute_by_priority.COMMUNICATION)) {
return setError("COMMUNICATION notification count required");
if (!check.number(req.body.notifications_per_minute_by_priority.COMMUNICATION) ||
(check.number(req.body.notifications_per_minute_by_priority.COMMUNICATION) && req.body.notifications_per_minute_by_priority.COMMUNICATION > 255)) {
return setError("COMMUNICATION notification count required and should not exceed 255");
}
if (!check.number(req.body.notifications_per_minute_by_priority.NORMAL)) {
return setError("NORMAL notification count required");
if (!check.number(req.body.notifications_per_minute_by_priority.NORMAL) ||
(check.number(req.body.notifications_per_minute_by_priority.NORMAL) && req.body.notifications_per_minute_by_priority.NORMAL > 255)) {
return setError("NORMAL notification count required and should not exceed 255");
}
if (!check.number(req.body.notifications_per_minute_by_priority.NONE)) {
return setError("NONE notification count required");
if (!check.number(req.body.notifications_per_minute_by_priority.NONE) ||
(check.number(req.body.notifications_per_minute_by_priority.NONE) && req.body.notifications_per_minute_by_priority.NONE > 255)) {
return setError("NONE notification count required and should not exceed 255");
}

req.body.subtle_notifications_per_minute_by_priority.EMERGENCY -= 0;
Expand All @@ -87,26 +97,33 @@ function validatePost (req, res) {
req.body.subtle_notifications_per_minute_by_priority.COMMUNICATION -= 0;
req.body.subtle_notifications_per_minute_by_priority.NORMAL -= 0;
req.body.subtle_notifications_per_minute_by_priority.NONE -= 0;
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.EMERGENCY)) {
return setError("Subtle EMERGENCY notification count required");
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.EMERGENCY) ||
(check.number(req.body.subtle_notifications_per_minute_by_priority.EMERGENCY) && req.body.subtle_notifications_per_minute_by_priority.EMERGENCY > 255)) {
return setError("Subtle EMERGENCY notification count required and should not exceed 255");
}
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.NAVIGATION)) {
return setError("Subtle NAVIGATION notification count required");
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.NAVIGATION) ||
(check.number(req.body.subtle_notifications_per_minute_by_priority.NAVIGATION) && req.body.subtle_notifications_per_minute_by_priority.NAVIGATION > 255)) {
return setError("Subtle NAVIGATION notification count required and should not exceed 255");
}
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.PROJECTION)) {
return setError("Subtle PROJECTION notification count required");
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.PROJECTION) ||
(check.number(req.body.subtle_notifications_per_minute_by_priority.PROJECTION) && req.body.subtle_notifications_per_minute_by_priority.PROJECTION > 255)) {
return setError("Subtle PROJECTION notification count required and should not exceed 255");
}
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.VOICECOM)) {
return setError("Subtle VOICECOM notification count required");
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.VOICECOM) ||
(check.number(req.body.subtle_notifications_per_minute_by_priority.VOICECOM) && req.body.subtle_notifications_per_minute_by_priority.VOICECOM > 255)) {
return setError("Subtle VOICECOM notification count required and should not exceed 255");
}
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.COMMUNICATION)) {
return setError("Subtle COMMUNICATION notification count required");
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.COMMUNICATION) ||
(check.number(req.body.subtle_notifications_per_minute_by_priority.COMMUNICATION) && req.body.subtle_notifications_per_minute_by_priority.COMMUNICATION > 255)) {
return setError("Subtle COMMUNICATION notification count required and should not exceed 255");
}
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.NORMAL)) {
return setError("Subtle NORMAL notification count required");
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.NORMAL) ||
(check.number(req.body.subtle_notifications_per_minute_by_priority.NORMAL) && req.body.subtle_notifications_per_minute_by_priority.NORMAL > 255)) {
return setError("Subtle NORMAL notification count required and should not exceed 255");
}
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.NONE)) {
return setError("Subtle NONE notification count required");
if (!check.number(req.body.subtle_notifications_per_minute_by_priority.NONE) ||
(check.number(req.body.subtle_notifications_per_minute_by_priority.NONE) && req.body.subtle_notifications_per_minute_by_priority.NONE > 255)) {
return setError("Subtle NONE notification count required and should not exceed 255");
}
return;

Expand Down
3 changes: 2 additions & 1 deletion app/v1/policy/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ function setupModuleConfig (isProduction, useLongUuids = false) {
function setupConsumerFriendlyMessages (isProduction) {
const getMessages = flame.flow({
messageStatuses: setupSqlCommand.bind(null, messagesSql.getMessages.status(isProduction)),
messageGroups: setupSqlCommand.bind(null, messagesSql.getMessages.group(isProduction, false, true))
messageGroups: setupSqlCommand.bind(null, messagesSql.getMessages.group(isProduction, false, true)),
highestMessageGroupId: setupSqlCommand.bind(null, messagesSql.getMessages.highestGroupId(isProduction, false))
}, {method: 'parallel'});

const makeMessages = [
Expand Down
Loading