Skip to content

Commit fb0137d

Browse files
authored
docs: tidy AuthStep credential-guard comments (#123)
PR: #123
1 parent c9409ad commit fb0137d

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

  • sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/pipeline/steps

sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/pipeline/steps/AuthStep.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import java.io.IOException
2121
*
2222
* ## HTTPS-only
2323
*
24-
* The HTTPS requirement guards credential **stamping**: before a credential is attached
25-
* [process] rejects non-HTTPS schemes, before any token fetch or header stamp, to prevent
26-
* credential leakage over plaintext. The check is case-insensitive (`HTTPS`/`https`/`HtTpS`
24+
* The HTTPS requirement guards credential **stamping**: on the path that attaches a
25+
* credential, [process] rejects non-HTTPS schemes before any token fetch or header stamp,
26+
* to prevent credential leakage over plaintext. The check is case-insensitive (`HTTPS`/`https`/`HtTpS`
2727
* all pass). Failure throws [IllegalStateException] naming the concrete step type and the
2828
* offending scheme. The guard is *not* applied when no credential is being attached — see
2929
* Cross-origin redirects, where a marker-suppressed re-issue is forwarded credential-free
@@ -65,13 +65,10 @@ public abstract class AuthStep : HttpStep {
6565
request: Request,
6666
next: PipelineNext,
6767
): Response {
68-
// A cross-origin redirect re-issue is marked by DefaultRedirectStep; do NOT re-stamp
69-
// the caller's credential onto a server-chosen foreign host. The marker is stripped so
70-
// it never reaches the wire. This branch is evaluated BEFORE the HTTPS guard: no
71-
// credential is attached here, so the plaintext credential-leak the guard protects
72-
// against cannot occur, and a cross-origin hop the redirect step deliberately followed
73-
// (including an opted-in HTTPS->HTTP downgrade) must not be turned into a hard failure.
74-
// The HTTPS guard applies only on the credential-stamping branch below.
68+
// A cross-origin redirect re-issue is marked by DefaultRedirectStep; skip re-stamping the
69+
// caller's credential onto a server-chosen foreign host, and strip the marker so it never
70+
// reaches the wire. Deliberately evaluated before the HTTPS guard: no credential is attached
71+
// here, so an intentionally allowed downgrade hop is forwarded instead of hard-failing.
7572
val authorized =
7673
if (CrossOriginRedirectMarker.isMarked(request)) {
7774
request.newBuilder()

0 commit comments

Comments
 (0)