Repository navigation
Description
What happened
Security-Policy scored my repository 3/10 with:
score is 3: security policy file detected:
Warn: no linked content found
Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy
The repository's SECURITY.md contains, at the analysed commit, 2 URLs matching the check's own reURL, 1 address matching reEML, and 93 substrings matching reDIG. All three security-policy probes should evaluate true.
The check appears to detect the correct file but scan a different one.
Repro
- Repo:
tufantunc/ssh-mcp(public) - Analysed commit:
8c008907e420461042f84de761501bbe6927c382 - Scorecard
v5.5.0, viaossf/scorecard-action@v2.4.4 - Policy file:
SECURITY.mdat the repo root - Also present:
.review-pro/node/security.mdand.review-pro/ssh-mcp/security.md— unrelated code-review rubric files that happen to be namedsecurity.md
I edited SECURITY.md to add a plain email address and an explicit disclosure-timeline table, re-ran, and the score and both warnings were byte-identical. The run was fresh — Code-Review moved 1/19 → 1/20 and CI-Tests 22/29 → 23/29 in the same run.
Root cause (from reading the source)
Discovery and content-scanning use different matchers.
Discovery, checks/raw/security_policy.go — full-path, exact:
func isSecurityPolicyFilename(name string) bool {
return strings.EqualFold(name, "security.md") ||
strings.EqualFold(name, ".github/security.md") || ....review-pro/node/security.md correctly does not match, so the discovered policy file is the root SECURITY.md. Its path is then handed to the content pass:
err := fileparser.OnMatchingFileContentDo(c.RepoClient, fileparser.PathMatcher{
Pattern: data.files[idx].File.Path, // "SECURITY.md"
CaseSensitive: false,
}, checkSecurityPolicyFileContent, ...)But isMatchingPath in checks/fileparser/listing.go:38-48 falls back to the basename:
filename := path.Base(fullpath)
match, err := path.Match(pattern, fullpath)
// No match on the fullpath, let's try on the filename only.
if !match {
if match, err = path.Match(pattern, filename); err != nil { ... }
}So the pattern security.md matches .review-pro/node/security.md via its basename. And checkSecurityPolicyFileContent stops at the first file with non-empty content:
// stop here found something, no need to look further (false)
return false, nilWhichever security.md the file listing yields first wins. A dot-directory sorts before SECURITY.md.
Why this reconciles exactly
.review-pro/node/security.md is 23 lines with 0 URL matches, 0 email matches and 0 reDIG matches. Feeding it through the three probes:
| Probe | Condition | Result | Points |
|---|---|---|---|
securityPolicyContainsLinks |
(urls + emails) > 0 |
false | 0 of 6 |
securityPolicyContainsVulnerabilityDisclosure |
CountSecInfo(Text, false) > 1 |
false | 0 of 1 |
securityPolicyContainsText |
FileSize > 1 && FileSize > linkedContentLen + (urls+emails)*2 |
true | 3 of 3 |
Total: 3 — the observed score, including the counter-intuitive part where ContainsText passes while the other two fail, because it tests FileSize rather than the collected hits.
Impact
A project gets scored on the contents of an arbitrary file that merely shares a basename with a security policy. It is silent: the check reports "security policy file detected", so the maintainer sees a low score on a policy that plainly satisfies the documented criteria, and editing the real SECURITY.md changes nothing. security.md is not an unusual filename for docs, rubrics or templates in a subdirectory.
Suggested fix
Have the content pass address the exact path that discovery selected, rather than a pattern that can match elsewhere — e.g. fetch the file directly by path, or add an ExactPath option to PathMatcher that skips the basename fallback. The basename fallback is presumably load-bearing for other callers, so a per-call opt-out seems safer than changing isMatchingPath for everyone.
Note
I have not attached a debugger — the evidence is the published results, the source at v5.5.0, and the arithmetic above matching the observed score exactly. Happy to test a patch against the repo, which reproduces this on every run.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
daichunghy commentedon Aug 29, 2026
The exact-path boundary is the important part here. If discovery has already selected SECURITY.md, rerunning a basename matcher reopens ambiguity and makes the result depend on directory order. I would prefer an exact-path content fetch for this check, plus a regression fixture with root SECURITY.md and a nested security.md that contains no policy signals. That tests both correctness and keeps the general basename fallback untouched for other callers.
ci: fix two OpenSSF Scorecard findings (#102)
zsltg commentedon Oct 7, 2026
Another repository with the same defect:
zsltg/iqat commitee47cfcce6e0a3ce32eb76b54876d1463dc06a73, Scorecard v5.5.0 throughossf/scorecard-action@v2.4.4.Security-Policy scored 4 with
Warn: no linked content found. The rootSECURITY.mdcontains two URLs that matchreURL. The repository also has.agents/security.md, an index file for coding agents with no URLs. The textprobe and the disclosure probe passed, and only the link probe failed. This
agrees with your analysis: the content pass matched
.agents/security.mdby itsbase name and stopped there.
We ran the
reURLpattern and the line scan fromcollectPolicyHitson ourSECURITY.md, and they found both URLs.We renamed the file to work around the defect. After the rename, the same check
scored 10 on commit
a833917345ff7425d12b07b4505b0a97bae8f6dd, with no changeto
SECURITY.md. The first commitabove still shows the problem.
Generated by Claude Code
chore(repo): rename the agent security rules to secure-coding.md
ci: use the $/ form for local actions again (#182)
docs: warn agents not to name another file security.md