feat: add centralized branding configuration#670
Merged
Conversation
Fidesnoella
force-pushed
the
feat/branding-config-KS-15
branch
2 times, most recently
from
February 4, 2026 06:46
3b45d22 to
8890d8f
Compare
Fidesnoella
force-pushed
the
feat/branding-config-KS-15
branch
2 times, most recently
from
February 4, 2026 15:39
22f7887 to
d067bd3
Compare
irumvanselme
force-pushed
the
feat/branding-config-KS-15
branch
from
February 5, 2026 06:30
d067bd3 to
d8074bf
Compare
irumvanselme
force-pushed
the
feat/branding-config-KS-15
branch
from
February 5, 2026 06:31
d8074bf to
23606c7
Compare
|
|
||
| def extract_existing_frontend_json_value(content: str, key: str) -> Dict[str, Any]: | ||
| """Extract the existing JSON.stringify payload for a key in env.js""" | ||
| pattern = rf'(?:"{re.escape(key)}"|{re.escape(key)}):\s*btoa\(\s*JSON\.stringify\((.*?)\)\s*\),' |
There was a problem hiding this comment.
Bug: The regex pattern in extract_existing_frontend_json_value uses non-greedy matching (.*?) which will fail if a JSON string value contains a closing parenthesis ).
Severity: HIGH
Suggested Fix
The regex needs to be more robust to handle nested parentheses. Instead of relying on a non-greedy match to the first parenthesis, the pattern should correctly parse the balanced parentheses of the JSON.stringify() call. This might involve a more complex regex or a different parsing strategy that doesn't rely on regex for structured data.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: config/inject-config.py#L143
Potential issue: The regex patterns at lines 143 and 202-204 use non-greedy matching
`(.*?)` to extract and replace JSON values. If a user-provided string value within the
JSON, such as a `description`, contains a closing parenthesis (e.g., "See our FAQ
(info)"), the regex will match incorrectly. This causes
`extract_existing_frontend_json_value()` to fail silently and return an empty
dictionary. Consequently, the script will fail to replace the existing configuration
line and will instead insert a new, duplicate line, leading to a corrupted `env.js` file
and potential data loss for existing keys.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.