-
Notifications
You must be signed in to change notification settings - Fork 109
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
feat: Publisher react app #4934
Conversation
def get_settings_data(snap_name): | ||
snap_details = publisher_api.get_snap_info(snap_name, flask.session) | ||
|
||
if "whitelist_country_codes" in snap_details: |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist
may be insensitive, use allowlist
instead
snap_details = publisher_api.get_snap_info(snap_name, flask.session) | ||
|
||
if "whitelist_country_codes" in snap_details: | ||
whitelist_country_codes = ( |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist
may be insensitive, use allowlist
instead
|
||
if "whitelist_country_codes" in snap_details: | ||
whitelist_country_codes = ( | ||
snap_details["whitelist_country_codes"] |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist
may be insensitive, use allowlist
instead
if "whitelist_country_codes" in snap_details: | ||
whitelist_country_codes = ( | ||
snap_details["whitelist_country_codes"] | ||
if len(snap_details["whitelist_country_codes"]) > 0 |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist
may be insensitive, use allowlist
instead
else [] | ||
) | ||
else: | ||
whitelist_country_codes = [] |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist
may be insensitive, use allowlist
instead
@@ -12,3 +12,71 @@ export type ValidationSet = { | |||
snaps: Snap[]; | |||
timestamp: string; | |||
}; | |||
|
|||
export type SettingsData = { | |||
blacklist_countries: string[]; |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist
may be insensitive, use denylist
, blocklist
instead
|
||
export type SettingsData = { | ||
blacklist_countries: string[]; | ||
blacklist_country_keys: string; |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist
may be insensitive, use denylist
, blocklist
instead
update_metadata_on_release: boolean; | ||
visibility: string; | ||
visibility_locked: boolean; | ||
whitelist_countries: string[]; |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist
may be insensitive, use allowlist
instead
visibility: string; | ||
visibility_locked: boolean; | ||
whitelist_countries: string[]; | ||
whitelist_country_keys: string; |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist
may be insensitive, use allowlist
instead
issues: { url: string }[]; | ||
primary_website: string; | ||
public_metrics_enabled: boolean; | ||
public_metrics_blacklist: string[]; |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist
may be insensitive, use denylist
, blocklist
instead
* feat: migrate metrics page to react
* feat: added downsampling and pagination
Simplify step 1 Simplify step 2 Simplify step 3 Simplify step 4 Simplify step 5
77a693a
to
0dcaeb9
Compare
be48c64
to
5716968
Compare
@@ -179,7 +188,7 @@ | |||
}} | |||
> | |||
<img | |||
src={previewImageUrl} | |||
src={getValues(imageUrlFieldKey)} |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that the value retrieved by getValues(imageUrlFieldKey)
is properly sanitized before being used in the src
attribute of the img
tag. This can be achieved by using a library like DOMPurify
to sanitize the value, ensuring that any potentially malicious content is removed.
- Import the
DOMPurify
library. - Use
DOMPurify.sanitize
to sanitize the value retrieved bygetValues(imageUrlFieldKey)
before using it in thesrc
attribute.
-
Copy modified line R2 -
Copy modified line R203
@@ -1,2 +1,3 @@ | ||
import { useState, SyntheticEvent } from "react"; | ||
import DOMPurify from "dompurify"; | ||
import { | ||
@@ -201,3 +202,3 @@ | ||
<img | ||
src={getValues(imageUrlFieldKey)} | ||
src={DOMPurify.sanitize(getValues(imageUrlFieldKey))} | ||
width={previewWidth} |
-
Copy modified lines R108-R109
@@ -107,3 +107,4 @@ | ||
"webpack-cli": "5.1.4", | ||
"whatwg-fetch": "3.6.20" | ||
"whatwg-fetch": "3.6.20", | ||
"dompurify": "^3.2.3" | ||
}, |
Package | Version | Security advisories |
dompurify (npm) | 3.2.3 | None |
> | ||
tar.gz | ||
</a> | ||
<a href="https://raw.githubusercontent.com/snapcore/snap-store-badges/master/LICENSE.md"> |
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.
[Inclusive naming check] reported by reviewdog 🐶
[warning] master
may be insensitive, use primary
, main
instead
fix: Ignore metrics TS errors for now (#4933) fix: Fix checkbox values resetting in publisher settings form (#4937) fix: Fix primary website field clearing on revert (#4938) fix: Make sure Edit button on preview page closes current tab (#4939) fix: Fix deleting icon or banner not activating save button (#4940) fix: render selected language in HTML and markdown snippets (#4942) fix: remove extra whitespace in embeddable card (#4943) fix: Fix missing contact links in preview (#4944) fix: Fix preview card button being squashed (#4945) fix: Fix display of releases table (#4946) fix: Add loading state to single build page (#4947) fix: ensure markdown is rendered correctly (#4948) fix: build page showing stale data while fetching logs (#4949) fix: Fix missing banner in listing publisher page (#4950) fix: Fix form not resetting when making changes to images (#4952)
36c98e8
to
74e7a1e
Compare
Done
How to QA
Testing
Issue / Card
Fixes https://warthogs.atlassian.net/browse/WD-14619