common-workflow-language / common-workflow-language/cwltool

use unshare to enforce `networkAccess: false` when not running in a container

Open
#1,733 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

I guess users expect that `networkAccess: false` can restrict tools to access network but cwltool does not.

Currently I am not sure it is really the issue because the [spec](https://www.commonwl.org/v1.2/CommandLineTool.html#NetworkAccess) only says:

> If `networkAccess` is false or not specified, tools must not assume network access, except for localhost (the loopback device).

That is,
- this behavior is valid because the spec only requests tools not to assume network access but does not request platforms to restrict network access for tools
- users expect that `networkAccess: false` can restrict tools to access network, I guess
- I am not sure there is a reasonable way to restrict network access if the tool is not in a container

What do you think about it?

## How to reproduce

```console
$ cwltool curl.cwl
```

## Expected Behavior
It fails because `curl` needs network but `networkAccess: false` is specified.

## Actual Behavior
It does not fail.

```console
$ cwltool curl.cwl
INFO /opt/homebrew/bin/cwltool 3.1.20220830195442
INFO Resolved 'curl.cwl' to 'file:///Users/tanjo/tmp/net/curl.cwl'
INFO [job curl.cwl] /private/tmp/docker_tmpz4hne9ck$ curl \
-fsS \
https://www.commonwl.org/v1.2/index.html > /private/tmp/docker_tmpz4hne9ck/index.html
INFO [job curl.cwl] completed success
{
"out": {
"location": "file:///Users/tanjo/tmp/net/index.html",
"basename": "index.html",
"class": "File",
"checksum": "sha1$4a7d4583b995e2fb27980ddc4ce4a9e1b4ed3952",
"size": 6525,
"path": "/Users/tanjo/tmp/net/index.html"
}
}
INFO Final process status is success
```
## Workflow Code
```cwl
#!/usr/bin/env cwl-runner

requirements:
NetworkAccess:
networkAccess: false

class: CommandLineTool
cwlVersion: v1.2
baseCommand: curl
arguments:
- -fsS
- $(inputs.fsS)
inputs:
- id: fsS
type: string
default: https://www.commonwl.org/v1.2/index.html
outputs:
- id: out
type: stdout
stdout: index.html
```

## Full Traceback

No exceptions.

## Your Environment
* cwltool version:
```console
$ cwltool --version
/opt/homebrew/bin/cwltool 3.1.20220830195442
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.