New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@waiter/domain

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waiter/domain

Waiter Domain Library for Node.js

latest
Source
npmnpm
Version
7.0.2
Version published
Weekly downloads
15
-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

Waiter Domain Library for Node.js

npm (scoped) CircleCI Coverage Status Known Vulnerabilities npm

Table of contents

Background

  • チケット購入サイトへのアクセスがある量感を超えると、システムで受け止め切ることは簡単でない。
  • インフラにコストをかけることで解決するのは簡単だが、コストに限度のないケースは少ない。
  • 外部サービスと連携するシステムをつくる以上、外部サービス側の限度を考慮する必要がある。
  • アプリケーション(ソフトウェア)のレベルでできる限りのことはしたい。

Requirement

  • 本システムにかかる負荷と、フロントエンドアプリケーション側のインフラ(ウェブサーバー、DBサーバー)への負荷が分離していること。
  • 厳密にコントロールできる、というよりは、それなりに有効であることが大事。
  • フロントウェブサーバーに負荷をかけられないため、クライアントサイドから呼び出せることが必須。

Specification

許可証の暗号化と検証

                                                         ........................
                                                         :                      :
                                                         :  WAITER              :
                                                         :                      :
+--------------+                                         :  +----------------+  :
|              |--(A)------ Passport Request -------------->|                |  :
|  End-user    |           + scope                       :  |  Passport      |  :
|  Local       |                                         :  |  Issue         |  :
|              |<-(B)------ Encoded Passport ---------------|  Server        |  :
|              |                                         :  |                |  :
|              |                                         :  +--------■■------+  :
|              |                                         :           ■■         :
|              |                                         :           ■■         :
|              |                                         :         SECRET       :
|              |                                         :(environment variable):
|              |                                         :           ■■         :
|              |                                         :           ■■         :
|              |                                   +-----------------■■------------+
|              |                                   |     :                      :  |
|              |                                   |  Client                    :  |
|              |                                   |  Frontend                  :  |
|              |                                   |  Server                    :  |
|              |                                   |     :                      :  |
|              |                                   |     :  +----------------+  :  |
|              |--(C)------ Verify Request ---------------->|                |  :  |
|              |            + encoded passport     |     :  |  Token         |  :  |
|              |                                   |     :  |  Verifier      |  :  |
|              |<-(D)------ Verify Result ------------------|                |  :  |
|              |                                   |     :  |                |  :  |
|              |                                   |     :  +----------------+  :  |
|              |                                   |     :                      :  |
+--------------+                                   +-------------------------------+
                                                         :                      :
                                                         :                      :
                                                         ........................

登場用語

発行規則

  • 許可証発行規則。事前にWAITERに環境変数として登録。
fieldtypedescription
scopestringスコープ
aggregationUnitInSecondsnumber許可証数集計単位(秒)
thresholdnumber単位時間当たりの許可証数閾値
unavailableHoursSpecificationsarrayサービス休止時間帯設定リスト
unavailableHoursSpecifications.startDatestringサービス休止開始日時
unavailableHoursSpecifications.endDatestringサービス休止終了日時
{
    "scope" : "mcdonalds",
    "aggregationUnitInSeconds" : 300,
    "threshold": 120,
    "unavailableHoursSpecifications":[
        {"startDate":"2017-11-10T09:00:00Z","endDate":"2017-11-10T09:30:00Z"}
    ]
}

許可証発行単位

  • スコープごとに発行単位が作成される。許可証の発行を依頼されると、単位ごとに発行数を集計しながら発行を試みる。
fieldtypedescription
identifierstring許可証発行単位識別子
validFromnumberいつから有効な発行単位か
validThroughnumberいつまで有効な発行単位か
numberOfRequestsnumber許可証発行リクエスト数

許可証

  • 発行者が発行する許可証は鍵によって暗号化される。
  • 発行依頼者は鍵を事前に設定することで暗号化された許可証を検証し、許可するかどうかを判断する。
fieldtypedescription
issstring発行者
iatnumber発行unixタイムスタンプ
expnumber期限unixタイムスタンプ
scopestringスコープ
issueUnitIIssueUnit発行単許可証発行単位位名
{
  "scope": "scope",
  "issueUnit": {
    "identifier": "scope:1511059500",
    "validFrom": 1511059500,
    "validThrough": 1511059800,
    "numberOfRequests": 1
  },
  "iat": 1511059610,
  "exp": 1511059910,
  "iss": "https://waiter.example.com"
}

Usage

Environment variables

NameRequiredValuePurpose
DEBUGfalsewaiter-domain:*Debug
WAITER_PASSPORT_ISSUERtruePassport issuer
WAITER_SECRETtruesecret for sign

Code Samples

example

FAQs

Package last updated on 01 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts