Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions check_exposed.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ func Candidates(f *FileFacts, repo *Repo) (out []Candidate, notes []string) {
why = "a media library upload whose name suggests people's data"
case personal(name):
why = "the name suggests people's data"
case doc && !strings.Contains(rest, "/"):
why = "in the uploads folder itself, not the media library"
case doc:
why = "in a plugin's folder under uploads, not the media library"
default:
Expand Down
7 changes: 7 additions & 0 deletions check_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ func TestExposed(t *testing.T) {
if strings.Join(paths, " ") != "web/backup.sql web/app/uploads/old.zip web/app/uploads/2024/05/customers-export.xlsx web/app/uploads/gravity_forms/export/export-1700000000.csv web/app/uploads/gravity_forms/logs/gravityforms_0123abcd.txt web/app/uploads/sites/2/complianz/snapshots/policy.pdf web/app/uploads/wpallimport/files/asiakkaat_2019.csv web/app/uploads/wc-logs/x.log" {
t.Fatalf("candidates %v", paths)
}
// A document in uploads' own root is said to be there, not in a plugin's folder.
for _, c := range cands {
if want := map[string]string{"web/app/uploads/old.zip": "in the uploads folder itself, not the media library",
"web/app/uploads/sites/2/complianz/snapshots/policy.pdf": "in a plugin's folder under uploads, not the media library"}[c.Path]; want != "" && c.Why != want {
t.Errorf("%s: why %q, want %q", c.Path, c.Why, want)
}
}
n := strings.Join(notes, "\n")
for _, want := range []string{"1 documents in the media library", "1 Gravity Forms uploads", "oldest from 2020-09-13", "1 JSON files", "1 data files in plugins"} {
if !strings.Contains(n, want) {
Expand Down
Loading