Repository navigation
U2 — Gate main with required CI checks and branch protection #73
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
Merged
sgardoll
merged 7 commits into
main
from
sgardoll/stu-345-u2-gate-main-with-required-ci-checks-and-branch-protection
Sep 28, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d1dc19c
fix: classify SDK dependencies by their pubspec source, not a name list
sgardoll b28b814
ci: gate main with required CI checks and branch protection (STU-345)
sgardoll f479a9a
fix(ci): avoid shell quoting errors in bundle leak scan
sgardoll 8c9e7a1
fix: address Devin Review findings on CI gate and dependency classifi…
devin-ai-integration[bot] 48afb7f
docs: align DEPLOYMENT.md with graph-level skip semantics
devin-ai-integration[bot] ab95bfe
Merge branch 'main' into sgardoll/stu-345-u2-gate-main-with-required-…
devin-ai-integration[bot] 749ec7d
ci: gate each browser test step on its own script
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 83 additions & 83 deletions
166
dist/assets/index-BAqMCFqg.js → dist/assets/index-CodKApzz.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| #!/usr/bin/env python3 | ||
| import os | ||
| import re | ||
| import sys | ||
|
|
||
| DIST_DIR = "dist" | ||
|
|
||
| # Provider hosts the client must never call directly - provider traffic is | ||
| # expected to go through the app's own proxies, so a bare endpoint in a | ||
| # client-side asset means a key is going over the wire unproxied. The hosts | ||
| # legitimately appear inside the `api/*-proxy.php` files, which are the | ||
| # proxies, so these patterns only apply to files a browser executes. | ||
| CLIENT_FILE_SUFFIXES = (".js", ".html", ".css") | ||
|
|
||
| PROVIDER_ENDPOINTS = { | ||
| "api.groq.com endpoint": r"api\.groq\.com", | ||
| "api.openai.com endpoint": r"api\.openai\.com", | ||
| "api.anthropic.com endpoint": r"api\.anthropic\.com", | ||
| "generativelanguage.googleapis.com endpoint": r"generativelanguage\.googleapis\.com", | ||
| } | ||
|
|
||
| # An identifier naming a credential (`apiKey`, `api_key`, `x-api-key`, | ||
| # `VITE_GEMINI_API_KEY`, `apiSecret`, ...) assigned a quoted string literal, | ||
| # in either `key: "value"` or `KEY="value"` form. The value must be at least | ||
| # 8 characters so empty placeholders like `apiKey: ""` do not trip the gate. | ||
| KEY_ASSIGNMENT = ( | ||
| r"[A-Za-z0-9_$-]*api[_-]?(?:key|secret)[A-Za-z0-9_$-]*['\"]?" | ||
| r"\s*[:=]\s*['\"][^'\"\s]{8,}['\"]" | ||
| ) | ||
|
|
||
| # Credential shapes for the providers this app works with. A key baked into | ||
| # the bundle at build time (e.g. via a `define` replacement) carries no | ||
| # identifier, so only its format gives it away. | ||
| PROVIDER_KEY_FORMATS = { | ||
| "Google API key": r"AIza[0-9A-Za-z_-]{35}", | ||
| "Anthropic API key": r"sk-ant-[0-9A-Za-z_-]{20,}", | ||
| "OpenAI API key": r"sk-(?:proj-|svcacct-)?[0-9A-Za-z_-]{20,}", | ||
| "Groq API key": r"gsk_[0-9A-Za-z]{20,}", | ||
| "Stripe secret key": r"(?:sk|rk)_(?:live|test)_[0-9A-Za-z]{16,}", | ||
| } | ||
|
|
||
| ENDPOINT_PATTERNS = { | ||
| label: re.compile(body) for label, body in PROVIDER_ENDPOINTS.items() | ||
| } | ||
|
|
||
| # Key material is checked in every bundled file, client or server-side alike: | ||
| # a credential does not belong in a shipped artifact wherever it sits. | ||
| KEY_PATTERNS = { | ||
| "API key/secret assignment": re.compile(KEY_ASSIGNMENT, re.IGNORECASE), | ||
| **{label: re.compile(body) for label, body in PROVIDER_KEY_FORMATS.items()}, | ||
| } | ||
|
|
||
|
|
||
| def main() -> int: | ||
| if not os.path.isdir(DIST_DIR): | ||
| print(f"{DIST_DIR}/ directory not found; skipping scan.") | ||
| return 0 | ||
|
|
||
| leaks = [] | ||
| for root, _dirs, files in os.walk(DIST_DIR): | ||
| for name in files: | ||
| if name.endswith(".map"): | ||
| continue | ||
| path = os.path.join(root, name) | ||
| try: | ||
| with open(path, "r", encoding="utf-8", errors="replace") as f: | ||
| content = f.read() | ||
| except OSError as e: | ||
| print(f"WARN: could not read {path}: {e}", file=sys.stderr) | ||
| continue | ||
| patterns = dict(KEY_PATTERNS) | ||
| if name.endswith(CLIENT_FILE_SUFFIXES): | ||
| patterns.update(ENDPOINT_PATTERNS) | ||
| for label, pattern in patterns.items(): | ||
| for match in pattern.finditer(content): | ||
| line_no = content.count("\n", 0, match.start()) + 1 | ||
| leaks.append((path, line_no, label)) | ||
|
|
||
| if leaks: | ||
| print( | ||
| "FAIL: Potential provider API key/endpoint leak detected in dist/", | ||
| file=sys.stderr, | ||
| ) | ||
| # Report the location and which pattern hit, never the match itself: | ||
| # a hit can contain the credential it detected, and CI logs persist. | ||
| for path, line_no, label in sorted(set(leaks)): | ||
| print(f" {path}:{line_no} [{label}]", file=sys.stderr) | ||
| return 1 | ||
|
|
||
| print("No API key/endpoint leaks found.") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Unrepresentable Git, path, or hosted dependencies are now checked only against the class's direct imports. If one of these dependencies or overrides affects a transitive dependency of an imported package, the class is still sent for compilation even though the scratch manifest omits the project's source or override. Verification then resolves different code and can report a false pass. These overrides must remain global unless the complete resolved dependency graph proves they cannot affect the class.
Knowledge Base Used:
Prompt To Fix With AI