T09 · Insecure Skill Coding Practices
- Location
scripts/backup-to-gitee.sh:55- Finding
Personal access token exposed through command-line URLs and persistent Git configuration
- Content
View full analysis
/dev/null || { # If clone fails, repo might not exist - initialize new mkdir -p "$BACKUP_DIR" cd "$BACKUP_DIR" git init git remote add origin "$AUTH_REPO" } fi ``` ### Technical Analysis The setup script places the Gitee personal access token in an HTTP query string. Although HTTPS protects the request in transit, the complete URL may be visible in process arguments and can be retained by local diagnostics, proxies, or request logging systems. The backup script embeds the token directly into the Git remote URL. When the repository is cloned or the remote is added, that authenticated URL is normally written to `.git/config`. The token therefore remains in plaintext within the backup checkout after the command finishes. A repository-management token is more sensitive than the minimum credential material that should be retained by a backup process. Its persistence in a Git configuration file increases the duration and scope of exposure. ### Attack Path 1. A user exports a valid `GITEE_TOKEN` and runs the setup or backup script. 2. The token appears in a `curl` or `git` command-line URL. 3. During repository initialization, the tokenized URL is stored as the `origin` remote in `$BACKUP_DIR/.git/config`. 4. A local atta ...[truncated 685 chars]- Remediation
View remediation
