@o3co/create-auth-policy-verifier 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/standalone/Dockerfile +5 -3
- package/templates/standalone/README.ja.md +6 -3
- package/templates/standalone/README.md +5 -2
- package/templates/standalone/package.json +1 -1
- package/templates/standalone/src/__tests__/smoke.test.mts +12 -1
- package/templates/versions.json +3 -3
package/package.json
CHANGED
|
@@ -91,8 +91,10 @@ EXPOSE ${HTTP_PORT}
|
|
|
91
91
|
# operator's port — the config reads `${?HTTP_PORT}`, so app.listen() and the
|
|
92
92
|
# probe stay in sync. Shell form, so both expand at probe time.
|
|
93
93
|
#
|
|
94
|
-
# `GET /
|
|
95
|
-
#
|
|
94
|
+
# `GET /_healthcheck` is the liveness path every component of the stack answers
|
|
95
|
+
# on (`/healthcheck` stays as a compatibility alias). It is never gated by
|
|
96
|
+
# `http.callerAuth`, so setting HTTP_CALLER_AUTH_TOKEN does not require a
|
|
97
|
+
# credential here.
|
|
96
98
|
#
|
|
97
99
|
# The deployment where loopback is genuinely correct — a sidecar sharing a
|
|
98
100
|
# network namespace with its caller — is the one shape this check is wrong for.
|
|
@@ -101,7 +103,7 @@ EXPOSE ${HTTP_PORT}
|
|
|
101
103
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
102
104
|
CMD addr="$(hostname -i | cut -d' ' -f1)"; \
|
|
103
105
|
case "$addr" in *:*) addr="[$addr]" ;; esac; \
|
|
104
|
-
wget -q -O /dev/null "http://${addr}:${HTTP_PORT}${HTTP_PATH_PREFIX%/}/
|
|
106
|
+
wget -q -O /dev/null "http://${addr}:${HTTP_PORT}${HTTP_PATH_PREFIX%/}/_healthcheck" || exit 1
|
|
105
107
|
|
|
106
108
|
ENTRYPOINT ["tini", "--"]
|
|
107
109
|
CMD ["node", "dist/main.mjs"]
|
|
@@ -93,7 +93,7 @@ x-caller-token: <secret>
|
|
|
93
93
|
Authorization: Bearer <jwt>
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
それ以外は body のパースより前に `401 { "decision": "deny", "code": "caller_unauthenticated", "message": "Caller authentication failed" }` を返します。`GET /
|
|
96
|
+
それ以外は body のパースより前に `401 { "decision": "deny", "code": "caller_unauthenticated", "message": "Caller authentication failed" }` を返します。`GET /_healthcheck` は常に非ゲートなので、コンテナの healthcheck はそのまま動作します。
|
|
97
97
|
|
|
98
98
|
資格情報を未設定のままにする運用もサポートされており、ループバックであれば問題ありません。ループバック以外に bind した場合は起動時に `unauthenticated_non_loopback_bind` が warn で記録されます — 修正する価値があるのはこの組み合わせです。
|
|
99
99
|
|
|
@@ -303,8 +303,11 @@ tag と digest を意図的に一緒に上げます。
|
|
|
303
303
|
アドレスを叩けば呼び出し元と同じ問いになるため、`HTTP_HOSTNAME=0.0.0.0` の
|
|
304
304
|
付け忘れは隠れずに `unhealthy` として現れます。
|
|
305
305
|
|
|
306
|
-
`GET /
|
|
307
|
-
|
|
306
|
+
probe が叩くのは `GET /_healthcheck` で、スタックの全コンポーネントが応答する
|
|
307
|
+
liveness パスです。以前このイメージが probe していた `GET /healthcheck` は互換
|
|
308
|
+
alias として残しているので、そのパスのままの probe 設定でも動き続けます。
|
|
309
|
+
どちらも `http.callerAuth` でゲートされないので、probe に資格情報は不要です。
|
|
310
|
+
`HTTP_PATH_PREFIX` と `HTTP_PORT` には追従します。
|
|
308
311
|
|
|
309
312
|
例外は 1 つ、呼び出し元と network namespace を共有する sidecar 構成です。
|
|
310
313
|
そこでは loopback bind が正しく、到達可能アドレスでは何も listen していま
|
|
@@ -94,7 +94,7 @@ x-caller-token: <secret>
|
|
|
94
94
|
Authorization: Bearer <jwt>
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
Anything else gets `401 { "decision": "deny", "code": "caller_unauthenticated", "message": "Caller authentication failed" }`, decided before the body is parsed. `GET /
|
|
97
|
+
Anything else gets `401 { "decision": "deny", "code": "caller_unauthenticated", "message": "Caller authentication failed" }`, decided before the body is parsed. `GET /_healthcheck` is never gated, so the container healthcheck keeps working.
|
|
98
98
|
|
|
99
99
|
Leaving the credential unset is supported and is fine on loopback. On a non-loopback bind the server logs `unauthenticated_non_loopback_bind` at warn on boot — that combination is the one worth fixing.
|
|
100
100
|
|
|
@@ -306,7 +306,10 @@ server is bound to loopback and no caller can reach it — it would report
|
|
|
306
306
|
container is actually reachable at asks the same question a caller does, so
|
|
307
307
|
forgetting `HTTP_HOSTNAME=0.0.0.0` shows up as `unhealthy` instead of hiding.
|
|
308
308
|
|
|
309
|
-
`GET /
|
|
309
|
+
The probe hits `GET /_healthcheck`, the liveness path every component of the
|
|
310
|
+
stack answers on. `GET /healthcheck` — the path this image probed before — is
|
|
311
|
+
kept as a compatibility alias, so a probe config that still names it keeps
|
|
312
|
+
working. Neither is gated by `http.callerAuth`, so the probe needs no
|
|
310
313
|
credential. It follows `HTTP_PATH_PREFIX` and `HTTP_PORT`.
|
|
311
314
|
|
|
312
315
|
One deployment shape is the exception: a sidecar sharing a network namespace
|
|
@@ -101,7 +101,18 @@ function createShippedApp(config: AppConfig = shippedConfig) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
describe("standalone smoke", () => {
|
|
104
|
-
it("GET /
|
|
104
|
+
it("GET /_healthcheck returns 200", async () => {
|
|
105
|
+
// The liveness path the Dockerfile's HEALTHCHECK probes, and the one every
|
|
106
|
+
// component of the stack answers on (o3co/auth.provider#293).
|
|
107
|
+
const app = await createShippedApp();
|
|
108
|
+
|
|
109
|
+
const res = await request(app).get("/_healthcheck");
|
|
110
|
+
expect(res.status).toBe(200);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("GET /healthcheck returns 200 as a compatibility alias", async () => {
|
|
114
|
+
// The path this image probed before; a probe config that still names it
|
|
115
|
+
// must keep working.
|
|
105
116
|
const app = await createShippedApp();
|
|
106
117
|
|
|
107
118
|
const res = await request(app).get("/healthcheck");
|
package/templates/versions.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@o3co/auth.policy-verifier.core": "0.
|
|
3
|
-
"@o3co/auth.policy-verifier.builtins": "0.
|
|
4
|
-
"@o3co/auth.policy-verifier.server": "0.
|
|
2
|
+
"@o3co/auth.policy-verifier.core": "0.7.0",
|
|
3
|
+
"@o3co/auth.policy-verifier.builtins": "0.7.0",
|
|
4
|
+
"@o3co/auth.policy-verifier.server": "0.7.0"
|
|
5
5
|
}
|