netresearch/jira-skill / skills/jira-communication
jira-communication
FlaggedUse when handling Jira issues, sprints, boards, links, fields, worklogs, attachments, or users, or on any Jira intent without a key ("create/find a ticket", "pick a project"). Auto-triggers on Jira URLs and issue keys (PROJ-123). Also use when MCP Atlassian tools fail or are unavailable for Jira Server/DC.
references/attachments.md
View on GitHub<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<!-- SPDX-FileCopyrightText: Netresearch DTT GmbH -->
# Attachments — Upload and Download
## When to load
Load this reference whenever the user wants to attach a file to an issue, download an attachment, or work with attachment URLs (including any concerns about path traversal, size limits, or SSRF).
## Upload
```bash
# Simple upload (single file per invocation)
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py add PROJ-123 screenshot.png
# Preview (no upload, just show what would be sent)
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py add PROJ-123 /tmp/report.pdf --dry-run
# Multiple files — call `add` once per file
for file in a.png b.png c.pdf; do
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py add PROJ-123 "$file"
done
```
`jira-attachment.py add` takes a single `FILE_PATH` argument (absolute or relative) and only requires that the file exists and is readable. There is no `--allow-absolute` flag and no cwd-confinement on the upload side — validate paths in the caller if needed.
## Download
`jira-attachment.py download` takes two positional arguments: the attachment URL and the output file path. Find the URL via `jira-issue.py get --json` (the `fields.attachment[].content` field carries the download URL).
```bash
# Positional: full URL (or /rest/api/2/attachment/content/<id>) + output file
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py download \
"https://jira.example.com/rest/api/2/attachment/content/12345" \
./attachments/report.pdf
```
The output location is the **second positional argument** (`OUTPUT_FILE`), not an option. There is **no `--output-dir` flag** on `download` — passing one fails with `Error: No such option: --output-dir` (exit 2). To choose a directory, either include it in the `OUTPUT_FILE` path (as above) or use `download-all --dir <dir>` (the `--dir` flag exists only on the `download-all` subcommand, not on `download`).
### Verify the download succeeded
`jira-attachment.py download` carries Jira authentication (PAT via `Authorization: Bearer`, or Cloud basic auth) and refuses to save a redirect/login body as the file, exiting non-zero on failure. When scripting, always check the command's exit status to detect failures:
```bash
out=./attachments/report.pdf
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py download "$url" "$out" || {
echo "ERROR: download failed" >&2
exit 1
}
```
An unauthenticated or redirected fetch (e.g. a hand-rolled `curl`/`wget` that lands on the login page) yields a bad or empty file — but rely on the command's exit status, not a size test, to detect it: a size check masks the script's real error and falsely fails on legitimate 0-byte attachments.
## Download all attachments
To grab every attachment on an issue in one call (no need to harvest URLs first), use `download-all`. Files are saved under `--dir` (default cwd) using their original Jira filenames; duplicate names are disambiguated with the attachment id, and a filename that would escape `--dir` is skipped.
```bash
# All attachments into the current directory
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py download-all PROJ-123
# Into a specific directory (created if missing, must stay within cwd)
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py download-all PROJ-123 --dir ./attachments
# Preview the list without downloading
uv run ${CLAUDE_SKILL_DIR}/scripts/core/jira-attachment.py download-all PROJ-123 --dry-run
```
## Safety guarantees
- **Credentials stay on the Jira host**: `download` resolves `ATTACHMENT_URL` against `JIRA_URL` (a path such as `/rest/api/2/attachment/content/12345` is appended to `JIRA_URL`, keeping a context path like `/jira`) and sends the request only if the result is an `https://` URL whose host and port equal those of `JIRA_URL`; anything else exits non-zero without a request. `download-all` applies the same check to each attachment's `content` URL and skips the ones that fail it. Attachment downloads therefore need an `https://` `JIRA_URL`. A redirect from Jira (Cloud stores attachments on a CDN) is followed once, only to an `https://` location, and without credentials.
- **Path traversal**: output paths are constrained to the current working directory — the script rejects targets that resolve outside cwd. `cd` to the target directory before downloading. `download-all` additionally strips path components from each Jira-supplied filename and constrains it within `--dir`.
## Don't use raw curl
Fetching `/secure/attachment/...` URLs with plain `curl` returns the Jira login page, not the file — attachment downloads need the authenticated session handling this script provides. Always use `jira-attachment.py download`.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |