Commit 196fbfc
fix: leave GITHUB_TOKEN unset when the secret is absent
Review feedback from vladfrangu on #309.
`GITHUB_TOKEN="$(cat ... 2>/dev/null || true)"` always set the variable,
exporting an empty string to `camoufox fetch` when no secret was mounted.
Both consumers treat "" as absent today (camoufox-js 0.12.0
`pkgman.js:24`, camoufox 0.5.6 `pkgman.py:467` both test truthiness), so
nothing was broken, but the behaviour depended on that check.
Read the secret only when it is readable, so an absent or unreadable
file leaves the variable unset. `-r` rather than `-e` also covers the
non-root node stage losing `mode=0444`, which previously degraded to an
empty token instead of no token.
Assignment and export are split to keep shellcheck SC2155 quiet.
Also trims the comment blocks in both Dockerfiles.
Verified in buildkit on a non-root stage: no secret -> unset; secret
mounted -> token present; `mode=0444` removed -> unset, not empty.
hadolint matches baseline on both files, zero new findings.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 5d99792 commit 196fbfc
2 files changed
Lines changed: 14 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 139 | + | |
| 140 | + | |
143 | 141 | | |
144 | 142 | | |
145 | 143 | | |
146 | 144 | | |
147 | | - | |
148 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 107 | + | |
| 108 | + | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| |||
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | | - | |
119 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| |||
0 commit comments