-
Notifications
You must be signed in to change notification settings - Fork 5
Stytch b2b python quickstart #34
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
base: main
Are you sure you want to change the base?
Changes from all commits
51a3911
34e7eea
e8c659f
6f5a626
63e7e70
b96bcb1
160acd1
9531f28
067ccb3
6e49eb4
6192edf
5fa0c99
e8fa0c5
dfe1cae
770b2ef
16c58c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: 🔥 Firebase Hosting Deploy | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| firebase-deploy: | ||
| name: 🚀 Deploy to Firebase Hosting | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: 📦 Checkout repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: 🔐 Authenticate to Google Cloud | ||
| uses: google-github-actions/auth@v1 | ||
| with: | ||
| workload_identity_provider: "${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}" | ||
| service_account: "${{ secrets.GCP_SERVICE_ACCOUNT }}" | ||
|
|
||
| - name: 🛠️ Install Firebase CLI | ||
| run: npm install -g firebase-tools | ||
|
|
||
| - name: 🚀 Deploy to Firebase Hosting | ||
| run: firebase deploy --only hosting --project ${{ secrets.GCP_PROJECT_ID }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Setup Node.js environment | ||
| uses: actions/[email protected] | ||
| with: | ||
| # Set always-auth in npmrc. | ||
| always-auth: # optional, default is false | ||
| # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0. | ||
| node-version: # optional | ||
| # File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions. | ||
| node-version-file: # optional | ||
| # Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default. | ||
| architecture: # optional | ||
| # Set this option if you want the action to check for the latest available version that satisfies the version spec. | ||
| check-latest: # optional | ||
| # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN. | ||
| registry-url: # optional | ||
| # Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/). | ||
| scope: # optional | ||
| # Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. | ||
| token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} | ||
| # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm. | ||
| cache: # optional | ||
| # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies. | ||
| cache-dependency-path: # optional |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: Firebase Deploy | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: google-github-actions/auth@v1 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
| - run: npm ci | ||
| - run: npm run build | ||
| - run: npx firebase deploy --only hosting |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,14 @@ | ||
| name: GCP Auth Test | ||
| name: GCP Auth Setup | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| auth: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Authenticate to Google Cloud | ||
| uses: google-github-actions/auth@v1 | ||
| with: | ||
| workload_identity_provider: "projects/491439791457/locations/global/workloadIdentityPools/ci-pool-github-actions/providers/github" | ||
| service_account: "github-action-xpert-forex-trad@xpert-forex-trade.iam.gserviceaccount.com" | ||
|
|
||
| - name: Verify identity | ||
| run: | | ||
| gcloud auth list | ||
| - name: Authenticate with GCP | ||
| uses: google-github-actions/auth@v1 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ## Cloudflare Endpoint Schema Upload | ||
|
|
||
| **Location**: `intlhub.org → Security → Web Assets → Endpoint Management → Upload Schema` | ||
|
|
||
| **Accepted Formats**: `.yml`, `.yaml`, `.json` | ||
|
|
||
| **Schema Requirements**: | ||
| - OpenAPI or Swagger spec | ||
| - Define paths, methods, parameters, responses | ||
|
|
||
| **Security Behavior**: | ||
| - Matches traffic to schema | ||
| - Blocks or logs non-compliant requests | ||
|
|
||
| **Recommended**: | ||
| - Include contributor metadata in schema comments | ||
| - Version your schema for audit clarity | ||
| - Validate with PITR enabled for rollback protection |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?php include 'header.php'; ?> | ||
| <div class="container mt-5"> | ||
| <h2 class="mb-4">Welcome, <?= $_SESSION['username']; ?>!</h2> | ||
xpertforextradeinc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <div class="row"> | ||
| <div class="col-md-6"> | ||
| <h4>Open Trades</h4> | ||
| <ul class="list-group"> | ||
| <?php foreach ($openTrades as $trade): ?> | ||
| <li class="list-group-item"> | ||
| <?= $trade['pair']; ?> - <?= $trade['direction']; ?> - $<?= $trade['amount']; ?> | ||
|
||
| </li> | ||
| <?php endforeach; ?> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <div class="col-md-6"> | ||
| <h4>Trade History</h4> | ||
| <ul class="list-group"> | ||
| <?php foreach ($tradeHistory as $trade): ?> | ||
| <li class="list-group-item"> | ||
| <?= $trade['pair']; ?> - <?= $trade['type']; ?> - <?= $trade['created_at']; ?> | ||
xpertforextradeinc marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the open trades list, the trade history data ( <?= htmlspecialchars($trade['pair'], ENT_QUOTES, 'UTF-8'); ?> - <?= htmlspecialchars($trade['type'], ENT_QUOTES, 'UTF-8'); ?> - <?= htmlspecialchars($trade['created_at'], ENT_QUOTES, 'UTF-8'); ?> |
||
| </li> | ||
| <?php endforeach; ?> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <?php include 'footer.php'; ?> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # bot.py | ||
| # Entry point for the xpert_telegram_bot. | ||
|
|
||
| def main(): | ||
| print("Bot is starting...") | ||
| # TODO: Implement bot logic here | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Xpert-Forex-Tradex</title> | ||
| <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
| </head> | ||
| <body> | ||
| <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | ||
| <div class="container-fluid"> | ||
| <a class="navbar-brand" href="#">Xpert-Forex-Tradex</a> | ||
| </div> | ||
| </nav> | ||
|
|
||
| <div class="container mt-5 text-center"> | ||
| <h1>Welcome to Xpert-Forex-Tradex</h1> | ||
| <p class="lead">Your gateway to smarter trading insights and transparent onboarding.</p> | ||
| <a href="login.php" class="btn btn-primary">Login</a> | ||
| <a href="register.php" class="btn btn-outline-primary">Register</a> | ||
| </div> | ||
|
|
||
| <footer class="bg-light text-center mt-5 p-3"> | ||
| <small>© <span id="year"></span> Xpert-Forex-Tradex. All rights reserved.</small> | ||
| </footer> | ||
| <script> | ||
| document.getElementById('year').textContent = new Date().getFullYear(); | ||
| </script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from datetime import datetime | ||
|
|
||
| def send_slack_alert(message, token=None): | ||
| webhook_url = os.getenv("SLACK_WEBHOOK_URL") | ||
| if not webhook_url: | ||
| return | ||
|
|
||
| ip = request.remote_addr or "Unknown IP" | ||
| timestamp = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC") | ||
| token_preview = token[:6] + "..." if token else "No token" | ||
|
|
||
| payload = { | ||
| "text": ( | ||
| f"🚨 *Auth Failure Alert*\n" | ||
| f"> 🕒 Time: {timestamp}\n" | ||
| f"> 🌐 IP: {ip}\n" | ||
| f"> 🔑 Token: `{token_preview}`\n" | ||
| f"> 📣 Message: {message}" | ||
| ) | ||
| } | ||
|
|
||
| try: | ||
| requests.post(webhook_url, json=payload) | ||
| except Exception as e: | ||
| print(f"⚠️ Slack alert failed: {e}") |
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.
Direct output of session data without escaping could lead to XSS vulnerabilities. Use
htmlspecialchars($_SESSION['username'], ENT_QUOTES, 'UTF-8')to prevent XSS attacks.