w3c / w3c/css-validator

Exception in `IndexGenerator::generatesIndex` when served as deployed war

Open
#451 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
250
Forks
123
PR merge metrics
No merged PRs in 30d

Description

I'm serving css-validator as an unpacked war (in jetty)

The logs report

java.io.FileNotFoundException: /run/schroot/mount/dev/usr/share/css-validator/css-validator/WEB-INF/classes/org/w3c/css/index/../../../../validator.html.de (Permission denied)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:184)
        at org.w3c.css.index.IndexGenerator.generatesIndex(IndexGenerator.java:128)
        at org.w3c.css.servlet.CssValidator$1.run(CssValidator.java:164)

It is actually expected that the dir is not writable.

It looks like IndexGenerator::generatesIndex doesn't check for the files at the right location, and believes it has to create it (in the wrong location).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with IndexGenerator.java at line 128 and trace its call from CssValidator.java at line 164. Reproduce the validator as an unpacked WAR in Jetty, then verify that generatesIndex checks the files at the intended location and does not attempt a write when the deployed directory is read-only.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.