Skip to content

Conversation

@gerhard
Copy link
Member

@gerhard gerhard commented Jun 15, 2025

So that we don't allow anyone to PURGE URLs. purge-token request header is required if the instance has been configured with PURGE_TOKEN secret (exposed as an environment variable).

A few other improvements:

  • add PURGE VTC & acceptance tests
  • handle URL parameters for all feed redirects
  • add extra tests to cover feed URL variations
  • wrap long commands in the justfile so that they are easier to read
  • separate the benchmark just commands into app & feed (inside the debug container) & capture the intended run order
  • add a few ideas for all contributors review
  • upgrade Dagger to v0.18.12 (latest release)

Required by:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • PURGE requests now require a valid token for authorization, enhancing security.
    • Feed URLs support optional trailing slashes and query parameters for improved flexibility.
  • Bug Fixes

    • Acceptance tests and VCL logic updated to handle PURGE requests with tokens and to test feed URL variants.
    • Acceptance tests refined with query parameters and authorization headers for more precise validation.
  • Documentation

    • README improved for clarity, detailed checklists, and revised command descriptions.
  • Chores

    • Workflow steps streamlined by removing redundant publish commands.
    • Benchmarking and acceptance test commands reorganized and clarified for consistency.
    • Command targets enhanced with explicit environment variable handling and secure credential management.
    • Updated dependency versions and container image digests for improved reliability.

@coderabbitai
Copy link

coderabbitai bot commented Jun 15, 2025

Walkthrough

This update introduces stricter authentication for PURGE requests by requiring a valid token, expands feed URL matching to allow optional trailing slashes and query parameters, and updates related tests and documentation. Benchmarking and acceptance testing commands are restructured for clarity and consistency, with environment variables and secret handling improved across workflows and scripts.

Changes

File(s) Change Summary
.github/workflows/_github.yml, .github/workflows/_namespace.yml Removed just publish from tag-triggered workflow steps; now only just deploy runs for tag pushes.
README.md Clarified wording, checklist items, and command descriptions; updated acceptance test explanations and removed obsolete commands from documentation.
container.justfile, justfile Refactored benchmarking targets for specificity and structure; reduced local benchmark concurrency; added explicit environment variable handling for acceptance tests; grouped and clarified test, deploy, and secret management commands; improved command syntax and reporting.
dagger/main.go Added optional purgeToken parameter to Pipely.New; injects PURGE_TOKEN into Varnish container and passes it to acceptance tests.
test/acceptance/pipedream/assets.hurl, test/acceptance/pipedream/feed.hurl, test/acceptance/pipedream/homepage.hurl Updated test requests to include query parameters and Purge-Token headers; revised assertions to check for new header behaviors and cache statuses after PURGE; adjusted cache age boundary checks.
test/vtc/feeds.vtc, varnish/pipedream.changelog.com.vcl Expanded feed URL matching to allow optional trailing slashes and query parameters using regex; updated backend routing and URL normalization; added comprehensive tests for new URL variants.
test/vtc/purge.vtc, varnish/pipedream.changelog.com.vcl Introduced token-based authentication for PURGE requests; VCL now checks purge-token header against environment variable; test cases expanded to cover missing, invalid, and valid token scenarios.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Varnish
    participant Backend

    Note over Client,Varnish: PURGE Request Flow with Token
    Client->>Varnish: PURGE /some/url with Purge-Token header
    alt Purge-Token matches PURGE_TOKEN env
        Varnish->>Varnish: Proceed with purge
        Varnish-->>Client: 200 OK (purged)
    else Purge-Token missing or invalid
        Varnish-->>Client: 401 Unauthorized ("Invalid PURGE token")
    end
Loading
sequenceDiagram
    participant Client
    participant Varnish
    participant Feeds Backend

    Note over Client,Varnish: Feed URL Normalization
    Client->>Varnish: GET /podcast/feed/ or /podcast/feed?x=1
    Varnish->>Varnish: Regex match & normalize to /podcast.xml
    Varnish->>Feeds Backend: GET /podcast.xml
    Feeds Backend-->>Varnish: Feed XML
    Varnish-->>Client: Feed XML response
Loading

Poem

