mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:03:30 +02:00
Upgrading STF for security reasons (#813)
* Upgrading STF for security reasons Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update semaphore files Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * upgrading STF for security reasons v2 Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update yarn.lock file Signed-off-by: Denis barbaron <denis.barbaron@orange.com> --------- Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Copyright © 2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var util = require('util')
|
||||
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
@@ -9,7 +13,6 @@ var pathutil = require('../../../util/pathutil')
|
||||
var streamutil = require('../../../util/streamutil')
|
||||
var promiseutil = require('../../../util/promiseutil')
|
||||
var logger = require('../../../util/logger')
|
||||
const adbkit = require('@devicefarmer/adbkit')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
@@ -101,16 +104,16 @@ module.exports = syrup.serial()
|
||||
|
||||
function grantPermission(permission, minSdk) {
|
||||
if (minSdk && sdk.level < minSdk) {
|
||||
log.debug('SDK version (%d) is lower than %d, permission %s not supported',
|
||||
log.warn('SDK version (%d) is lower than %d, permission %s not supported',
|
||||
sdk.level, minSdk, permission)
|
||||
return Promise.resolve()
|
||||
}
|
||||
log.debug('Granting permission to STFService: ' + permission)
|
||||
log.info('Granting permission to STFService: ' + permission)
|
||||
return adb.shell(options.serial, [
|
||||
'pm', 'grant', resource.pkg, permission])
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
.then(function() {
|
||||
log.debug('Permission granted %s', permission)
|
||||
log.info('Permission granted %s', permission)
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Failed to grant permission %s: %s', permission, err)
|
||||
|
||||
Reference in New Issue
Block a user