feat(OBE-9898): always require a token; read site_version claim#110
Open
saurabhchauhan-s1 wants to merge 1 commit into
Open
feat(OBE-9898): always require a token; read site_version claim#110saurabhchauhan-s1 wants to merge 1 commit into
saurabhchauhan-s1 wants to merge 1 commit into
Conversation
The `vector` source's auth had a `require_token` config that, when set to false, let token-less requests through for staged migration. That bypass applied to *every* sink — including upgraded sites that should never skip auth — so it was a blunt, unsafe instrument. This removes `require_token` entirely: a token is now always required (`authenticate` rejects a missing `authorization` header unconditionally), which closes the "upgraded sites skipping auth" gap. Instead of a global flag, the source now reads the per-token `site_version` claim that the manager stamps onto every site token (OBE-9896) and surfaces it for telemetry / future per-version policy. Older tokens that predate the claim are tolerated (the claim is optional). Notes: - `AuthConfig` uses `#[serde(deny_unknown_fields)]`, so this is a breaking change: any config TOML that *sets* `require_token` will now fail to parse. The manager never emitted that field, so generated configs are unaffected. - The `site_version` claim name is the cross-repo contract with the manager's `SiteVersionClaim`; both sides pin the literal "site_version" with a unit test so a rename can't silently break compatibility. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
vectorsource's auth previously had arequire_tokenconfig. When set tofalseit allowed token-less requests through (a staged-migration escape hatch for older agents). The problem: that bypass applied to every sink — including upgraded sites that should never be able to skip auth — making it a blunt, unsafe instrument.This PR (OBE-9898):
require_tokenentirely. A token is now always required:Auth::authenticaterejects a missingauthorizationheader unconditionally. This closes the "upgraded sites skipping auth" gap.site_versionclaim that the manager's auth-service stamps onto every site token (OBE-9896), instead of relying on a global flag. It's surfaced for telemetry / future per-version policy via a small pureextract_site_versionhelper. Tokens minted before the claim existed are tolerated (the claim is optional).The
site_versionclaim name is the cross-repo contract with the manager'sSiteVersionClaim— both sides pin the literal"site_version"with a unit test so a rename on either side fails its own suite rather than silently breaking compatibility.Files:
src/sources/util/jwt_auth.rs(config + auth logic + tests),src/sources/vector/mod.rs(integration tests + comments),src/sinks/vector/config.rsandsrc/test_util/jwt_auth.rs(comment / helper cleanup).Vector configuration
A
vectorsource with auth — note there is no longer arequire_tokenkey:Any config that still sets
require_token = ...will now fail to parse (deny_unknown_fields).How did you test this PR?
Unit tests added/updated in
src/sources/util/jwt_auth.rs:missing_authorization_is_rejected,valid_token_is_accepted,invalid_token_is_rejected— a token is always required.site_version_claim_name_is_stable— pins the claim name to"site_version"(cross-repo contract).extract_site_version_reads_the_claim/_absent_is_none/_wrong_type_is_none— read behavior incl. tolerating absent/odd claims.authenticate_surfaces_site_version_when_present— end-to-end on a real signed token.require_tokenpush/healthcheck integration tests insrc/sources/vector/mod.rswere removed or consolidated to the "token always required" posture.flake.nixnix shell and nix isn't available on my machine; a directcargobuild fails on the transitivemetricsdependency (unrelated to this change). The Rust changes were verified by inspection; please rely on CI (make fmt/make check-clippy/make test) to validate the build.Change Type
Is this a breaking change?
Removing
require_tokenunder#[serde(deny_unknown_fields)]means any config TOML that sets it will now fail to parse. The manager (the only generator of these source configs) never emitted that field, so generated configs are unaffected.Does this PR include user facing changes?
no-changeloglabel to this PR.(No changelog fragment added yet — happy to add one, or a maintainer can apply the label.)
References
site_versionclaim) — https://sentinelone.atlassian.net/browse/OBE-9896🤖 Generated with Claude Code