Skip to content
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

New ruleset: chromium-insecure-gurl.yaml #279

Merged
merged 1 commit into from
Jul 17, 2023
Merged

New ruleset: chromium-insecure-gurl.yaml #279

merged 1 commit into from
Jul 17, 2023

Conversation

thypon
Copy link
Member

@thypon thypon commented Jul 17, 2023

Resolves: #272


// Blink-specific example:
// chromium-insecure-gurl
KURL url = ...;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Use origin (rather than URL) for security decisions.

URLs are often not sufficient for security decisions, since the origin may not be present in the URL (e.g., about:blank), may be tricky to parse (e.g., blob: or filesystem: URLs), or may be opaque despite a normal-looking URL (e.g., the security context may be sandboxed). Use origins whenever possible.

https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/security/origin-vs-url.md


Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/c/chromium-insecure-gurl.yaml


Cc @thypon @fmarier

// chromium-insecure-gurl
KURL url = ...;
// chromium-insecure-gurl
scoped_refptr<SecurityOrigin> origin = SecurityOrigin::Create(url);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Use origin (rather than URL) for security decisions.

URLs are often not sufficient for security decisions, since the origin may not be present in the URL (e.g., about:blank), may be tricky to parse (e.g., blob: or filesystem: URLs), or may be opaque despite a normal-looking URL (e.g., the security context may be sandboxed). Use origins whenever possible.

https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/security/origin-vs-url.md


Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/c/chromium-insecure-gurl.yaml


Cc @thypon @fmarier

@@ -0,0 +1,23 @@
int main() {
// chromium-insecure-gurl
GURL url = ...;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Use origin (rather than URL) for security decisions.

URLs are often not sufficient for security decisions, since the origin may not be present in the URL (e.g., about:blank), may be tricky to parse (e.g., blob: or filesystem: URLs), or may be opaque despite a normal-looking URL (e.g., the security context may be sandboxed). Use origins whenever possible.

https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/security/origin-vs-url.md


Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/c/chromium-insecure-gurl.yaml


Cc @thypon @fmarier

// chromium-insecure-gurl
GURL url = ...;
// chromium-insecure-gurl
GURL origin = url.DeprecatedGetOriginAsURL();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Use origin (rather than URL) for security decisions.

URLs are often not sufficient for security decisions, since the origin may not be present in the URL (e.g., about:blank), may be tricky to parse (e.g., blob: or filesystem: URLs), or may be opaque despite a normal-looking URL (e.g., the security context may be sandboxed). Use origins whenever possible.

https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/security/origin-vs-url.md


Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/c/chromium-insecure-gurl.yaml


Cc @thypon @fmarier

@thypon thypon merged commit 0569f69 into main Jul 17, 2023
7 checks passed
@thypon thypon deleted the feature/gurl-rule branch June 7, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Look for "GURL origin" in brave-core C++ code
2 participants