dependency-check / Dependency-Check_Action

Github action to run dependency check
MIT License
71 stars 31 forks source link

Scan argument will just scan folder inside the container? #23

Open ydmk opened 1 year ago

ydmk commented 1 year ago

Looking at the scan parameter https://github.com/dependency-check/Dependency-Check_Action/blob/1b5d19fd4a32ff0ff982e8c9d8e27dbf7ac8a46c/action.yml#L27-L28

If a . is provided here (as is the default), won't it just scan the home directory inside the container? github's working directory is mounted at /github/workspace (as indicated by the out parameter in https://github.com/dependency-check/Dependency-Check_Action/blob/1b5d19fd4a32ff0ff982e8c9d8e27dbf7ac8a46c/action.yml#L31-L32)

So doesn't /github/workspace need to be prefixed to inputs.path (if it's a relative path), to scan in github's actual workspace?

additionally what do you do if someone provides absolute paths (in this case and in the case of out)?

i can do a pr if needed

javixeneize commented 1 year ago

I think those paths are where the code is checked out, can’t remember by heart. That’s a parameter that can be modified anyway. When you execute it, it will show the absolute path it is using

ydmk commented 1 year ago
javixeneize commented 1 year ago

Ah, i see. I think both . and /github/workspace point to the same place, isnt it?

https://github.com/dependency-check/DependencyCheck_Test/actions/runs/6136166905/job/16650728404#step:5:8

There, it is mounting this as a volume

-v "/home/runner/work/DependencyCheck_Test/DependencyCheck_Test":"/github/workspace"

Sorry, its been long time since i built this

ydmk commented 1 year ago

Let me clarify it further.

. in your host is the same as /github/workspace in your container. This is documented in the github actions documentation, and, as you saw in your test, happens due to mounting the . of your host to your /github/workspace of the container.

Your executable runs inside the container. The arguments provided to the executable run from the context of inside the container.

Now when someone says that their scan param is ., they mean to say that the . of their own directory (which is the host's). However, what the executable interprets is . of the container, which is some directory inside the container where the exe is running (probably /home/root). For the executable to translate . to the correct directory (the . of the host), it needs to point to /github/workspace/.

ydmk commented 1 year ago

you basically need to prefix line 28 with the prefix you have in line 32 (/github/workspace)

javixeneize commented 1 year ago

Right ;)

fancy doing a pr with the change?

thanks