Skip to content

test(branch): log in with MFA_SECRET when the test account has two-factor on (DX-31560) - #281

Merged
reeshika-h merged 1 commit into
developmentfrom
test/DX-31560-branch-api-test-mfa-login
Nov 12, 2026
Merged

reeshika-h merged 1 commit into
developmentfrom
test/DX-31560-branch-api-test-mfa-login

Conversation

@reeshika-h

Copy link
Copy Markdown
Contributor

What

BranchAPITest (the live check for publish_config.environments on branch create, DX-31564) logs in with a plain email and password. On an account with two-factor on, the API answers 401 with error 294, so the whole class fails at login and Java has no live branch-create result.

This adds an optional MFA_SECRET to TestClient and, when it is set, passes it to client.login(email, password, params) as mfaSecret. The SDK already supports this and generates the one-time code, so no TOTP code is added. When MFA_SECRET is not set, the plain login is unchanged. The test javadoc documents the new variable.

Test code only. No change to the SDK.

Verified

Full suite on development plus this change, against api.contentstack.io (NA prod), account with two-factor on:

  • Unit: 340 passed, 0 failed, 2 skipped.
  • API: 193 passed, 0 failed, 14 skipped (Release, Asset and Stack skips, unrelated to this change).
  • BranchAPITest: 7 of 7 pass (two names, fetch read-back, empty list, no publish_config, unknown name 422, mixed names 422, wrong-case name 422).
  • Before this change the same class failed at login (error 294) on the same account.

Notes

  • Surefire here is configured with skipTests true in the pom, so mvn clean test -DskipTests=false (as AGENTS.md says) runs zero tests. I set it to false locally to run the suite; that is not in this PR. Worth fixing separately.
  • mvn test -Dtest=BranchAPITest also selects no tests in this setup; the class runs through the suite.

🤖 Generated with Claude Code

…ctor on (DX-31560)

BranchAPITest logs in with a plain email and password, so it cannot run on an
account with two-factor on: the API answers 401 error 294. Add an optional
MFA_SECRET to TestClient and pass it to client.login as mfaSecret when set, so
the SDK generates the one-time code. Without MFA_SECRET the plain login is
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@reeshika-h
reeshika-h requested a review from a team as a code owner November 12, 2026 07:26
@snyk-io

snyk-io Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@reeshika-h
reeshika-h merged commit f45afb2 into development Nov 12, 2026
9 checks passed
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.

2 participants