mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 06:53:20 +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,10 +1,13 @@
|
||||
/**
|
||||
* Copyright © 2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var Promise = require('bluebird')
|
||||
var _ = require('lodash')
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
const util = require('util')
|
||||
const adbkit = require('@devicefarmer/adbkit')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
@@ -38,7 +41,7 @@ module.exports = syrup.serial()
|
||||
throw new Error(util.format('Cleanup %s is not allowed!', folder))
|
||||
}
|
||||
})
|
||||
log.debug('Cleanup folders: %j', options.cleanupFolder)
|
||||
log.info('Cleanup folders: %j', options.cleanupFolder)
|
||||
|
||||
function listPackages() {
|
||||
return adb.getPackages(options.serial)
|
||||
@@ -56,14 +59,14 @@ module.exports = syrup.serial()
|
||||
return adb
|
||||
// get file size
|
||||
.shell(options.serial, util.format('du -h "%s"', filename))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
.then(function(output) {
|
||||
// output is in format: size filename. extract size;
|
||||
var size = output.toString().split('\t')[0]
|
||||
log.info('Removing %s (%s)', filename, size)
|
||||
return adb
|
||||
.shell(options.serial, util.format('rm -rf "%s"', filename))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.warn(util.format('Unable to clean %s folder', filename), err)
|
||||
@@ -149,7 +152,7 @@ module.exports = syrup.serial()
|
||||
, plugin.disableBluetooth
|
||||
, plugin.cleanFolders
|
||||
, function() {
|
||||
log.debug('Cleanup done')
|
||||
log.info('Cleanup done')
|
||||
}
|
||||
], function(fn) {
|
||||
return fn()
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/**
|
||||
* 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')
|
||||
var adbkit = require('@devicefarmer/adbkit')
|
||||
|
||||
var logger = require('../../../../util/logger')
|
||||
var wire = require('../../../../wire')
|
||||
@@ -35,7 +38,7 @@ module.exports = syrup.serial()
|
||||
var file = util.format('/data/local/tmp/minicap_%d.jpg', Date.now())
|
||||
return minicap.run('minicap-apk', util.format(
|
||||
'-P %s -s >%s', projectionFormat(), file))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
.then(function() {
|
||||
return adb.stat(options.serial, file)
|
||||
})
|
||||
@@ -55,7 +58,7 @@ module.exports = syrup.serial()
|
||||
})
|
||||
.finally(function() {
|
||||
return adb.shell(options.serial, ['rm', '-f', file])
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright © 2022 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
* Copyright © 2022-2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var util = require('util')
|
||||
@@ -10,7 +10,6 @@ var WebSocket = require('ws')
|
||||
var uuid = require('uuid')
|
||||
var EventEmitter = require('eventemitter3')
|
||||
var split = require('split')
|
||||
var adbkit = require('@devicefarmer/adbkit')
|
||||
|
||||
var logger = require('../../../../util/logger')
|
||||
var lifecycle = require('../../../../util/lifecycle')
|
||||
@@ -386,7 +385,7 @@ module.exports = syrup.serial()
|
||||
return Promise.all([
|
||||
output.waitForEnd()
|
||||
, adb.shell(options.serial, ['kill', signum, pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
.return(true)
|
||||
])
|
||||
.timeout(2000)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/**
|
||||
* Copyright © 2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var util = require('util')
|
||||
|
||||
var Promise = require('bluebird')
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var split = require('split')
|
||||
var EventEmitter = require('eventemitter3')
|
||||
var adbkit = require('@devicefarmer/adbkit')
|
||||
var Parser = require('@devicefarmer/adbkit/lib/adb/parser')
|
||||
|
||||
var wire = require('../../../../wire')
|
||||
var logger = require('../../../../util/logger')
|
||||
@@ -351,7 +353,7 @@ module.exports = syrup.serial()
|
||||
return Promise.all([
|
||||
output.waitForEnd()
|
||||
, adb.shell(options.serial, ['kill', signum, pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
.return(true)
|
||||
])
|
||||
.timeout(2000)
|
||||
@@ -379,7 +381,7 @@ module.exports = syrup.serial()
|
||||
TouchConsumer.prototype._readBanner = function(socket) {
|
||||
log.info('Reading minitouch banner')
|
||||
|
||||
var parser = new Parser(socket)
|
||||
var parser = new adb.Parser(socket)
|
||||
var banner = {
|
||||
pid: -1 // @todo
|
||||
, version: 0
|
||||
|
||||
Reference in New Issue
Block a user