Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache path not working on v5 #11

Open
aszenz opened this issue Oct 24, 2023 · 1 comment
Open

Cache path not working on v5 #11

aszenz opened this issue Oct 24, 2023 · 1 comment

Comments

@aszenz
Copy link

aszenz commented Oct 24, 2023

As per docs on master:

To speed up security checks, you can cache the vulnerability database:
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: cache-db
with:
path: ~/.symfony/cache
key: db
- uses: symfonycorp/security-checker-action@v4

Using the @v5 version i get this in logs when running the post run cache action:

Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

Does @v5 (symfony-cli) use the same cache or a different path?

Also relates to #10

@spaze
Copy link
Contributor

spaze commented Feb 12, 2024

It seems that the cache file is created in /tmp (as returned by os.TempDir()):
https://github.com/symfony-cli/symfony-cli/blob/095d4b666113f80709fa539b5be96f325294d050/commands/local_check_security.go#L40-L47
(first line sets the cache-dir param default, the last line of that snippet uses it in security.NewDB(...)) but probably because v5 of the action now uses the Symfony image #9, the tempdir and the cache file inside that dir is inaccessible from the action inside the container.

When running the CLI tool locally, I get the file in /tmp/php_sec_db.json as created by local-php-security-checker, see https://github.com/fabpot/local-php-security-checker/blob/cbd9425bb8d853e7735fab277f8fba9d2aacff83/security/advisories.go#L71 but no file when running this action.

I see 2 ways forward:

  1. Remove the cache info from README (basically revert 9bf76f8)
  2. Update the container to have a temp dir accessible outside Docker and use the same dir in --cache-dir when calling the Symfony CLI tool, and then the same dir in actions/cache. RUNNER_TEMP env var may be handy, but maybe it's not, not a GitHub Actions expert unfortunately

spaze added a commit to spaze/michalspacek.cz that referenced this issue Feb 12, 2024
The file is created in `/tmp` but anyway, I think the cache action cannot access the file inside the Docker container.

See my comment here symfonycorp/security-checker-action#11 (comment)
spaze added a commit to spaze/michalspacek.cz that referenced this issue Feb 12, 2024
The file is created in `/tmp` but anyway, I think the cache action cannot access the file inside the Docker container.

See my comment here symfonycorp/security-checker-action#11 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants