Validate Firebase deploy config - #649
Conversation
Greptile SummaryThis PR adds an input-validation layer to the Firebase deploy target, rejecting blank values, comma-containing
Confidence Score: 4/5Safe to merge; the validation logic is sound and tests cover the main failure modes. The projectId guard allows uppercase letters, dots, and underscores that the Firebase CLI will reject, so a misconfigured project ID can still reach the CLI and produce a confusing error instead of the helpful message introduced here. Normalization also runs 3–4 times per build/ship call due to each helper re-normalizing, which is wasteful but doesn't break anything. packages/targets/deploy-firebase/src/index.ts — the projectId regex and the repeated normalizedConfig calls in the helper chain. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[build / ship called] --> B[normalizedConfig]
B --> C{validation}
C -- projectId invalid --> E[throw Error]
C -- only entry blank/comma --> E
C -- message/config blank --> E
C -- valid --> D[normalized Config]
D --> F[renderPlan / deployArgs]
F --> G[normalizedConfig called again]
G --> H[configPath]
H --> I[normalizedConfig called again]
I --> J[write plan / exec firebase CLI]
|
| if (!/^[A-Za-z0-9._-]+$/.test(id)) { | ||
| throw new Error('deploy-firebase projectId must contain only letters, numbers, dots, underscores, or hyphens'); | ||
| } |
There was a problem hiding this comment.
The
projectId regex ^[A-Za-z0-9._-]+$ is more permissive than Firebase's actual constraints. Real Firebase project IDs allow only lowercase letters, digits, and hyphens (6–30 characters, must start with a letter). This means values like 'My_Project', 'proj.name', or 'AB' all pass this guard but are rejected by the Firebase CLI — potentially surfacing a confusing CLI error rather than the clear validation message added here.
| if (!/^[A-Za-z0-9._-]+$/.test(id)) { | |
| throw new Error('deploy-firebase projectId must contain only letters, numbers, dots, underscores, or hyphens'); | |
| } | |
| if (!/^[a-z][a-z0-9-]{5,29}$/.test(id)) { | |
| throw new Error('deploy-firebase projectId must be 6–30 lowercase letters, digits, or hyphens, and start with a letter'); | |
| } |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
16 similar comments
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
Fixes #648.
Changes:
Validation: