From 144fff09037fbcdcbf84520b9e4056acf2c3d8eb Mon Sep 17 00:00:00 2001 From: Krystian Duma Date: Tue, 19 Dec 2023 17:50:39 +0100 Subject: [PATCH] Up --- .../2.serverless-satis/1.s3-satis.md | 13 ++++++-- .../2.serverless-satis/3.cloudflare-worker.md | 30 +++++++++++-------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/content/1.systems/2.serverless-satis/1.s3-satis.md b/content/1.systems/2.serverless-satis/1.s3-satis.md index 6cf46a6..ef73ee0 100644 --- a/content/1.systems/2.serverless-satis/1.s3-satis.md +++ b/content/1.systems/2.serverless-satis/1.s3-satis.md @@ -198,13 +198,22 @@ Or if it is not released version, but a branch, the file will be generated with ] ``` -You can use this extension with CloudFlare Worker to provide a selective access to packages in your private repository. +You can use this extension with [CloudFlare Worker](/systems/serverless-satis/cloudflare-worker#selective-access) +to provide selective access to packages in your private repository. + +If you enable `extra-json` option, generated tags will be added to `extra` section of Composer 2 `packages.json` file, +so you can filter them out in [CloudFlare Worker](/systems/serverless-satis/cloudflare-worker#selective-access) + + ```json { "s3-satis": { "plugins": { - "file-restrictions-map-generator": true + "file-restrictions-map-generator": { + "enabled": true, + "extra-json": false + } } } } diff --git a/content/1.systems/2.serverless-satis/3.cloudflare-worker.md b/content/1.systems/2.serverless-satis/3.cloudflare-worker.md index 6046c58..a1fdee7 100644 --- a/content/1.systems/2.serverless-satis/3.cloudflare-worker.md +++ b/content/1.systems/2.serverless-satis/3.cloudflare-worker.md @@ -35,17 +35,18 @@ npm run deploy You need to update `wrangler.toml` file with your own values: -| Variable Name | Description | -|--------------------------------|-----------------------------------------------------------------------------------| -| `name` | Name of your CloudFlare Worker | -| `vars.PUBLIC_ACCESS_TO_INDEX` | If true, index page will be accessible without authentication | -| `vars.PUBLIC_ACCESS_TO_JSON` | If true, JSON indexes will be accessible without authentication | -| `vars.CHECK_FILE_RESTRICTIONS` | See [Selective Access](#selective-access) | -| `vars.STORE_PASSWORDS_HASHED` | See [Authentication](#authentication) | -| `vars.ENABLE_USER_ENDPOINT` | See [User Endpoint](#user-endpoint) | -| `routes.pattern` | Domain you want to expose your private repository on (need to use CloudFlare DNS) | -| `kv_namespaces.id` | Namespace ID of your Worker KV to read users from | -| `r2_buckets.bucket_name` | Name of private bucket where are stored files generated by `s3-satis` tool | +| Variable Name | Description | +|--------------------------------------|-----------------------------------------------------------------------------------| +| `name` | Name of your CloudFlare Worker | +| `vars.PUBLIC_ACCESS_TO_INDEX` | If true, index page will be accessible without authentication | +| `vars.PUBLIC_ACCESS_TO_JSON` | If true, JSON indexes will be accessible without authentication | +| `vars.CHECK_FILE_RESTRICTIONS` | See [Selective Access](#selective-access) | +| `vars.CHECK_EXTRA_JSON_RESTRICTIONS` | See [Selective Access](#selective-access) | +| `vars.STORE_PASSWORDS_HASHED` | See [Authentication](#authentication) | +| `vars.ENABLE_USER_ENDPOINT` | See [User Endpoint](#user-endpoint) | +| `routes.pattern` | Domain you want to expose your private repository on (need to use CloudFlare DNS) | +| `kv_namespaces.id` | Namespace ID of your Worker KV to read users from | +| `r2_buckets.bucket_name` | Name of private bucket where are stored files generated by `s3-satis` tool | ```toml name = "" @@ -56,6 +57,7 @@ compatibility_date = "2023-12-06" PUBLIC_ACCESS_TO_INDEX = false PUBLIC_ACCESS_TO_JSON = false CHECK_FILE_RESTRICTIONS = false +CHECK_EXTRA_JSON_RESTRICTIONS = false STORE_PASSWORDS_HASHED = false ENABLE_USER_ENDPOINT = false @@ -104,4 +106,8 @@ password vendor/package-1:1.x,vendor/package-2:2.0.0.0,vendor/package-3:dev-master ``` -If user tries to access a package or version that is not listed in KV, the request will be rejected with `403 Forbidden` error. \ No newline at end of file +If user tries to access a package or version that is not listed in KV, the request will be rejected with `403 Forbidden` error. + +If you want to remove packages to which user doesn't have access from json files (so the composer won't complain about not having access to them when upgrading), +you cen enable [`extra-json` option in `file-restrictions-map-generator` extension of `s3-satis` tool](/systems/serverless-satis/s3-satis#file-restrictions-map-generator-extension-file-restrictions-map-generator), +and set `vars.CHECK_EXTRA_JSON_RESTRICTIONS` to `true`. \ No newline at end of file