-
Notifications
You must be signed in to change notification settings - Fork 0
feat: allow overriding the latex-environment source org/repo (#32) #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7560fe9
acf0495
5ae356a
06751a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,27 @@ | ||
| #! /bin/bash | ||
| # aldc: Add LaTeX DevContainer | ||
|
|
||
| REPOSITORY_NAME='latex-environment' | ||
| REPOSITORY_OWNER='smkwlab' | ||
| # Source of the LaTeX devcontainer. Defaults to smkwlab/latex-environment; | ||
| # other orgs can point aldc at their own fork via these env vars. | ||
| REPOSITORY_NAME="${ALDC_REPOSITORY_NAME:-latex-environment}" | ||
| REPOSITORY_OWNER="${ALDC_REPOSITORY_OWNER:-smkwlab}" | ||
| # REPOSITORY_OWNER goes into the download URL; REPOSITORY_NAME is additionally | ||
| # used as the extracted directory in `cd` / `rm -rf` below. Validate both: | ||
| # the GitHub login / repository character set, no leading dash (a leading `-` | ||
| # would be parsed as an option by cd/rm even when quoted), and — for the name — | ||
| # no dot-only / `..` traversal value. | ||
| case "$REPOSITORY_OWNER" in | ||
| ''|-*|*[!A-Za-z0-9-]*) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. こちらは誤検知と考えます。GitHub のユーザー名・組織名は「英数字と単一ハイフンのみ」で、アンダースコア |
||
| echo "Error: invalid ALDC_REPOSITORY_OWNER: ${REPOSITORY_OWNER}" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
Copilot marked this conversation as resolved.
|
||
| case "$REPOSITORY_NAME" in | ||
| ''|.|..|-*|*[!A-Za-z0-9._-]*) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
より重要な問題として、 EXTRACTED_DIR="${REPOSITORY_NAME}-${BRANCH}"
# cd "${EXTRACTED_DIR}" / rm -rf "${EXTRACTED_DIR}" として使用
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 実害はないと考えます。展開ディレクトリは常に |
||
| echo "Error: invalid ALDC_REPOSITORY_NAME: ${REPOSITORY_NAME}" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
Copilot marked this conversation as resolved.
|
||
| REPOSITORY_URL="https://github.com/${REPOSITORY_OWNER}/${REPOSITORY_NAME}" | ||
| BRANCH='release' | ||
| ZIP_NAME="${REPOSITORY_NAME}-${BRANCH}.zip" | ||
|
|
@@ -41,7 +60,9 @@ while [ $# -gt 0 ]; do | |
| echo " --help, -h Show this help message" | ||
| echo "" | ||
| echo "Environment Variables:" | ||
| echo " ALDC_QUIET=1 Enable quiet mode" | ||
| echo " ALDC_QUIET=1 Enable quiet mode" | ||
| echo " ALDC_REPOSITORY_OWNER Source org/user (default: smkwlab)" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ [LOW] ヘルプメッセージの列幅が揃っていません。
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. acf0495 で help の列を揃えました(説明列の開始位置を統一)。 |
||
| echo " ALDC_REPOSITORY_NAME Source repo (default: latex-environment)" | ||
| exit 0 | ||
| ;; | ||
| *) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,10 +10,24 @@ This document covers the development workflow, architecture, and technical detai | |
| - **Git Integration**: Automatic repository initialization and commit handling | ||
|
|
||
| ### Environment Source | ||
| - **Source Repository**: smkwlab/latex-environment | ||
| - **Source Repository**: smkwlab/latex-environment (default) | ||
| - **Branch**: release (stable releases) | ||
| - **Installation Method**: Downloads ZIP, extracts, and integrates files | ||
|
|
||
| The source is overridable for other-org deployments (defaults preserve | ||
| smkwlab behavior): | ||
|
|
||
| | Variable | Default | Purpose | | ||
| |----------|---------|---------| | ||
| | `ALDC_REPOSITORY_OWNER` | `smkwlab` | Org/user hosting the latex-environment fork. | | ||
| | `ALDC_REPOSITORY_NAME` | `latex-environment` | Repository name to download. | | ||
|
|
||
| `ALDC_REPOSITORY_OWNER` is used only in the download URL; `ALDC_REPOSITORY_NAME` | ||
| is additionally used as the extracted directory in `cd` / `rm -rf`. Both are | ||
| validated (GitHub character set, no leading dash, and — for the name — no `.` | ||
| or `..` traversal) before use. The release branch name is fixed to `release` | ||
| by convention. | ||
|
Comment on lines
+17
to
+29
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 06751a1 で対応しました。Security Considerations の「Downloads from official smkwlab repository only」を、既定は smkwlab/latex-environment だが ALDC_REPOSITORY_OWNER/NAME で override 可能(文字検証あり)である旨に更新しました。実装との不整合を解消しています。 |
||
|
|
||
| ## Installation Process | ||
|
|
||
| ### Process Flow | ||
|
|
@@ -65,7 +79,7 @@ texlive-ja-textlint (Docker base image) | |
| ## Configuration Details | ||
|
|
||
| ### Default Settings | ||
| - **Repository**: smkwlab/latex-environment | ||
| - **Repository**: smkwlab/latex-environment (override with `ALDC_REPOSITORY_OWNER` / `ALDC_REPOSITORY_NAME`) | ||
| - **Branch**: release (for stability) | ||
| - **Installation Location**: Current working directory | ||
| - **Backup Strategy**: Conflicts renamed with `-aldc` suffix | ||
|
|
@@ -99,7 +113,9 @@ texlive-ja-textlint (Docker base image) | |
|
|
||
| ## Security Considerations | ||
|
|
||
| - Downloads from official smkwlab repository only | ||
| - Downloads from smkwlab/latex-environment by default; the source is | ||
| overridable via `ALDC_REPOSITORY_OWNER`/`ALDC_REPOSITORY_NAME`, which are | ||
| character-validated (no path separators, leading dash, or `.`/`..`) | ||
| - Uses HTTPS for all network communications | ||
| - No external dependencies beyond standard unix tools | ||
| - Repository verification through GitHub's infrastructure | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ [LOW] [LOW]
REPOSITORY_OWNERのパターンに*-(末尾ダッシュ)の拒否が含まれていないGitHub のユーザー名・Organization 名は末尾にハイフンを置けない仕様です(
[A-Za-z0-9](-?[A-Za-z0-9])*相当)。現在のパターン''|-*|*[!A-Za-z0-9-]*)ではfoo-やfoo--barも通過します。セキュリティ上の直接的なリスクは低いですが、誤設定を早期に検出するという観点では、末尾ダッシュや連続ダッシュも拒否するとより堅牢になります。