RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/AGENTS.md/photoprism/photoprism

AGENTS.md

pkg/AGENTS.md
AGENTS.md

Quality

55/100

Scores the file, not the repository.

Length

308 words

4 headings · 0 code blocks

Repository

40k

— · pushed 0 days ago

Last changed

2 days ago

First indexed 2 days ago.
photoprism/photoprism/pkg/AGENTS.mdRawGitHub
1# Package Security & Test Guidelines
2 
3**Last Updated:** April 9, 2026
4 
5## Archive Extraction Security
6 
7- Always validate ZIP entry names with a safe join. Reject absolute paths, Windows drive or volume paths, and any entry that escapes the target directory after cleaning.
8- ZIP entry names use slash semantics, not host OS semantics: validate with `path.Clean` and `path.IsAbs`, reject backslashes, and use `path.Base` for hidden-name checks.
9- Convert ZIP names to OS paths only at write time with `filepath.FromSlash(...)`.
10- Enforce destination containment with `filepath.Rel(...)` rather than string-prefix checks.
11- Enforce per-file and total-size budgets to prevent resource exhaustion.
12- Skip OS metadata directories such as `__MACOSX` and reject suspicious names.
13- Keep tests for absolute and volume path rejection, traversal skipping, `__MACOSX` skipping, size limits, directory creation, and safe nested extraction.
14- The current implementation lives in `pkg/fs/zip.go` via `Unzip` and `UnzipFile`; containment is enforced by the shared `SafeJoin` helper in `pkg/fs/join.go` (also used by the WebDAV sync client and server upload handler).
15 
16## HTTP Download Security
17 
18- Use `pkg/http/safe` and `safe.Download(destPath, url, *safe.Options)` instead of ad-hoc `net/http` download code.
19- Default policy allows only `http` and `https`, enforces timeouts and max size, writes to a `0600` temp file, then renames into place.
20- For SSRF protection, set `AllowPrivate=false` unless a test explicitly needs private or loopback addresses.
21- Validate redirect targets and the final connected peer IP.
22- Prefer an image-focused `Accept` header for image downloads: `"image/jpeg, image/png, */*;q=0.1"`.
23- Use `internal/thumb/avatar.SafeDownload` for avatars and other small images; it applies a 15-second timeout, a 10 MiB cap, and `AllowPrivate=false`.
24- Tests using `httptest.Server` on `127.0.0.1` must set `AllowPrivate=true`.
25- Keep size budgets small and rely on `io.LimitReader` plus `Content-Length` prechecks.
26 
27## Focused Package Test Runs
28 
29- Filesystem copy, move, and unzip helpers: `go test ./pkg/fs -run 'Copy|Move|Unzip' -count=1`
30- Media helpers: `go test ./pkg/media/... -count=1`
31 
32 

Commands it names

  • go test ./pkg/fs -run 'Copy|Move|Unzip' -count=1
  • go test ./pkg/media/... -count=1

Sections

  • Package Security & Test Guidelines
  • Archive Extraction Security
  • HTTP Download Security
  • Focused Package Test Runs

What it covers

testcode-stylesecurity

Stack — with the evidence

go

(1.00)

eslint

(1.00)

ai-agent

(0.90)

vue

(0.70)

vite

(0.70)

vitest

(0.70)

javascript

(0.60)

docker

(0.60)

github-actions

(0.60)

Format

AGENTS.md

A plain-markdown README for coding agents, deliberately unopinionated: no frontmatter, no globs, no vendor keys. That minimalism is why it became the one file a dozen different agents will read, and why it carries the least per-file targeting power of any format here.

What the corpus says about it

Repository

Owner
photoprism
Language
—
License
—
Archived
no

All configs in this repo

Also in photoprism/photoprism

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
photoprism/photoprisminternal/config/AGENTS.md · 40kAGENTS.mdgoeslint+7databasedo-not46/1002 days ago
photoprism/photoprisminternal/entity/migrate/AGENTS.md · 40kAGENTS.mdgoeslint+7testtesting-strategydatabase63/1002 days ago
photoprism/photoprisminternal/photoprism/AGENTS.md · 40kAGENTS.mdgoeslint+7no sections39/1002 days ago
photoprism/photoprisminternal/service/cluster/AGENTS.md · 40kAGENTS.mdgoeslint+7buildtestapi76/1002 days ago
photoprism/photoprisminternal/commands/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyle66/1002 days ago
photoprism/photoprism.claude/CLAUDE.md · 40kCLAUDE.mdgoeslint+7buildtestlint-formatstyle+796/1002 days ago
photoprism/photoprism.github/copilot-instructions.md · 40kCopilot instructionsgoeslint+7buildtestlint-formatstyle+590/1002 days ago
photoprism/photoprism.github/instructions/backend.instructions.md · 40kCopilot instructionsgoeslint+7testlint-formatstyletypes+483/1002 days ago
photoprism/photoprism.github/instructions/frontend.instructions.md · 40kCopilot instructionsgoeslint+7testlint-formatstyleagent-behaviour76/1002 days ago
photoprism/photoprismAGENTS.md · 40kAGENTS.mdgoeslint+8setupbuildtestlint-format+882/1002 days ago
photoprism/photoprismfrontend/AGENTS.md · 40kAGENTS.mdgovitest+7setupteststyletesting-strategy+176/1002 days ago
photoprism/photoprisminternal/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyletesting-strategy71/1002 days ago
photoprism/photoprisminternal/api/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyletesting-strategyapi62/1002 days ago
Diff against internal/config/AGENTS.md Diff against internal/entity/migrate/AGENTS.md Diff against internal/photoprism/AGENTS.md Diff against internal/service/cluster/AGENTS.md Diff against internal/commands/AGENTS.md Diff against .claude/CLAUDE.md Diff against .github/copilot-instructions.md Diff against .github/instructions/backend.instructions.md Diff against .github/instructions/frontend.instructions.md Diff against AGENTS.md Diff against frontend/AGENTS.md Diff against internal/AGENTS.md Diff against internal/api/AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67kAGENTS.mdtypescriptbun+10setupbuildtestlint-format+6100/1002 days ago
TryGhost/Ghoste2e/AGENTS.md · 55kAGENTS.mdtypescriptjavascript+12setupteststylearch+2100/1003 days ago
duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5buildteststylearch+3100/1003 days ago
SkeneTechnologies/skene-cookbookAGENTS.md · 51AGENTS.mdpythoneslint+4setupbuildtestlint-format+7100/1002 days ago
mui/material-uiAGENTS.md · 99kAGENTS.mdtypescriptjavascript+13setupbuildtestlint-format+9100/1003 days ago
n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16buildteststylearch+3100/1003 days ago
trick77/agents-md-syncAGENTS.md · 2AGENTS.mdtypescriptnode+4setupbuildteststyle+5100/1003 days ago
ethereum/go-ethereumAGENTS.md · 51kAGENTS.mdgodocker+1buildtestlint-formatgit+1100/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack