Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sandbox URL Creation#2228

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
denniszelada wants to merge2 commits intosodadata:main
base:main
Choose a base branch
Loading
fromdenniszelada:feature-safe-request-on-dbt

Conversation

@denniszelada
Copy link

This PR sandbox calls torequests.get to be more resistant to Server-Side Request Forgery (SSRF) attacks.

Most of the time, when you make a GET request to a URL, you intend to reference an HTTP endpoint, like an internal microservice. However, URLs can point to local file system files, a Gopher stream in your local network, a JAR file on a remote Internet site, and all kinds of other unexpected and undesirable outcomes. When the URL values are influenced by attackers, they can trick your application into fetching internal resources, running malicious code, or otherwise harming the system.

In this case, an attacker could supply a value like "http://169.254.169.254/user-data/" and attempt to access user information.

The changes introduce sandboxing around URL creation that forces developers to specify some boundaries on the types of URLs they expect to create:

from flask import Flask, request

  • import requests
  • from security import safe_requests

    app = Flask(name)

    @app.route("/request-url")
    def request_url():
    url = request.args["loc"]

  • resp = requests.get(url)
  • resp = safe_requests.get(url)
    ...
    This change reduces attack surface significantly because of the default behavior of safe_requests.get raises a SecurityException if a user attempts to access a known infrastructure location, unless specifically disabled.

Dependency Updates
This PR relies on an external dependency. We have automatically added this dependency to your project's requirements.txt file.

This library holds security tools for protecting Python API calls.

@CLAassistant
Copy link

CLAassistant commentedApr 4, 2025
edited
Loading

CLA assistant check
All committers have signed the CLA.

@sonarqubecloud
Copy link

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@denniszelada@CLAassistant

[8]ページ先頭

©2009-2025 Movatter.jp