Skip to content

Commit

Permalink
Merge pull request #24 from digicatapult/dsbd-xx/bugfix
Browse files Browse the repository at this point in the history
DSBD-BUGFIX: a quick fix for including error message for UI.
  • Loading branch information
n3op2 committed Sep 13, 2022
2 parents c332549 + 7461f29 commit 3d1802f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
29 changes: 29 additions & 0 deletions integration/out-of-bounds-read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ describe('Tests aarch64 version', () => {
expect(response.body.status).to.contain('success')
})

test('Handles Exception - aarch64', async () => {
const response = await getOutOfBoundsReadAarch64(app, 'pass', 'abc', -28)

expect(response.status).to.equal(200)
expect(response.body.output).to.contain('Storing Secret...\nEnd index must be after start index')
expect(response.body.exception).to.deep.contain({
killed: false,
code: 1,
signal: null,
})
})

test('Bad Parameters - aarch64', async () => {
const response = await getOutOfBoundsReadAarch64(app, 'badpass', NaN, 'ttttttt')

Expand Down Expand Up @@ -50,6 +62,23 @@ describe('Tests Cheri version', () => {

expect(response.status).to.equal(200)
expect(response.body.status).to.contain('error')
expect(response.body).to.have.property('exception').that.deep.contain({
killed: false,
code: 162,
})
expect(response.body.output).to.contain('In-address space security exception')
})

test('Handles Exception - cheri', async () => {
const response = await getOutOfBoundsReadCheri(app, 'pass', 'abc', -28)

expect(response.status).to.equal(200)
expect(response.body.output).to.contain('Storing Secret...\nEnd index must be after start index')
expect(response.body.exception).to.deep.contain({
killed: false,
code: 1,
signal: null,
})
})

test('Bad Parameters - cheri', async () => {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digicatapult/morello-api",
"version": "0.6.6",
"version": "0.6.7",
"description": "An interface for executing binaries on it's self and morello host.",
"main": "src/index.ts",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/scenario/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ ${eof}`
this.log.debug({ msg: `executing ${bin} on ${this.address} host`, scp, ssh })

return new Promise((resolve) => {
exec(`${scp}; ${ssh}`, (err, stdout) => {
exec(`${scp}; ${ssh}`, (stderr, stdout, err) => {
exec(rm) // fire and forget, remove binary file
return resolve(
err
stderr
? {
status: 'error',
output: stdout,
exception: err,
output: err || stdout,
exception: stderr,
}
: {
status: 'success',
Expand Down

0 comments on commit 3d1802f

Please sign in to comment.