In the warren of code, a token now guards,
PURGE requests checked by vigilant bards.
Feeds with slashes, queries galore—
Regexes open the normalization door!
Benchmarking is clearer, secrets well kept,
The rabbit hops on, with tests adept.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1a8d83 and 45df30a.

📒 Files selected for processing (13)
  • .github/workflows/_github.yml (0 hunks)
  • .github/workflows/_namespace.yml (0 hunks)
  • README.md (4 hunks)
  • container.justfile (1 hunks)
  • dagger/main.go (7 hunks)
  • just/dagger.just (1 hunks)
  • justfile (4 hunks)
  • test/acceptance/pipedream/assets.hurl (2 hunks)
  • test/acceptance/pipedream/feed.hurl (2 hunks)
  • test/acceptance/pipedream/homepage.hurl (3 hunks)
  • test/vtc/feeds.vtc (4 hunks)
  • test/vtc/purge.vtc (1 hunks)
  • varnish/pipedream.changelog.com.vcl (1 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/_github.yml
  • .github/workflows/_namespace.yml
🚧 Files skipped from review as they are similar to previous changes (8)
  • just/dagger.just
  • test/vtc/purge.vtc
  • test/acceptance/pipedream/assets.hurl
  • varnish/pipedream.changelog.com.vcl
  • test/acceptance/pipedream/feed.hurl
  • test/acceptance/pipedream/homepage.hurl
  • README.md
  • justfile
🧰 Additional context used
🪛 golangci-lint (1.64.8)
dagger/main.go

106-106: undefined: dag

(typecheck)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: on-namespace / run
🔇 Additional comments (10)
container.justfile (2)

49-49: LGTM! Proper integration of purge token for acceptance testing.

The addition of the purge_token variable with proper environment variable fallback (${PURGE_TOKEN:-""}) correctly integrates with the authentication requirements for PURGE requests.


57-96: Excellent restructuring of benchmark commands.

The reorganization into explicitly named benchmark targets with clear categorization (app vs feed, different environments/CDNs) significantly improves maintainability and usability. The naming convention makes it easy to understand what each benchmark does.

test/vtc/feeds.vtc (3)

11-274: Comprehensive feed URL variant testing - excellent coverage.

The expansion to test three variants of each feed endpoint (base URL, trailing slash, query parameters) provides robust coverage for the flexible URL matching requirements. The mock server responses correctly handle all variants by normalizing to .xml endpoints.


296-349: Regex patterns correctly handle URL flexibility.

The VCL regex patterns like ^/podcast/feed/?(\?.*)?$ properly support:

  • Optional trailing slash with /?
  • Optional query parameters with (\?.*)?

The URL rewriting logic correctly normalizes all variants to the appropriate .xml format while preserving the intent of the original request.


377-799: Thorough client test coverage validates all URL variants.

The systematic testing of all three URL variants for each feed endpoint ensures that the VCL routing logic works correctly across different URL formats. This comprehensive approach helps prevent regressions in feed URL handling.

dagger/main.go (5)

47-49: Clean integration of purge token into Pipely struct.

The addition of VarnishPurgeToken *dagger.Secret field and its placement in the struct definition is well-organized and follows proper Go conventions for optional fields.


82-84: Proper optional parameter handling in constructor.

The purgeToken *dagger.Secret parameter with +optional annotation correctly implements the optional authentication token feature, maintaining backward compatibility for environments that don't require PURGE authentication.


120-124: Correct conditional secret injection.

The implementation properly handles the optional purge token by only calling WithSecretVariable when the token is provided. This prevents issues with empty environment variables and maintains a clear contract between presence/absence of authentication.


341-348: Improved TestAcceptance method with conditional token handling.

The refactored approach correctly:

  • Only includes the purge token variable when a token is actually provided
  • Avoids the container rebuilding issues mentioned in past reviews
  • Maintains clean separation between authenticated and non-authenticated test scenarios

13-13: Version updates look appropriate.

The updates to golangVersion (1.24.4) and ohaVersion (1.9.0) appear to be reasonable dependency updates that align with maintaining current tooling versions.

Also applies to: 30-30

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gerhard gerhard added this to the 1.0 milestone Jun 15, 2025
@gerhard
Copy link
Member Author

gerhard commented Jun 15, 2025

@coderabbitai generate sequence diagram

@gerhard
Copy link
Member Author

gerhard commented Jun 15, 2025

@coderabbitai summary

@coderabbitai
Copy link

coderabbitai bot commented Jun 15, 2025

✅ Actions performed

Summary regeneration triggered.

@coderabbitai
Copy link

coderabbitai bot commented Jun 15, 2025

Sequence Diagram for PR

sequenceDiagram
    participant Developer
    participant GitHub
    participant Reviewer
    participant CI
    
    Developer->>GitHub: Submit PR
    GitHub->>CI: Trigger build
    CI->>GitHub: Report status
    GitHub->>Reviewer: Notify for review
    Reviewer->>GitHub: Approve/Request changes
    GitHub->>Developer: Notify result
Loading

@coderabbitai
Copy link

coderabbitai bot commented Jun 15, 2025

✅ Actions performed

Sequence diagram generated.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🔭 Outside diff range comments (1)
justfile (1)

91-97: 🛠️ Refactor suggestion

deploy runs publish twice – wastes CI minutes

deploy first invokes @just publish and then calls $(just publish …) again
to capture the image reference, so the image is built & pushed twice.

 deploy tag=_DEFAULT_TAG:
-    @just publish {{ tag }}
-    @just dagger --mod={{ DAGGER_FLY_MODULE }} call \
-      ...
-      --image=$(just publish {{ tag }})
+    IMAGE=$(@just publish {{ tag }}) \
+    && @just dagger --mod={{ DAGGER_FLY_MODULE }} call \
+         ... \
+         --image=$IMAGE
♻️ Duplicate comments (1)
test/vtc/feeds.vtc (1)

296-308: Test regex mirrors production bug – keep in sync after fix

The test also uses the duplicate-group pattern for /feed.
Once you drop the second (\?.*)? in the VCL, update the assertion here to prevent false positives.

🧹 Nitpick comments (4)
test/vtc/purge.vtc (1)

10-17: Return 403 for bad token instead of 401.

401 is intended for unauthenticated clients and invites an WWW-Authenticate header. Here the client is authenticated (they sent a token) but not authorized. 403 (“Forbidden”) is semantically closer and avoids misleading tooling.

-        return(synth(401, "Invalid PURGE token"));
+        return(synth(403, "Invalid PURGE token"));

Update the expectations for the first two client blocks accordingly.

README.md (1)

30-36: Stylistic: avoid repetitive sentence starts

Three consecutive bullets begin with “How do we …”. Re-phrasing makes the list easier to scan.

-  - How do we make this friendlier to new users?
-  - How do we make this friendlier to contributions?
-  - How easy is this to use as your own deployment?
+  - Friendliness to new users
+  - Friendliness to contributors
+  - Ease of running your own deployment
🧰 Tools
🪛 LanguageTool

[style] ~36-~36: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e this friendlier to contributions? - How easy is this to use as your own deploym...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

container.justfile (1)

49-51: PURGE_TOKEN may be empty – tests will silently skip the header

Hurl will still send Purge-Token: with an empty value, so the VCL sees a header present but blank and rejects the request (401).
Add a guard that fails fast when the variable isn’t exported:

--variable purge_token=$PURGE_TOKEN \
+{{ if ! ${PURGE_TOKEN:+x} }} && { echo "❌  PURGE_TOKEN not set"; exit 1; } || true
+--variable purge_token=$PURGE_TOKEN \
test/vtc/feeds.vtc (1)

11-274: High maintenance cost – consider parameterised VTC tests

The file is ~800 lines of near-identical blocks. GNU make style loops or the
foreach facility in VTC can generate these cases programmatically and keep the spec readable.

No action required for this PR, but worth tracking.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f75b652 and c13e952.

📒 Files selected for processing (12)
  • .github/workflows/_github.yml (0 hunks)
  • .github/workflows/_namespace.yml (0 hunks)
  • README.md (4 hunks)
  • container.justfile (1 hunks)
  • dagger/main.go (3 hunks)
  • justfile (4 hunks)
  • test/acceptance/pipedream/assets.hurl (2 hunks)
  • test/acceptance/pipedream/feed.hurl (2 hunks)
  • test/acceptance/pipedream/homepage.hurl (3 hunks)
  • test/vtc/feeds.vtc (4 hunks)
  • test/vtc/purge.vtc (1 hunks)
  • varnish/pipedream.changelog.com.vcl (1 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/_namespace.yml
  • .github/workflows/_github.yml
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~36-~36: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e this friendlier to contributions? - How easy is this to use as your own deploym...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: on-namespace / run
🔇 Additional comments (2)
test/acceptance/pipedream/homepage.hurl (1)

32-34: ⚠️ Potential issue

Avoid sending Purge-Token on plain GET.

Same concern—limit the token to PURGE operations.

-GET {{host}}?purge=true
-Purge-Token: {{purge_token}}
+GET {{host}}?purge=true

Removes unnecessary exposure of credentials.

Likely an incorrect or invalid review comment.

varnish/pipedream.changelog.com.vcl (1)

196-199: Greedy .* in /feeds/.* may swallow ? breaking the rewrite

Because .* is greedy it consumes the query-string, causing the subsequent
regsub() to append .xml after the entire URL – result:
/feeds/foo?bar.xml instead of /feeds/foo.xml?bar.

Safer pattern:

-} else if (req.url ~ "^/feeds/.*(\?.*)?$") {
+} else if (req.url ~ "^/feeds/[^?]*(\?.*)?$") {

The negative-class prevents matching the ?.

@gerhard gerhard force-pushed the auth-purge-requests branch from c13e952 to 2e91499 Compare June 29, 2025 12:58
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
dagger/main.go (1)

336-346: Container rebuilt multiple times & token always forwarded to tests.

The same issues identified in past review comments still exist:

  1. m.Test(ctx) is called multiple times, rebuilding the same container
  2. The purge token is always passed even when empty, sending an empty Purge-Token header

Apply the same fix as previously suggested:

-	var purgeToken string
-	if m.VarnishPurgeToken != nil {
-		purgeToken, err = m.VarnishPurgeToken.Plaintext(ctx)
-		if err != nil {
-			panic(err)
-		}
-	}
-
-	return m.Test(ctx).
+	testContainer := m.Test(ctx)
+	var purgeToken string
+	if m.VarnishPurgeToken != nil {
+		purgeToken, err = m.VarnishPurgeToken.Plaintext(ctx)
+		if err != nil {
+			panic(err)
+		}
+	}
+
+	args := []string{"just", "test-acceptance-local", "--variable", "host=http://pipely:9000"}
+	if purgeToken != "" {
+		args = append(args, "--variable", "purge_token="+purgeToken)
+	}
+
+	return testContainer.
 		WithServiceBinding("pipely", pipely).
-		WithExec([]string{"just", "test-acceptance-local", "--variable", "host=http://pipely:9000", "--variable", "purge_token=" + purgeToken})
+		WithExec(args)
🧹 Nitpick comments (1)
README.md (1)

34-36: Consider varying sentence beginnings for better readability.

Three consecutive questions begin with "How", which slightly affects readability.

  - How do we make this friendlier to new users?
  - How do we make this friendlier to contributions?
- - How easy is this to use as your own deployment?
+ - Is this easy to use as your own deployment?
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c13e952 and 2e91499.

📒 Files selected for processing (12)
  • .github/workflows/_github.yml (0 hunks)
  • .github/workflows/_namespace.yml (0 hunks)
  • README.md (4 hunks)
  • container.justfile (1 hunks)
  • dagger/main.go (5 hunks)
  • justfile (4 hunks)
  • test/acceptance/pipedream/assets.hurl (2 hunks)
  • test/acceptance/pipedream/feed.hurl (2 hunks)
  • test/acceptance/pipedream/homepage.hurl (3 hunks)
  • test/vtc/feeds.vtc (4 hunks)
  • test/vtc/purge.vtc (1 hunks)
  • varnish/pipedream.changelog.com.vcl (1 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/_github.yml
  • .github/workflows/_namespace.yml
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/vtc/purge.vtc
  • test/acceptance/pipedream/assets.hurl
  • varnish/pipedream.changelog.com.vcl
  • test/acceptance/pipedream/homepage.hurl
  • test/acceptance/pipedream/feed.hurl
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~36-~36: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e this friendlier to contributions? - How easy is this to use as your own deploym...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 golangci-lint (1.64.8)
dagger/main.go

104-104: undefined: dag

(typecheck)

🔇 Additional comments (9)
test/vtc/feeds.vtc (1)

11-350: Excellent test coverage for feed URL variations.

The comprehensive test coverage for trailing slashes, query parameters, and all feed endpoints ensures robust URL normalization functionality. The systematic approach with consistent patterns across all feed types is well-implemented.

README.md (1)

26-26: Documentation accurately reflects completed PURGE authentication.

The checklist update from partial to complete status correctly reflects the implementation of PURGE token authentication.

dagger/main.go (1)

118-121: The conditional PURGE_TOKEN handling looks correct.

The implementation properly checks if VarnishPurgeToken is not nil before setting the environment variable, which maintains a clear contract between presence and absence of authentication.

container.justfile (2)

49-49: Proper environment variable handling for purge token.

The addition of purge_token=${PURGE_TOKEN:-""} correctly handles the optional purge token with a sensible default, aligning with the authentication requirements.


62-95: Well-organized benchmark targets with clear naming convention.

The systematic reorganization of benchmark targets with numeric suffixes (1-6) and explicit environment labels (origin, Fastly, Bunny, Pipedream, local, TLS proxy) significantly improves clarity and maintainability.

justfile (4)

25-29: Improved local testing with explicit purge token handling.

The explicit multiline command structure with PURGE_TOKEN="test-acceptance-local" provides clear, testable authentication for local development.


33-41: Secure credential management for production testing.

The use of 1Password CLI (op read) for secure purge token retrieval follows security best practices and prevents credential exposure in the codebase.


91-96: Improved deploy workflow with dependency on publish.

The refactored deploy target that internally calls publish and uses its output ensures consistency and eliminates the need for separate publish commands in CI workflows.


106-109: Enhanced secrets management with multiple credentials.

The consolidated secrets command efficiently sets both HONEYCOMB_API_KEY and PURGE_TOKEN in a single operation, improving deployment efficiency.

@gerhard gerhard force-pushed the auth-purge-requests branch from 2e91499 to f82b321 Compare June 29, 2025 13:03
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
dagger/main.go (1)

329-346: Unresolved issues from previous review remain.

The TestAcceptance method still has the same problems flagged in past reviews:

  1. m.Test(ctx) is called twice, causing redundant container rebuilds
  2. The purge_token variable is always passed even when empty, potentially leaking an empty token

Apply the suggested fix from the previous review:

-	pipely, err := m.Test(ctx).
+	testContainer := m.Test(ctx)
+	pipely, err := testContainer.
		AsService(dagger.ContainerAsServiceOpts{UseEntrypoint: true}).
		Start(ctx)
	if err != nil {
		panic(err)
	}

	var purgeToken string
	if m.VarnishPurgeToken != nil {
		purgeToken, err = m.VarnishPurgeToken.Plaintext(ctx)
		if err != nil {
			panic(err)
		}
	}

-	return m.Test(ctx).
+	return testContainer.
		WithServiceBinding("pipely", pipely).
-		WithExec([]string{"just", "test-acceptance-local", "--variable", "host=http://pipely:9000", "--variable", "purge_token=" + purgeToken})
+		WithExec(append(
+			[]string{"just", "test-acceptance-local", "--variable", "host=http://pipely:9000"},
+			func() []string {
+				if purgeToken != "" {
+					return []string{"--variable", "purge_token=" + purgeToken}
+				}
+				return nil
+			}()...))
🧹 Nitpick comments (1)
README.md (1)

30-36: Comprehensive review checklist improves contributor guidance.

The expanded checklist with detailed questions about benchmarking, VCL efficiency, functionality, and user-friendliness provides excellent guidance for contributors and reviewers.

Consider varying the sentence beginnings to improve readability:

- How do we make this friendlier to new users?
- How do we make this friendlier to contributions?
- How easy is this to use as your own deployment?
+ How can we make this friendlier to new users?
+ What would make this more contribution-friendly?
+ How easy is this to use as your own deployment?
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e91499 and f82b321.

📒 Files selected for processing (12)
  • .github/workflows/_github.yml (0 hunks)
  • .github/workflows/_namespace.yml (0 hunks)
  • README.md (4 hunks)
  • container.justfile (1 hunks)
  • dagger/main.go (5 hunks)
  • justfile (4 hunks)
  • test/acceptance/pipedream/assets.hurl (2 hunks)
  • test/acceptance/pipedream/feed.hurl (2 hunks)
  • test/acceptance/pipedream/homepage.hurl (3 hunks)
  • test/vtc/feeds.vtc (4 hunks)
  • test/vtc/purge.vtc (1 hunks)
  • varnish/pipedream.changelog.com.vcl (1 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/_namespace.yml
  • .github/workflows/_github.yml
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/vtc/purge.vtc
  • varnish/pipedream.changelog.com.vcl
  • test/acceptance/pipedream/feed.hurl
  • test/acceptance/pipedream/homepage.hurl
  • justfile
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~36-~36: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e this friendlier to contributions? - How easy is this to use as your own deploym...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 golangci-lint (1.64.8)
dagger/main.go

104-104: undefined: dag

(typecheck)

🔇 Additional comments (9)
test/vtc/feeds.vtc (3)

10-275: Excellent comprehensive test coverage for feed URL variants.

The mock server setup thoroughly covers all feed endpoints with their URL variants (base, trailing slash, and query parameters). This comprehensive approach ensures robust testing of the URL routing logic.


296-350: VCL configuration correctly implements feed URL routing.

The regex patterns properly handle optional trailing slashes and query parameters with single capture groups. The duplicate regex issue from previous reviews has been resolved. The URL rewriting logic consistently transforms feed URLs to their corresponding .xml endpoints.


385-799: Comprehensive client test coverage validates all feed URL routing scenarios.

The test cases thoroughly validate all feed endpoints with their URL variants. The systematic approach of testing base URLs, trailing slashes, and query parameters ensures robust validation of the routing logic. The consistent test structure enhances maintainability.

dagger/main.go (1)

118-121: LGTM - Conditional environment variable setting.

The conditional logic correctly addresses the previous review concern by only setting the PURGE_TOKEN environment variable when a token is provided, maintaining a clear contract between presence and absence of the variable.

test/acceptance/pipedream/assets.hurl (2)

12-18: LGTM - Proper PURGE authentication.

The PURGE request correctly includes the Purge-Token header for authentication and updates the assertions to validate the synthetic response. Good that the token is only included on PURGE requests and not leaked on GET requests.


2-2: Query parameter addition enhances test coverage.

Adding the ?hurl=true parameter to the GET request improves test differentiation and coverage.

README.md (1)

26-26: LGTM - Accurately reflects completed feature.

The checklist update correctly marks the PURGE authentication feature as completed, aligning with the PR implementation.

container.justfile (2)

49-49: LGTM - Proper purge token integration.

The purge token variable correctly sources from the environment with an appropriate empty string fallback for optional authentication scenarios.


57-95: Excellent benchmark organization improvement.

The restructured benchmark targets with explicit numbering, clear descriptions, and logical grouping (app vs feed, different environments) significantly improve usability and maintainability.

@gerhard gerhard force-pushed the auth-purge-requests branch 2 times, most recently from 86da29a to f1a8d83 Compare June 29, 2025 16:12
So that we don't allow anyone to PURGE URLs. `purge-token` request
header is required if the instance has been configured with
`PURGE_TOKEN` secret (exposed as an environment variable).

And a few other improvements:
- add `PURGE` VTC & acceptance tests
- handle URL parameters for all feed redirects
- add extra tests to cover feed URL variations
- wrap long commands in the `justfile` so that they are easier to read
- separate the benchmark just commands into app & feed (inside the debug
  container) & capture the intended run order
- add a few ideas for all contributors review
- upgrade Dagger to v0.18.12 (latest release)

Required by:
- thechangelog/changelog.com#549

Signed-off-by: Gerhard Lazu <gerhard@changelog.com>
@gerhard gerhard force-pushed the auth-purge-requests branch from f1a8d83 to 45df30a Compare June 29, 2025 16:21
@gerhard gerhard merged commit 932c769 into main Jun 29, 2025
4 checks passed
@gerhard gerhard deleted the auth-purge-requests branch June 29, 2025 18:41
@coderabbitai coderabbitai bot mentioned this pull request Jul 12, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants