Skip to content

AMP-31197 AMP Security Review Triage - #4508

Open
brianbrix wants to merge 12 commits into
developfrom
fix/AMP-31197/AMP-Security-Review-Triage
Open

AMP-31197 AMP Security Review Triage#4508
brianbrix wants to merge 12 commits into
developfrom
fix/AMP-31197/AMP-Security-Review-Triage

Conversation

@brianbrix

Copy link
Copy Markdown
Contributor

No description provided.

AMP-SEC-001 / 002 / 031: /rest/** bypasses Spring Security, and @ApiMethod.authTypes() defaults to no auth,
Copilot AI lite review requested due to automatic review settings August 9, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR appears to address security-review findings by shifting AMP REST endpoint authorization to a fail-closed model: endpoints without explicit auth rules now require authentication by default, and endpoints intended to be public are explicitly marked as such.

Changes:

  • Introduces AuthRule.PUBLIC and updates authorization logic to default to AUTHENTICATED when no authTypes are declared.
  • Updates many REST endpoints to explicitly declare authTypes = AuthRule.PUBLIC where anonymous access is intended.
  • Adjusts REST-related security and Swagger authorization rule handling to align with the new PUBLIC concept.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
amp/src/main/webapp/WEB-INF/applicationContext.xml Replaces /rest/** security="none" with a Spring Security <http> block (CSRF disabled, stateless session policy, digest entry point configured).
amp/src/main/java/org/digijava/kernel/ampapi/swagger/SwaggerAuthorization.java Adds AuthRule.PUBLIC to the set of rules ignored by Swagger authorization decoration.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/util/ApiMethod.java Documents the new fail-closed default and instructs using PUBLIC for anonymous access.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/security/AuthRule.java Adds AuthRule.PUBLIC to explicitly mark endpoints as anonymous.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/security/ActionAuthorizer.java Implements fail-closed default auth behavior and explicit PUBLIC opt-out logic.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/publicportal/PublicEndpoint.java Marks several public-portal endpoints as explicitly PUBLIC.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/dashboards/EndPoints.java Marks several dashboard endpoints as explicitly PUBLIC.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/common/TranslationsEndPoints.java Marks translation-related endpoints as explicitly PUBLIC.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/common/FiltersEndpoint.java Marks many filter endpoints as explicitly PUBLIC.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/common/CommonEndpoint.java Marks FM-related endpoints as explicitly PUBLIC.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/common/AmpConfiguration.java Marks settings/config endpoints as explicitly PUBLIC.
amp/src/main/java/org/digijava/kernel/ampapi/endpoints/calendar/CalendarEndpoint.java Marks calendar retrieval endpoint as explicitly PUBLIC.
amp/src/main/java/org/dgfoundation/amp/onepager/components/fields/AmpComponentField.java Minor whitespace-only change in exception handling line.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread amp/src/main/webapp/WEB-INF/applicationContext.xml Outdated
@Path("/finstrument")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
@ApiMethod(ui = false, id = "ftype")
@ApiMethod(ui = false, id = "ftype", authTypes = AuthRule.PUBLIC)
AMP-SEC-017 / 054: AMP passwords are stored and compared in plaintext via NoOpPasswordEncoder
AMP-SEC-017 / 054: AMP passwords are stored and compared in plaintext via NoOpPasswordEncoder
AMP-SEC-006 / 077: POST /rest/indicator/indicator-layer/import is unauthenticated and accepts arbitrary Excel
AMP-SEC-004 / 005: Resource read/upload endpoints are unauthenticated
…sted digi.xml config digester

digi.xml intentionally uses a DOCTYPE-declared SYSTEM general entity
(&commonEntities;) to include digi-common.xml. Disallowing DOCTYPE
declarations in DigesterFactory.newDigester broke Tomcat startup
(DigiConfigManager/DigiXmlECSLoaderListener). This factory only ever
parses trusted, locally-deployed config files, so DOCTYPE and general
entities are now allowed there; external parameter entities and
external DTD loading stay disabled.
ampTemplate/site-config.xml declares internal-only general entities
(&ampVersion;, &releaseDate;, etc.) via a DOCTYPE internal subset.
Disallowing DOCTYPE broke ShowLayout for any page rendered through
this template. Allow DOCTYPE here (still fully local/internal, no
SYSTEM/external entity involved).
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