mcpField
G
glab-securefile

glab-securefile

github.com/vince-winkintel安全4995 次安装1 天前更新
代码仓库

关于 glab-securefile

glab securefile 是用于管理 GitLab CI/CD 安全文件的技能,可在仓库之外存储敏感文本或二进制文件,并按项目下载、更新和删除。

主要功能

  1. 01管理 CI/CD 安全文件
  2. 02按项目下载单个或全部文件
  3. 03校验下载文件的校验和
  4. 04按名称或 ID 更新和删除

适用场景

  1. 01为流水线下载证书或密钥文件
  2. 02替换项目中已存储的安全文件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/vince-winkintel/gitlab-cli-skills --skill glab-securefile

安装后在 Claude Code 中输入/glab-securefile确认已加载。

附带文件references/commands.md

详细介绍

glab securefile

概述


  Store up to 100 files for secure use in CI/CD pipelines. Secure files are                                             
  stored outside of your project's repository, not in version control.                                                  
  It is safe to store sensitive information in these files. Both plain text                                             
  and binary files are supported, but they must be smaller than 5 MB.                                                   
                                                                                                                        
         
  USAGE  
         
    glab securefile <command> [command] [--flags]  
            
  COMMANDS  
            
    create <name> <path>                                   Upload a new secure file to a project.
    download [<id> | --id <id> | --name <name>] [--flags]  Download one or more secure files from a project.
    get <id> [--flags]                                     Get details of a secure file by ID.
    list [--flags]                                         List secure files in a project.
    remove [<id> | --id <id> | --name <name>] [--flags]    Remove a secure file from a project.
    update <name> <path> [--flags]                         Update a secure file in a project.
         
  FLAGS  
         
    -h --help                          Show help for this command.
    -R --repo                          Select another repository. Can use either `OWNER/REPO` or `GROUP/NAMESPACE/REPO` format. Also accepts full URL or Git URL.

快速开始

glab securefile --help

glab securefile get 需要 GitLab 18.0 或更高版本。在较旧的 GitLab 实例上,请按 ID 或名称列出或下载,不要指望详情端点可用。

下载安全文件

使用 --all 下载所有 API 分页中的安全文件;下载范围不限于前 100 个结果。除非用户明确接受使用 --no-verify 或 --force-download 带来的风险,否则请保持校验和验证启用。

# Download every secure file to a controlled directory
glab securefile download --all --output-dir ./secure-files -R group/project

# Download one file to an absolute path; glab creates missing parents
glab securefile download 1 --path /tmp/secure/file.txt -R group/project

# Download all files to an absolute directory
glab securefile download --all --output-dir /tmp/secure-files -R group/project

请将目标位置视为敏感位置,将其放在版本控制范围之外,并在下载前确认目标项目。支持绝对路径的 --path 和 --output-dir 目标位置。对于 --all,glab 会拒绝可能逃逸出所选输出目录的服务器提供的名称。

删除安全文件

删除安全文件时,可使用位置参数中的数字 ID、--id,或通过 --name 指定准确的文件名:

# Interactive confirmation
glab securefile remove 1
glab securefile remove --id 1
glab securefile remove --name signing-certificate.p12

# Approved non-interactive deletion
glab securefile remove --name signing-certificate.p12 --yes

删除操作不可撤销。在非交互环境中,必须使用 --yes / -y。删除前请使用 -R/--repo 确认并验证目标项目;如果名称可能重复或存在歧义,优先使用 ID。

删除时只能选择一种标识方式:位置参数中的 ID、--id 或 --name。组合使用多个标识方式会直接报错,因此请先确定目标文件,然后只传入你要使用的那一种标识方式。

更新安全文件

使用准确的已存储名称和本地替换路径更新安全文件。除非设置了 --yes / -y,否则该命令会请求确认;overwrite 是一个别名。

# Interactive update
glab securefile update signing-certificate.p12 ./replacement.p12

# Approved non-interactive update in an explicit project
glab securefile update signing-certificate.p12 ./replacement.p12 \
  -R group/project --yes

如果内容未发生变化,则不会执行更新。更新成功后,安全文件的 ID 会发生变化,因此后续工作流应通过 --name 查找或下载该文件,或刷新 ID,而不要继续使用过时的 ID。绕过提示前,请确认目标项目、文件名和替换路径。

子命令

完整的 --help 输出请参阅 references/commands.md。

评论

支持 Markdown